(->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`
Key to reference assistant role in ChatML format
Key to reference `assistant` role in ChatML format
(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.
(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, etcparams is the main payload of the call containing model params, and prompt in messagescontent is intended for complete workflow where we do not have chat messages in paramsMake 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`
(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.
Key to reference system role in ChatML format
Key to reference `system` role in ChatML format
Key to reference user role in ChatML format
Key to reference `user` role in ChatML format
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |