langchain.chains.query_constructor.base.get_query_constructor_promptΒΆ

langchain.chains.query_constructor.base.get_query_constructor_prompt(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_core.structured_query.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_core.structured_query.Operator] = (<Operator.AND: 'and'>, <Operator.OR: 'or'>, <Operator.NOT: 'not'>), enable_limit: bool = False, schema_prompt: ~typing.Optional[~langchain_core.prompts.base.BasePromptTemplate] = None, **kwargs: ~typing.Any) BasePromptTemplate[source]ΒΆ

Create query construction prompt.

Parameters
  • document_contents (str) – The contents of the document to be queried.

  • attribute_info (Sequence[Union[AttributeInfo, dict]]) – A list of AttributeInfo objects describing the attributes of the document.

  • examples (Optional[Sequence]) – Optional list of examples to use for the chain.

  • allowed_comparators (Sequence[Comparator]) – Sequence of allowed comparators.

  • allowed_operators (Sequence[Operator]) – Sequence of allowed operators.

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

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

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

Returns

A prompt template that can be used to construct queries.

Return type

BasePromptTemplate

Examples using get_query_constructor_promptΒΆ