LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    Standard Tests
    Text Splitters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    Standard Tests
    Text Splitters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Language
    Theme
    Pythonlangchain-classicchainsquery_constructorbaseload_query_constructor_runnable
    Function●Since v1.0

    load_query_constructor_runnable

    Copy
    load_query_constructor_runnable(
      llm: BaseLanguageModel,
      document_contents: str,
      attribute_info: Sequence[AttributeInfo
    View source on GitHub
    |
    dict
    ]
    ,
    *
    ,
    examples
    :
    Sequence
    |
    None
    =
    None
    ,
    allowed_comparators
    :
    Sequence
    [
    Comparator
    ]
    =
    tuple
    (
    Comparator
    )
    ,
    allowed_operators
    :
    Sequence
    [
    Operator
    ]
    =
    tuple
    (
    Operator
    )
    ,
    enable_limit
    :
    bool
    =
    False
    ,
    schema_prompt
    :
    BasePromptTemplate
    |
    None
    =
    None
    ,
    fix_invalid
    :
    bool
    =
    False
    ,
    **
    kwargs
    :
    Any
    =
    {
    }
    )
    ->
    Runnable

    Parameters

    NameTypeDescription
    llm*BaseLanguageModel

    BaseLanguageModel to use for the chain.

    document_contents*str

    Description of the page contents of the document to be queried.

    attribute_info*Sequence[AttributeInfo | dict]

    Sequence of attributes in the document.

    examplesSequence | None
    Default:None
    allowed_comparatorsSequence[Comparator]
    Default:tuple(Comparator)
    allowed_operatorsSequence[Operator]
    Default:tuple(Operator)
    enable_limitbool
    Default:False
    schema_promptBasePromptTemplate | None
    Default:None
    fix_invalidbool
    Default:False
    kwargsAny
    Default:{}

    Load a query constructor runnable chain.

    Optional list of examples to use for the chain.

    Sequence of allowed comparators. Defaults to all Comparator objects.

    Sequence of allowed operators. Defaults to all Operator objects.

    Whether to enable the limit operator.

    Prompt for describing query schema. Should have string input variables allowed_comparators and allowed_operators.

    Whether to fix invalid filter directives by ignoring invalid operators, comparators and attributes.

    Additional named params to pass to FewShotPromptTemplate init.