langchain.chains.openai_tools.extraction.create_extraction_chain_pydantic¶

langchain.chains.openai_tools.extraction.create_extraction_chain_pydantic(pydantic_schemas: Union[List[Type[BaseModel]], Type[BaseModel]], llm: BaseLanguageModel, system_message: str = 'Extract and save the relevant entities mentioned in the following passage together with their properties.\n\nIf a property is not present and is not required in the function parameters, do not include it in the output.') Runnable[source]¶

Creates a chain that extracts information from a passage.

Parameters
  • pydantic_schemas (Union[List[Type[BaseModel]], Type[BaseModel]]) – The schema of the entities to extract.

  • llm (BaseLanguageModel) – The language model to use.

  • system_message (str) – The system message to use for extraction.

Returns

A runnable that extracts information from a passage.

Return type

Runnable

Examples using create_extraction_chain_pydantic¶