Python client for the Graphora API
Project description
Graphora Client Library
A Python client for interacting with the Graphora API. This library provides a simple and intuitive interface for working with Graphora's graph-based data processing capabilities. Graphora is a Text to Knowledge Graphs platform that helps you transform unstructured text into powerful knowledge graphs.
Features
- Complete API Coverage: Access all Graphora API endpoints
- Type Safety: Fully typed with Pydantic models
- Async Support: Efficient handling of long-running operations
- Minimal Dependencies: Lightweight with few external dependencies
- Comprehensive Documentation: Detailed guides and API references
Installation
pip install graphora
Quick Start
from graphora import GraphoraClient
# Initialize client
client = GraphoraClient(
base_url="https://api.graphora.io",
api_key="your-api-key" # Or set GRAPHORA_API_KEY environment variable
)
# Upload an ontology
with open("ontology.yaml", "r") as f:
ontology_yaml = f.read()
ontology_response = client.validate_ontology(ontology_yaml)
ontology_id = ontology_response.id
# Upload documents for processing
transform_response = client.upload_documents(
ontology_id=ontology_id,
files=["document1.pdf", "document2.txt"]
)
# Wait for processing to complete
transform_status = client.wait_for_transform(transform_response.id)
# Get the resulting graph
graph = client.get_graph(transform_id=transform_response.id)
# Print nodes and edges
print(f"Nodes: {len(graph.nodes)}")
print(f"Edges: {len(graph.edges)}")
# Start merging the processed data
merge_response = client.start_merge(
session_id=ontology_id,
transform_id=transform_response.id
)
Environment Variables
The following environment variables can be used to configure the client:
GRAPHORA_API_KEY: Your Graphora API keyGRAPHORA_API_URL: Custom API URL (overrides environment-based URL)
Documentation
For detailed documentation, see the docs directory or visit our official documentation website.
Examples
Check out the examples directory for sample code demonstrating various use cases.
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file graphora-0.1.0.tar.gz.
File metadata
- Download URL: graphora-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7843ac27ef40b71ef712e2eb726b72690c986343b6b87338d3b97340d21ef6f
|
|
| MD5 |
ef85803ff5a1d84ffe11a5a056ad0c86
|
|
| BLAKE2b-256 |
73a33b04f5ec797f9bb6c8283792310978474d80aab537283bc7cdb87b3c3e08
|