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_constructorbaseget_query_constructor_prompt
    Function●Since v1.0

    get_query_constructor_prompt

    Copy
    get_query_constructor_prompt(
      document_contents: str,
      attribute_info: Sequence[AttributeInfo | dict

    Used in Docs

    • Self Querying with SAP HANA Cloud Vector Engine
    View source on GitHub
    ]
    ,
    *
    ,
    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
    ,
    **
    kwargs
    :
    Any
    =
    {
    }
    )
    ->
    BasePromptTemplate

    Parameters

    NameTypeDescription
    document_contents*str

    The contents of the document to be queried.

    attribute_info*Sequence[AttributeInfo | dict]

    A list of AttributeInfo objects describing the attributes of 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
    kwargsAny
    Default:{}

    Create query construction prompt.

    Optional list of examples to use for the chain.

    Sequence of allowed comparators.

    Sequence of allowed operators.

    Whether to enable the limit operator.

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

    Additional named params to pass to FewShotPromptTemplate init.