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

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

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

    load_query_constructor_chain

    Load a query constructor chain.

    Copy
    load_query_constructor_chain(
      llm: BaseLanguageModel,
      document_contents: str,
      attribute_info: Sequence[AttributeInfo | dict],
      examples: list | None = None,
      allowed_comparators: Sequence[Comparator] = tuple(Comparator),
      allowed_operators: Sequence[Operator] = tuple(Operator),
      enable_limit: bool = False,
      schema_prompt: BasePromptTemplate | None = None,
      **kwargs: Any = {}
    ) -> LLMChain

    Parameters

    NameTypeDescription
    llm*BaseLanguageModel

    BaseLanguageModel to use for the chain.

    document_contents*str

    The contents of the document to be queried.

    attribute_info*Sequence[AttributeInfo | dict]

    Sequence of attributes in the document.

    exampleslist | None
    Default:None

    Optional list of examples to use for the chain.

    allowed_comparatorsSequence[Comparator]
    Default:tuple(Comparator)

    Sequence of allowed comparators. Defaults to all Comparator objects.

    allowed_operatorsSequence[Operator]
    Default:tuple(Operator)

    Sequence of allowed operators. Defaults to all Operator objects.

    enable_limitbool
    Default:False

    Whether to enable the limit operator.

    schema_promptBasePromptTemplate | None
    Default:None

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

    **kwargsAny
    Default:{}

    Arbitrary named params to pass to LLMChain.

    View source on GitHub