pub struct HttpEmbeddingConfig {
pub api_url: String,
pub api_key: String,
pub model_name: String,
pub dimensions: usize,
pub headers: HashMap<String, String>,
}Expand description
Configuration for an HTTP-based embedding API.
Fields§
§api_url: StringThe API endpoint URL.
api_key: StringThe API key for authentication.
model_name: StringThe model name to request.
dimensions: usizeThe dimensionality of the returned embeddings.
headers: HashMap<String, String>Additional headers to include in requests.
Implementations§
Source§impl HttpEmbeddingConfig
impl HttpEmbeddingConfig
Sourcepub fn openai(api_key: impl Into<String>, model: impl Into<String>) -> Self
pub fn openai(api_key: impl Into<String>, model: impl Into<String>) -> Self
Create a configuration for OpenAI’s embedding API.
Default dimensions: 1536 for text-embedding-ada-002, 3072 for text-embedding-3-large.
Sourcepub fn cohere(api_key: impl Into<String>, model: impl Into<String>) -> Self
pub fn cohere(api_key: impl Into<String>, model: impl Into<String>) -> Self
Create a configuration for Cohere’s embedding API.
Default dimensions: 1024 for embed-english-v3.0.
Sourcepub fn voyage(api_key: impl Into<String>, model: impl Into<String>) -> Self
pub fn voyage(api_key: impl Into<String>, model: impl Into<String>) -> Self
Create a configuration for Voyage AI’s embedding API.
Default dimensions: 1024 for voyage-2.
Sourcepub fn with_dimensions(self, dimensions: usize) -> Self
pub fn with_dimensions(self, dimensions: usize) -> Self
Override the embedding dimensions.
Trait Implementations§
Source§impl Clone for HttpEmbeddingConfig
impl Clone for HttpEmbeddingConfig
Source§fn clone(&self) -> HttpEmbeddingConfig
fn clone(&self) -> HttpEmbeddingConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpEmbeddingConfig
impl Debug for HttpEmbeddingConfig
Source§impl<'de> Deserialize<'de> for HttpEmbeddingConfig
impl<'de> Deserialize<'de> for HttpEmbeddingConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HttpEmbeddingConfig
impl RefUnwindSafe for HttpEmbeddingConfig
impl Send for HttpEmbeddingConfig
impl Sync for HttpEmbeddingConfig
impl Unpin for HttpEmbeddingConfig
impl UnsafeUnpin for HttpEmbeddingConfig
impl UnwindSafe for HttpEmbeddingConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more