import os
from graphora import GraphoraClient, DocumentMetadata, DocumentType
client = GraphoraClient(
auth_token=os.environ["GRAPHORA_AUTH_TOKEN"],
)
# Use a previously registered ontology
ontology_id = "ont_123456789"
# Prepare document paths and metadata
document_paths = [
"document1.pdf",
"document2.docx"
]
metadata = [
DocumentMetadata(
source="Annual Report 2024",
document_type=DocumentType.PDF,
tags=["finance", "annual", "report"],
custom_metadata={
"department": "Finance",
"confidentiality": "Internal"
}
),
DocumentMetadata(
source="Product Specifications",
document_type=DocumentType.DOCX,
tags=["product", "specifications", "technical"],
custom_metadata={
"department": "Engineering",
"product_id": "PRD-2024-001"
}
)
]
# Transform the documents with metadata
response = client.transform(ontology_id, document_paths, metadata=metadata)
print(f"Transformation started with ID: {response.id}")