Extract properties from text documents using doctran.
Example:
.. code-block:: python
from langchain_community.document_transformers import DoctranPropertyExtractor
properties = [ { "name": "category", "description": "What type of email this is.", "type": "string", "enum": ["update", "action_item", "customer_feedback", "announcement", "other"], "required": True, }, { "name": "mentions", "description": "A list of all people mentioned in this email.", "type": "array", "items": { "name": "full_name", "description": "The full name of the person mentioned.", "type": "string", }, "required": True, }, { "name": "eli5", "description": "Explain this email to me like I'm 5 years old.", "type": "string", "required": True, }, ]
property_extractor = DoctranPropertyExtractor(properties) transformed_document = await qa_transformer.atransform_documents(documents)
A list of the properties to extract.
OpenAI API key. Can also be specified via environment variable
OPENAI_API_KEY.
Extracts properties from text documents using doctran.
Extracts properties from text documents using doctran.