# DoctranPropertyExtractor

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/document_transformers/doctran_text_extract/DoctranPropertyExtractor)

Extract properties from text documents using doctran.

## Signature

```python
DoctranPropertyExtractor(
    self,
    properties: List[dict],
    openai_api_key: Optional[str] = None,
    openai_api_model: Optional[str] = None,
)
```

## Description

**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,
    },
]

# Pass in openai_api_key or set env var OPENAI_API_KEY
property_extractor = DoctranPropertyExtractor(properties)
transformed_document = await qa_transformer.atransform_documents(documents)

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `properties` | `List[dict]` | Yes | A list of the properties to extract. |
| `openai_api_key` | `Optional[str]` | No | OpenAI API key. Can also be specified via environment variable ``OPENAI_API_KEY``. (default: `None`) |

## Extends

- `BaseDocumentTransformer`

## Constructors

```python
__init__(
    self,
    properties: List[dict],
    openai_api_key: Optional[str] = None,
    openai_api_model: Optional[str] = None,
) -> None
```

| Name | Type |
|------|------|
| `properties` | `List[dict]` |
| `openai_api_key` | `Optional[str]` |
| `openai_api_model` | `Optional[str]` |


## Properties

- `properties`
- `openai_api_key`
- `openai_api_model`

## Methods

- [`atransform_documents()`](https://reference.langchain.com/python/langchain-community/document_transformers/doctran_text_extract/DoctranPropertyExtractor/atransform_documents)
- [`transform_documents()`](https://reference.langchain.com/python/langchain-community/document_transformers/doctran_text_extract/DoctranPropertyExtractor/transform_documents)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/document_transformers/doctran_text_extract.py#L7)