Expand description
Embedding model implementations for LangChainRust.
Provides embedding generation via multiple backends:
- OpenAI (
text-embedding-ada-002,text-embedding-3-small/large) - DeepSeek
- Qwen (Alibaba Cloud / DashScope)
- Local:
BagOfWordsEmbeddings(always available) andLocalEmbeddings(ONNX, feature-gated) MockEmbeddingsfor testing
Modules§
- openai_
compat - Shared base class for OpenAI-compatible-protocol embedding clients (P1-5).
Structs§
- BagOf
Words Embeddings - Lightweight local embedding (word-frequency hash + L2 normalization)
- Cohere
Embeddings - Cohere embedding provider.
- Cohere
Embeddings Config - Cohere embedding configuration.
- Deep
Seek Embeddings Config - Configuration for DeepSeek embeddings API.
- Mock
Embeddings - Mock embeddings for testing purposes.
- OpenAI
Embeddings - OpenAI Embeddings client
- OpenAI
Embeddings Config - OpenAI Embeddings configuration
- Qwen
Embeddings Config - Configuration for Qwen embeddings API.
Enums§
- Cohere
Embed Input Type - Cohere embedding input type.
- Embedding
Error - Embedding error type
Constants§
- COHERE_
EMBED_ BASE_ URL - Cohere API base URL.
- COHERE_
EMBED_ MODEL - Default Cohere embedding model.
- DEEPSEEK_
EMBED_ MODEL - Default embedding model for DeepSeek.
- QWEN_
EMBED_ MODEL - Default embedding model for Qwen.
Traits§
- Embeddings
- Embedding model trait
Functions§
- cosine_
similarity - Compute cosine similarity between two vectors.
- l2_
normalize - In-place L2 normalization: scale
vecto unit length.
Type Aliases§
- Deep
Seek Embeddings - DeepSeek embeddings client for generating vector embeddings.
- Qwen
Embeddings - Qwen embeddings client for generating vector embeddings.