LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    LangGraph Checkpoint
    Checkpoint Postgres
    Store Postgres
    Checkpoint SQLite
    LangGraph Prebuilt
    LangGraph CLI
    LangGraph SDK
    LangGraph Supervisor
    LangGraph Swarm
    Language
    Theme
    Pythonlanggraph.store.postgresbaseIVFFlatConfig
    Class●Since v2.0

    IVFFlatConfig

    IVFFlat index divides vectors into lists, and then searches a subset of those lists that are closest to the query vector. It has faster build times and uses less memory than HNSW, but has lower query performance (in terms of speed-recall tradeoff).

    Three keys to achieving good recall are:

    1. Create the index after the table has some data
    2. Choose an appropriate number of lists - a good place to start is rows / 1000 for up to 1M rows and sqrt(rows) for over 1M rows
    3. When querying, specify an appropriate number of probes (higher is better for recall, lower is better for speed) - a good place to start is sqrt(lists)
    Copy
    IVFFlatConfig()

    Bases

    ANNIndexConfig

    Attributes

    attribute
    kind: Literal['ivfflat']
    attribute
    nlist: int

    Number of inverted lists (clusters) for IVF index.

    Determines the number of clusters used in the index structure. Higher values can improve search speed but increase index size and build time. Typically set to the square root of the number of vectors in the index.

    Inherited fromANNIndexConfig

    Attributes

    Avector_type: Literal['vector', 'halfvec']
    —

    Type of vector storage to use.

    View source on GitHub