> ## Documentation Index
> Fetch the complete documentation index at: https://docs.graphora.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Graphora Client Library

> A Python client for interacting with the Graphora API

# Graphora Client Library

The Graphora Client Library provides a simple and intuitive Python interface to the Graphora API, enabling you to easily integrate Graphora's graph-based data processing capabilities into your applications and data pipelines.

## Overview

Graphora is a Text to Knowledge Graphs platform that helps you transform unstructured text into powerful knowledge graphs. The platform enables you to:

* Transform unstructured data into structured knowledge graphs
* Define custom ontologies for your domain
* Extract entities and relationships from documents
* Merge and manage graph data with conflict resolution
* Query and analyze connected data

This client library makes it easy to integrate Graphora into your data pipelines, including platforms like Apache Beam, Apache Spark, and Google Cloud Dataflow.

## Key Features

<CardGroup cols={2}>
  <Card title="Complete API Coverage" icon="globe">
    Access all Graphora API endpoints through a clean, intuitive interface
  </Card>

  <Card title="Type Safety" icon="shield-check">
    Fully typed with Pydantic models for reliable data handling
  </Card>

  <Card title="User Context" icon="user">
    All API calls are automatically scoped to the specified user
  </Card>

  <Card title="Async Support" icon="clock">
    Efficient handling of long-running operations with status monitoring
  </Card>

  <Card title="Minimal Dependencies" icon="feather">
    Lightweight implementation with few external dependencies
  </Card>

  <Card title="Comprehensive Documentation" icon="book">
    Detailed guides and API references for all functionality
  </Card>
</CardGroup>

## Installation

The Graphora client library can be installed using pip:

```bash theme={null}
pip install graphora
```

To also install the CLI for command-line extraction:

```bash theme={null}
pip install graphora[cli]
```

See the [CLI Reference](/platform/cli) for command-line usage.

## Quick Example

Here's a simple example of using the Graphora client library to upload an ontology and transform documents:

```python theme={null}
import os
from graphora import GraphoraClient

# Base URL defaults to GRAPHORA_API_URL or https://api.graphora.io
client = GraphoraClient(
    auth_token=os.environ["GRAPHORA_AUTH_TOKEN"],
)

# Register an ontology
with open("ontology.yaml", "r") as f:
    ontology_yaml = f.read()
    
ontology_response = client.register_ontology(ontology_yaml)
ontology_id = ontology_response.id

# Transform documents
transform_response = client.transform(
    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_transformed_graph(transform_id=transform_response.id)
print(f"Nodes: {len(graph.nodes)}")
print(f"Edges: {len(graph.edges)}")

# Start merging the processed data
merge = client.start_merge(
    session_id=ontology_id,
    transform_id=transform_response.id,
)
```

## Next Steps

* [Installation](/client/installation) - Detailed installation instructions
* [Quickstart Guide](/client/quickstart) - Get started with the Graphora client library
* [Core Concepts](/client/concepts/ontology) - Learn about the key concepts in Graphora
* [API Reference](/client/api/client) - Detailed API documentation
