pub struct EmbedOptions {
pub headers: Option<Headers>,
pub capture_raw_body: Option<bool>,
pub capture_usage: Option<bool>,
pub dimensions: Option<usize>,
pub encoding_format: Option<String>,
pub user: Option<String>,
pub embedding_type: Option<String>,
pub truncate: Option<String>,
}Expand description
Options for customizing embedding requests.
Fields§
§headers: Option<Headers>Custom headers to include in the request.
capture_raw_body: Option<bool>Whether to capture the raw response body for provider-specific features.
capture_usage: Option<bool>Whether to capture usage information (token counts, etc.).
dimensions: Option<usize>The desired dimensionality of the embedding vectors (if supported by the provider). Note: Not all providers support custom dimensions.
encoding_format: Option<String>The encoding format for the embeddings (if supported by the provider). Common values: “float”, “base64”, “binary”, etc.
user: Option<String>A unique identifier representing your end-user (for OpenAI and similar providers).
embedding_type: Option<String>The type/purpose of the embedding request.
- Cohere: “search_document”, “search_query”, “classification”, “clustering”
- Gemini: “SEMANTIC_SIMILARITY”, “RETRIEVAL_QUERY”, “RETRIEVAL_DOCUMENT”, “CLASSIFICATION”
Default: “search_document” (Cohere), “SEMANTIC_SIMILARITY” (Gemini)
truncate: Option<String>How to handle inputs longer than the maximum token length (supported by Cohere). Common values: “NONE”, “START”, “END” Default: “END”
Implementations§
Source§impl EmbedOptions
Constructors
impl EmbedOptions
Constructors
Source§impl EmbedOptions
Chainable Setters
impl EmbedOptions
Chainable Setters
Sourcepub fn with_headers(self, headers: Headers) -> Self
pub fn with_headers(self, headers: Headers) -> Self
Set custom headers for the request.
Sourcepub fn with_capture_raw_body(self, capture: bool) -> Self
pub fn with_capture_raw_body(self, capture: bool) -> Self
Enable or disable capturing the raw response body.
Sourcepub fn with_capture_usage(self, capture: bool) -> Self
pub fn with_capture_usage(self, capture: bool) -> Self
Enable or disable capturing usage information.
Sourcepub fn with_dimensions(self, dimensions: usize) -> Self
pub fn with_dimensions(self, dimensions: usize) -> Self
Set the desired dimensionality of the embedding vectors.
Sourcepub fn with_encoding_format(self, format: impl Into<String>) -> Self
pub fn with_encoding_format(self, format: impl Into<String>) -> Self
Set the encoding format for the embeddings.
Sourcepub fn with_embedding_type(self, embedding_type: impl Into<String>) -> Self
pub fn with_embedding_type(self, embedding_type: impl Into<String>) -> Self
Set the type/purpose of the embedding request.
Sourcepub fn with_truncate(self, truncate: impl Into<String>) -> Self
pub fn with_truncate(self, truncate: impl Into<String>) -> Self
Set the truncation method for inputs longer than the maximum token length.
Source§impl EmbedOptions
Getters
impl EmbedOptions
Getters
Sourcepub fn capture_raw_body(&self) -> bool
pub fn capture_raw_body(&self) -> bool
Get whether to capture raw body.
Sourcepub fn capture_usage(&self) -> bool
pub fn capture_usage(&self) -> bool
Get whether to capture usage.
Sourcepub fn dimensions(&self) -> Option<usize>
pub fn dimensions(&self) -> Option<usize>
Get the desired dimensions.
Sourcepub fn encoding_format(&self) -> Option<&str>
pub fn encoding_format(&self) -> Option<&str>
Get the encoding format.
Sourcepub fn embedding_type(&self) -> Option<&str>
pub fn embedding_type(&self) -> Option<&str>
Get the type/purpose of the embedding request.
Trait Implementations§
Source§impl Clone for EmbedOptions
impl Clone for EmbedOptions
Source§fn clone(&self) -> EmbedOptions
fn clone(&self) -> EmbedOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more