create_qa_with_structure_chain#

langchain.chains.openai_functions.qa_with_structure.create_qa_with_structure_chain(llm: BaseLanguageModel, schema: dict | Type[BaseModel], output_parser: str = 'base', prompt: PromptTemplate | ChatPromptTemplate | None = None, verbose: bool = False) LLMChain[source]#

Deprecated since version 0.2.13: This function is deprecated. Refer to this guide on retrieval and question answering with structured responses: https://python.langchain.com/docs/how_to/qa_sources/#structure-sources-in-model-response It will be removed in None==1.0.

Create a question answering chain that returns an answer with sources

based on schema.

Parameters:
  • llm (BaseLanguageModel) – Language model to use for the chain.

  • schema (dict | Type[BaseModel]) – Pydantic schema to use for the output.

  • output_parser (str) – Output parser to use. Should be one of pydantic or base. Default to base.

  • prompt (PromptTemplate | ChatPromptTemplate | None) – Optional prompt to use for the chain.

  • verbose (bool)

Return type:

LLMChain

Returns: