Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,51 @@ we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
to add `VISION_AGENT_API_KEY="My Apikey"` to your `.env` file
so that your Apikey is not stored in source control.

### Split

Split parsed documents into separate sections based on classification rules and identifiers.

```
import json
import requests
from io import BytesIO

VA_API_KEY = 'YOUR_VA_API_KEY' # Replace with your API key
headers = {"Authorization": f"Basic {VA_API_KEY}"}

pdf_path = f'YOUR_PATH/TO/YOUR_PDF.pdf'

# Parse the document first
with open(pdf_path, "rb") as f:
parse_response = requests.post(
url="https://api.va.landing.ai/v1/ade/parse",
headers=headers,
files=[("document", f)],
# The selected model defaults to its latest available version.
# To specify an older version (e.g., 'model-name-date'), modify the model string.
# Details on all supported model versions: [https://docs.landing.ai/ade/ade-parse-models#model-versions-and-snapshots]
data={"model": "dpt-2"}
)

# Split the document using the split rules
split_class = [
{
"name": "Explanation of Benefits (EOB)",
"description": "A statement from a health insurance company detailing medical services received, amounts billed, and payments made.",
"identifier": "Claim #"
}
]
markdown_content = parse_response.json()["markdown"]
split_response = requests.post(
url="https://api.va.landing.ai/v1/ade/split",
headers=headers,
files=[("markdown", BytesIO(markdown_content.encode('utf-8')))],
data={"split_class": json.dumps(split_class)},
)

print(split_response.json())
```

### Parse Jobs

For processing large documents asynchronously:
Expand Down