Liking cljdoc? Tell your friends :D

llm.sdk.providers.cohere.embeddings

Cohere embed adapter — POST {base}/embed.

Cohere's wire shape diverges from OpenAI's in three places:

  • Request uses :texts (vector) instead of :input.
  • Request carries a required :input_type (search_document / search_query / classification / clustering) which lives in canonical request as :embed/provider-options :input-type. Defaults to "search_document" when omitted — that's the safest fallback for general-purpose retrieval.
  • Response embeddings live under :embeddings.float (newer API with multi-format support) or :embeddings (legacy single format). Usage is in :meta.billed_units.input_tokens.

Live smoke is env-gated under COHERE_API_KEY.

Cohere embed adapter — POST {base}/embed.

 Cohere's wire shape diverges from OpenAI's in three places:
- Request uses :texts (vector) instead of :input.
- Request carries a required :input_type
     (search_document / search_query / classification / clustering)
     which lives in canonical request as
     :embed/provider-options :input-type. Defaults to
     "search_document" when omitted — that's the safest fallback
     for general-purpose retrieval.
- Response embeddings live under :embeddings.float (newer API
     with multi-format support) or :embeddings (legacy single
     format). Usage is in :meta.billed_units.input_tokens.

 Live smoke is env-gated under COHERE_API_KEY.
raw docstring

build-embed-request-cohereclj

(build-embed-request-cohere profile request)
source

make-transportclj

(make-transport)
source

normalize-cohere-embedding-usageclj

(normalize-cohere-embedding-usage raw)

Cohere /embed returns {:meta {:billed_units {:input_tokens N} :api_version {...}}}

Cohere /embed returns
{:meta {:billed_units {:input_tokens N} :api_version {...}}}
sourceraw docstring

parse-embed-error-cohereclj

(parse-embed-error-cohere profile status body)
source

parse-embed-response-cohereclj

(parse-embed-response-cohere profile raw)
source

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close