Public declaration syntax from forge-rs/crates/forge-embed/src/embed.rs Original source SHA-256: eb51d8b701081c2e2939e1ba0778ec1685017b467a99a88204016a610365e324 Function bodies and constant values are omitted. This is not the complete implementation. Source line 42 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct EmbeddingResult { /// The embedding vector. pub vector: Vec, /// The model that produced this embedding. pub model: String, /// The number of dimensions in the embedding vector. pub dimensions: usize } Source line 83 #[async_trait] pub trait EmbeddingProvider: Send + Sync { /// Returns the model identifier for this provider (e.g., "text-embedding-3-small"). fn model_id(&self) -> &str; /// Generates embedding vectors for one or more text inputs. /// /// # Arguments /// /// * `input` - A slice of strings to embed. Must contain at least one item. /// /// # Returns /// /// A vector of embedding vectors, one per input string, in the same order. /// /// # Errors /// /// Returns [`ForgeEmbedError::ModelError`] if the provider call fails, /// or [`ForgeEmbedError::EmptyInput`] if the input slice is empty. async fn embed(&self, input: &[String]) -> Result>, ForgeEmbedError>; } Source line 131 pub async fn embed(provider: &dyn EmbeddingProvider, text: &str) -> EmbedResult; Source line 194 pub async fn embed_many( provider: &dyn EmbeddingProvider, texts: &[String], ) -> EmbedResult>;