ExOpenAI.Embeddings.create_embedding
create_embedding
, go back to ExOpenAI.Embeddings module for more information.
Specs
create_embedding(any(), any(), openai_organization_key: String.t(), openai_api_key: String.t(), user: String.t(), stream_to: pid() ) :: {:ok, ExOpenAI.Components.CreateEmbeddingResponse.t()} | {:error, any()}
Creates an embedding vector representing the input text.
Endpoint: https://api.openai.com/v1/embeddings
Method: POST
Docs: https://platform.openai.com/docs/api-reference/embeddings
Required Arguments:
input
: Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed the max input tokens for the model (8191 tokens fortext-embedding-ada-002
). Example Python code for counting tokens.model
: ID of the model to use. You can use the List models API to see all of your available models, or see our Model overview for descriptions of them.
Optional Arguments:
stream_to
: PID of the process to stream content touser
: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
Example: "user-1234"
openai_api_key
: OpenAI API key to pass directly. If this is specified, it will override theapi_key
config value.openai_organization_key
: OpenAI API key to pass directly. If this is specified, it will override theorganization_key
config value.