create_vector_index_config#

langgraph.store.mongodb.base.create_vector_index_config(dims: int | None, embed: Embeddings | Callable[[Sequence[str]], list[list[float]]] | Callable[[Sequence[str]], Awaitable[list[list[float]]]] | str, fields: list[str] | None = None, name: str = 'vector_index', relevance_score_fn: Literal['euclidean', 'cosine', 'dotProduct', None] = 'cosine', embedding_key: str | None = 'embedding', filters: list[str] | None = None) VectorIndexConfig[source]#

Factory function creates a VectorIndexConfig instance with sensible defaults.

Parameters:
  • dims (int | None) – Dimensions of the embedding vectors.

  • embed (Embeddings | Callable[[Sequence[str]], list[list[float]]] | Callable[[Sequence[str]], Awaitable[list[list[float]]]] | str) – Embedding model.

  • fields (list[str] | None) – Field to extract text from for embedding generation (list of length 1).

  • name (str) – Arbitrary name to give to the index in Atlas.

  • relevance_score_fn (Literal['euclidean', 'cosine', 'dotProduct', None]) – Function used to establish similarity of vectors.

  • embedding_key (str | None) – Name of the field used in the collection to store vectors.

  • filters (list[str] | None) – List of (possibly nested) fields to index allowing filtering.

Return type:

VectorIndexConfig

Returns: VectorIndexConfig to be passed to MongoDBStore constructor.