Liking cljdoc? Tell your friends :D

bosquet.llm.oai-shaped-llm


->completionclj

(->completion {[{:keys [text message]} & _choices] :choices
               {total_tokens :total_tokens
                prompt_tokens :prompt_tokens
                completion_tokens :completion_tokens}
                 :usage})

Build Bosquet completion data structure from the OAI-shaped responses.

Gets only the first of completion choices

Build Bosquet completion data structure from
the OAI-shaped responses.

Gets only the first of completion `choices`
sourceraw docstring

assistantclj

Key to reference assistant role in ChatML format

Key to reference `assistant` role in ChatML format
sourceraw docstring

chatclj

(chat service-cfg params)
source

chatml->bosquetclj

(chatml->bosquet {r :role c :content})
source

completeclj

(complete service-cfg {prompt :prompt :as params})
source

completion-fnclj

(completion-fn {:keys [api-endpoint api-endpoint-messages api-key]})

Create completion http client based on passed in parameters. If api-endpoint is specified in the configuration then it will be assumed that OAI style endpoint URL structure is used. If we get api-endpoint-messages then we use endpoint URL for that specific task as it is passed in in the config.

Create completion http client based on passed in parameters.
If `api-endpoint` is specified in the configuration then it will be assumed that
OAI style endpoint URL structure is used.
If we get `api-endpoint-messages` then we use endpoint URL for that specific task
as it is passed in in the config.
sourceraw docstring

contentclj

source

create-completionclj

(create-completion {default-params :model-params :as service-cfg} params)
(create-completion service-cfg params content)

Make a call to OAI API shaped service.

  • service-cfg will contain props needed to make call: endpoint, model defaults, etc
  • params is the main payload of the call containing model params, and prompt in messages
  • content is intended for complete workflow where we do not have chat messages in params
Make a call to OAI API shaped service.

- `service-cfg` will contain props needed to make call: endpoint, model defaults, etc
- `params` is the main payload of the call containing model params, and prompt in `messages`
- `content` is intended for `complete` workflow where we do not have chat `messages` in `params`
sourceraw docstring

prep-paramsclj

(prep-params params)
(prep-params params defaults)

Shape params into the LLM API service required structure. Remove or move Bosquet parameters.

If params has no model specified model in default-parms will be used.

Shape `params` into the LLM API service required structure.
Remove or move `Bosquet` parameters.

If `params` has no `model` specified model in `default-parms` will be used.
sourceraw docstring

roleclj

source

systemclj

Key to reference system role in ChatML format

Key to reference `system` role in ChatML format
sourceraw docstring

userclj

Key to reference user role in ChatML format

Key to reference `user` role in ChatML format
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close