openai_struct/models/create_embedding_request.rs
1/*
2 * OpenAI API
3 *
4 * The OpenAI REST API. Please see pub https://platform.openai.com/docs/api-reference for more details.
5 *
6 * OpenAPI spec pub version: 2.3.0
7 *
8 * Generated pub by: https://github.com/swagger-api/swagger-codegen.git
9 */
10
11#[allow(unused_imports)]
12use serde_json::Value;
13
14#[derive(Debug, Serialize, Deserialize)]
15pub struct CreateEmbeddingRequest {
16 /// The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.
17 #[serde(rename = "dimensions")]
18 pub dimensions: Option<i32>,
19 /// The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).
20 #[serde(rename = "encoding_format")]
21 pub encoding_format: Option<String>,
22 /// 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. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. Some models may also impose a limit on total number of tokens summed across inputs.
23 #[serde(rename = "input")]
24 pub input: Value,
25 /// ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models) for descriptions of them.
26 #[serde(rename = "model")]
27 pub model: Value,
28 /// A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).
29 #[serde(rename = "user")]
30 pub user: Option<String>,
31}