Skip to main content
Vector stores enable semantic search and RAG-enhanced extraction for large documents or multi-file processing.

When to Use Vector Stores?


Vector Store Engines

Dex supports two vector store engines. Prefer SGP_VECTOR_STORE for new implementations.
You must update your SGP platform to support the SGP Vector Store engine. If SGP_VECTOR_STORE is not available, use SGP_KNOWLEDGE_BASE as a fallback.
The SGP Vector Store engine is the preferred vector store implementation. Use it for:
  • Document RAG workflows within Dex
  • Lexical (keyword) or hybrid search in addition to semantic search
  • Reranking search results for higher relevance
Embedding configuration: Base embedding models only (e.g., openai/text-embedding-3-large, sentence-transformers/all-mpnet-base-v2). Search features:
  • Query types: semantic, lexical, or hybrid
  • Reranking: Optional rerank_model and rerank_top_k for improved result ordering

SGP Knowledge Base — Legacy

The SGP Knowledge Base engine is SGP’s legacy vector store implementation. Its use is discouraged for new projects. Consider it only when:
  • You need integration with SGP data connectors for ingesting from external sources
  • You must use a custom embedding model deployed via the Models API (embedding_type="models_api")
  • Your SGP platform does not yet support SGP Vector Store
Embedding configuration:
  • Base models (embedding_type="base"): Use pre-configured embedding models such as openai/text-embedding-3-large
  • Models API (embedding_type="models_api"): Use a custom model deployment via model_deployment_id
Search: Semantic search only. Reranking and query type options are not supported.
create_vector_store returns DexSGPKnowledgeBase for SGP_KNOWLEDGE_BASE and DexSGPVectorStore for SGP_VECTOR_STORE. Use DexSGPVectorStore.get_by_id only for SGP Vector Store IDs—it will raise if given a Knowledge Base ID.

Creating a Vector Store


Adding Documents to Vector Store


SGP Vector Store only: use query_type and reranking for improved results:

Custom Metadata Schema

You can define custom metadata fields on your vector store and attach metadata to each parse result. This metadata is indexed and filterable when searching, so you can narrow results by document attributes such as department, document type, or priority. 1. Define the schema when creating the vector store Specify vector_store_metadata_schema as a dict mapping field names to types: "string", "int", "double", or "boolean".
2. Attach metadata when parsing Pass vector_store_metadata in your parse job parameters. The metadata is stored with the parse result and indexed when you add it to the vector store.
For custom parse results, pass vector_store_metadata when creating the parse result via DexParseResult.from_custom_results. 3. Filter on custom metadata when searching Use the filters parameter in search. Filter format depends on the engine:
The schema must be defined when creating the vector store. Fields in vector_store_metadata that are not in vector_store_metadata_schema are not indexed and cannot be used for filtering.

RAG-Enhanced Extraction

Extract data using vector store context for improved accuracy on large documents:

Pattern: RAG for Large Documents


Next Steps

  • Extract: Extract structured data from parse results or vector stores
  • Chunking: Optimize chunking for vector store embeddings
  • API Reference: Complete SDK documentation