pub async fn create_embeddings(
client: &OpenAIClient,
request: &CreateEmbeddingsRequest,
) -> Result<CreateEmbeddingsResponse, OpenAIError>
Expand description
Creates embeddings using the OpenAI Embeddings API.
§Parameters
client
- TheOpenAIClient
to use for the request.request
- ACreateEmbeddingsRequest
specifying the model and input(s).
§Returns
A CreateEmbeddingsResponse
containing one or more embedding vectors.
§Errors
OpenAIError::HTTPError
: if the request fails at the network layer.OpenAIError::DeserializeError
: if the response fails to parse.OpenAIError::APIError
: if OpenAI returns an error (e.g., invalid request).