langchain.chains.query_constructor.base.load_query_constructor_runnableΒΆ

langchain.chains.query_constructor.base.load_query_constructor_runnable(llm: ~langchain_core.language_models.base.BaseLanguageModel, document_contents: str, attribute_info: ~typing.Sequence[~typing.Union[~langchain.chains.query_constructor.schema.AttributeInfo, dict]], *, examples: ~typing.Optional[~typing.Sequence] = None, allowed_comparators: ~typing.Sequence[~langchain.chains.query_constructor.ir.Comparator] = (<Comparator.EQ: 'eq'>, <Comparator.NE: 'ne'>, <Comparator.GT: 'gt'>, <Comparator.GTE: 'gte'>, <Comparator.LT: 'lt'>, <Comparator.LTE: 'lte'>, <Comparator.CONTAIN: 'contain'>, <Comparator.LIKE: 'like'>, <Comparator.IN: 'in'>, <Comparator.NIN: 'nin'>), allowed_operators: ~typing.Sequence[~langchain.chains.query_constructor.ir.Operator] = (<Operator.AND: 'and'>, <Operator.OR: 'or'>, <Operator.NOT: 'not'>), enable_limit: bool = False, schema_prompt: ~typing.Optional[~langchain_core.prompts.base.BasePromptTemplate] = None, fix_invalid: bool = False, **kwargs: ~typing.Any) Runnable[source]ΒΆ

Load a query constructor runnable chain.

Parameters
  • llm – BaseLanguageModel to use for the chain.

  • document_contents – The contents of the document to be queried.

  • attribute_info – Sequence of attributes in the document.

  • examples – Optional list of examples to use for the chain.

  • allowed_comparators – Sequence of allowed comparators. Defaults to all Comparators.

  • allowed_operators – Sequence of allowed operators. Defaults to all Operators.

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

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

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

  • **kwargs – Additional named params to pass to FewShotPromptTemplate init.

Returns

A Runnable that can be used to construct queries.