Functions
create-embeddings
fn (p: ::openai::compatible/CompatibleProvider, request: EmbeddingsRequest): Map
fn (p: ::openai::compatible/CompatibleProvider, request: EmbeddingsRequest, opts: Map): Map
POST /embeddings on the provider. Returns the decoded body
(data[].embedding, usage), or an Err carrying HttpError.
Example
::emb ::openai-compatible::embeddings
out ::emb/create-embeddings(::openai-compatible/ollama(), ::emb/EmbeddingsRequest({
model: "nomic-embed-text",
input: ["first text", "second text"]
}))
out.data[0].embedding
embeddings-body
fn (request: EmbeddingsRequest): Map
The JSON body for an EmbeddingsRequest, with unset optionals omitted.
Pure; exposed for testing.
Example
::emb ::openai-compatible::embeddings
req ::emb/EmbeddingsRequest({model: "nomic-embed-text", input: "hello"})
::emb/embeddings-body(req) // {model: "nomic-embed-text", input: "hello"}
Types
EmbeddingsRequest
EmbeddingsRequest type {
model: Str,
input: Any,
dimensions: Int?,
encoding_format: Str?,
user: Str?
}
OpenAI embeddings request. Unset optional fields are not sent.