openai-api icon indicating copy to clipboard operation
openai-api copied to clipboard

Add support for new embeddings options/parameters

Open assembly-winston opened this issue 1 year ago • 0 comments

https://platform.openai.com/docs/api-reference/embeddings/create

There is now an option for controlling the encoding format, and for the new v3 models, the dimensions of the vector. But the EmbeddingsBody doesn't have it

#[derive(Debug, Serialize, Deserialize)]
pub struct EmbeddingsBody {
	/// 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.
	pub model: String,
	/// Input text to get embeddings for, encoded as a string or array of tokens. To get embeddings for multiple inputs in a single request,
	/// pass an array of strings or array of token arrays. Each input must not exceed 8192 tokens in length.
	pub input: Vec<String>,
	/// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
	#[serde(skip_serializing_if = "Option::is_none")]
	pub user: Option<String>,
}

assembly-winston avatar Apr 11 '24 17:04 assembly-winston