GraphoraClient
TheGraphoraClient class is the main entry point for interacting with the Graphora API. It provides methods for all major API endpoints, including ontology management, document transformation, graph merging, and graph manipulation.
Initialization
Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
base_url | str | Base URL of the Graphora API | None (defaults to GRAPHORA_API_URL or https://api.graphora.io) |
auth_token | str | Clerk-issued bearer token for authentication | None (falls back to GRAPHORA_AUTH_TOKEN) |
user_id | str | Optional identifier for client-side logging | None |
timeout | int | Request timeout in seconds | 60 |
Environment Variables
The client can also use environment variables for configuration:GRAPHORA_AUTH_TOKEN: Clerk bearer token (used whenauth_tokenis omitted)GRAPHORA_USER_ID: Optional user identifier (used only for client logs)GRAPHORA_API_URL: Optional API URL override (used whenbase_urlis omitted)
Ontology Methods
register_ontology
Register, validate and upload an ontology definition.Example
get_ontology
Retrieve an ontology by ID.Example
Transformation Methods
transform
Upload documents for processing.Example
get_transform_status
Get the status of a transformation.Example
wait_for_transform
Wait for a transformation to complete.Example
cleanup_transform
Clean up transformation data.Example
get_transformed_graph
Retrieve graph data by transform ID.Example
update_transform_graph
Save bulk modifications to the graph.Example
Merge Methods
start_merge
Start a new merge process.Example
get_merge_status
Get the status of a merge process.Example
get_conflicts
Get conflicts for a merge process.Example
resolve_conflict
Apply a resolution to a specific conflict.Example
get_merge_statistics
Get detailed statistics of a merge operation.Example
get_merged_graph
Retrieve graph data for a merge process.Example
Quality Validation Methods
The GraphoraClient includes comprehensive quality validation methods to assess and manage the quality of extracted knowledge graphs.get_quality_results
Get quality validation results for a transform.Example
approve_quality_results
Approve quality validation results and proceed to merge.Example
reject_quality_results
Reject quality validation results and stop the process.Example
get_quality_violations
Get detailed quality violations with filtering and pagination.Example
get_quality_summary
Get summary of recent quality results for the user.Example
delete_quality_results
Delete quality validation results for a transform.Example
get_quality_health
Check the health and availability of the quality validation API.Example
Quality Workflow Example
Here’s a complete example showing a typical quality validation workflow:Error Handling
TheGraphoraClient methods can raise the following exceptions:
GraphoraAPIError: Raised when the API returns an errorGraphoraClientError: Raised for client-side errors
Dashboard Methods
get_dashboard_summary
Retrieve the KPI snapshot used at the top of the dashboard.get_dashboard_runs
Fetch recent transform runs with aggregated quality and token information.get_dashboard_performance
Retrieve time-series performance metrics (duration, token usage, cost) for charting.get_dashboard_quality
Access aggregated quality stats including rule frequencies and entity coverage.Next Steps
- Check out the Models reference
- Learn about Exceptions
- Explore the Utilities module
