Embedding Models
Embedding models convert text into vector representations, enabling semantic search and knowledge base operations. Similar concepts produce similar vectors, which is what powers retrieval-augmented generation (RAG).
How Embeddings Work
- Documents are chunked and converted to embeddings.
- Embeddings are stored in a vector database.
- When a task queries the knowledge base, Xagent searches for similar embeddings.
- Retrieved content is provided as context to the LLM.
When to Configure
An embedding model is required for knowledge base functionality — uploading and searching documents, building RAG systems, and semantic retrieval.
Supported Providers
| Provider | Models | Best for |
|---|---|---|
| OpenAI & compatible | text-embedding-3-small / -large, text-embedding-ada-002 | General-purpose embeddings. |
| DashScope (Alibaba Cloud) | text-embedding-v4 / v3 / v2 | Chinese / Asian-language optimization. |
| Xinference | bge-large-en-v1.5, bge-base-en, all-MiniLM-L6-v2, other HuggingFace models | Privacy and self-hosting. |
HuggingFace models
To use HuggingFace embedding models, deploy them via Xinference and point Xagent at the Xinference Base URL.
Parameters
| Parameter | Description |
|---|---|
| Dimensions | Vector size. Lower (384–768) is faster and cheaper; higher (3072+) improves accuracy at more storage cost. |
| Chunk size | Tokens per chunk when indexing (typically 512–1000). Smaller chunks are more precise; larger chunks carry more context. |
Best Practices
- General use: OpenAI
text-embedding-3-small— good cost/performance. - Highest quality:
text-embedding-3-largeorbge-large-en-v1.5. - Match chunk size to typical query length and use overlap to preserve context.