Configuration for indexing documents for semantic search in the store.

This configures how documents are embedded and indexed for vector similarity search.

interface IndexConfig {
    dims: number;
    embeddings: Embeddings;
    fields?: string[];
}

Properties

dims: number

Number of dimensions in the embedding vectors.

Common embedding model dimensions:

  • OpenAI text-embedding-3-large: 256, 1024, or 3072
  • OpenAI text-embedding-3-small: 512 or 1536
  • OpenAI text-embedding-ada-002: 1536
  • Cohere embed-english-v3.0: 1024
  • Cohere embed-english-light-v3.0: 384
  • Cohere embed-multilingual-v3.0: 1024
  • Cohere embed-multilingual-light-v3.0: 384
embeddings: Embeddings

The embeddings model to use for generating vectors. This should be a LangChain Embeddings implementation.

fields?: string[]

Fields to extract text from for embedding generation.

Path syntax supports:

  • Simple field access: "field"
  • Nested fields: "metadata.title"
  • Array indexing:
    • All elements: "chapters[*].content"
    • Specific index: "authors[0].name"
    • Last element: "array[-1]"

Default

["$"] Embeds the entire document as one vector