langchain.chains.openai_functions.qa_with_structure.create_qa_with_structure_chain¶

langchain.chains.openai_functions.qa_with_structure.create_qa_with_structure_chain(llm: BaseLanguageModel, schema: Union[dict, Type[BaseModel]], output_parser: str = 'base', prompt: Optional[Union[PromptTemplate, ChatPromptTemplate]] = None, verbose: bool = False) LLMChain[source]¶
Create a question answering chain that returns an answer with sources

based on schema.

Parameters
  • llm – Language model to use for the chain.

  • schema – Pydantic schema to use for the output.

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

  • prompt – Optional prompt to use for the chain.

Returns:

Examples using create_qa_with_structure_chain¶