Skip to main content

Crate lc_embeddings

Crate lc_embeddings 

Source
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) and LocalEmbeddings (ONNX, feature-gated)
  • MockEmbeddings for testing

Structs§

BagOfWordsEmbeddings
Lightweight local embedding (word-frequency hash + L2 normalization)
DeepSeekEmbeddings
DeepSeek embeddings client for generating vector embeddings.
DeepSeekEmbeddingsConfig
Configuration for DeepSeek embeddings API.
MockEmbeddings
Mock embeddings for testing purposes.
OpenAIEmbeddings
OpenAI Embeddings client
OpenAIEmbeddingsConfig
OpenAI Embeddings configuration
QwenEmbeddings
Qwen embeddings client for generating vector embeddings.
QwenEmbeddingsConfig
Configuration for Qwen embeddings API.

Enums§

EmbeddingError
Embedding error type

Constants§

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.

Type Aliases§

LocalEmbeddings
Without the local-embeddings feature, LocalEmbeddings is a type alias for BagOfWordsEmbeddings, maintaining backward compatibility.