pub struct CohereEmbedV4Provider { /* private fields */ }Expand description
Embedding provider backed by the Cohere v2 embed API (labeled “v4” here
to disambiguate from the existing CohereEmbeddingProvider and to
mirror the naming in higher-level integrations).
Differs from CohereEmbeddingProvider in that it exposes explicit
input_type helpers (for_search_document, for_search_query) and
supports embed-english-v3.0 / embed-multilingual-v3.0 at 1024 dims.
Implementations§
Source§impl CohereEmbedV4Provider
impl CohereEmbedV4Provider
Sourcepub fn new(api_key: impl Into<String>) -> Self
pub fn new(api_key: impl Into<String>) -> Self
Create a new v4 provider with the default model (embed-english-v3.0).
Sourcepub fn with_model(
api_key: impl Into<String>,
model: impl Into<String>,
dimensions: usize,
) -> Self
pub fn with_model( api_key: impl Into<String>, model: impl Into<String>, dimensions: usize, ) -> Self
Create with an explicit model and dimension override.
Sourcepub fn for_search_document(self) -> Self
pub fn for_search_document(self) -> Self
Configure this provider for indexing documents (search_document).
Sourcepub fn for_search_query(self) -> Self
pub fn for_search_query(self) -> Self
Configure this provider for querying (search_query).
Sourcepub fn with_input_type(self, input_type: impl Into<String>) -> Self
pub fn with_input_type(self, input_type: impl Into<String>) -> Self
Set an arbitrary input_type string.
Sourcepub fn with_base_url(self, base_url: impl Into<String>) -> Self
pub fn with_base_url(self, base_url: impl Into<String>) -> Self
Override the API base URL.
Sourcepub fn input_type(&self) -> &str
pub fn input_type(&self) -> &str
Returns the current input type.
Sourcepub fn build_payload(&self, texts: &[String]) -> Value
pub fn build_payload(&self, texts: &[String]) -> Value
Build the request payload for the Cohere v2 embed endpoint.