load_query_constructor_runnable#

langchain.chains.query_constructor.base.load_query_constructor_runnable(llm: BaseLanguageModel, document_contents: str, attribute_info: Sequence[AttributeInfo | dict], *, examples: Sequence | None = None, allowed_comparators: Sequence[Comparator] = (Comparator.EQ, Comparator.NE, Comparator.GT, Comparator.GTE, Comparator.LT, Comparator.LTE, Comparator.CONTAIN, Comparator.LIKE, Comparator.IN, Comparator.NIN), allowed_operators: Sequence[Operator] = (Operator.AND, Operator.OR, Operator.NOT), enable_limit: bool = False, schema_prompt: BasePromptTemplate | None = None, fix_invalid: bool = False, **kwargs: Any) Runnable[source]#

Load a query constructor runnable chain.

Parameters:
  • 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.

  • examples (Sequence | None) – Optional list of examples to use for the chain.

  • allowed_comparators (Sequence[Comparator]) – Sequence of allowed comparators. Defaults to all Comparators.

  • allowed_operators (Sequence[Operator]) – Sequence of allowed operators. Defaults to all Operators.

  • enable_limit (bool) – Whether to enable the limit operator. Defaults to False.

  • schema_prompt (BasePromptTemplate | None) – Prompt for describing query schema. Should have string input variables allowed_comparators and allowed_operators.

  • fix_invalid (bool) – Whether to fix invalid filter directives by ignoring invalid operators, comparators and attributes.

  • kwargs (Any) – Additional named params to pass to FewShotPromptTemplate init.

Returns:

A Runnable that can be used to construct queries.

Return type:

Runnable