Knowledge Graph
Knowledge Graph
Build interconnected knowledge with entities and relationships. The knowledge graph enables complex queries, reasoning, and discovery of hidden connections.
Key Concepts
Entities
Named objects like people, companies, concepts, or topics extracted from your data.
Relationships
Typed connections between entities like "works_at", "mentions", "related_to".
Traversal
Query across relationships to discover multi-hop connections and patterns.
Automatic Entity Extraction
When you add memories or documents, Hebbrix automatically:
- Extracts named entities (people, organizations, locations, concepts)
- Creates relationships between entities based on context
- Links entities to source memories for provenance tracking
- Merges duplicate entities intelligently
Endpoints
Code Examples
Explore Entities
Python
from hebbrix import Hebbrix
client = Hebbrix()
# List all people in the knowledge graph
people = client.graph.entities.list(type="person", limit=20)
for person in people:
print(f"{person.name} - {len(person.relationships)} connections")Query Relationships
Python (Relationships)
# Find all entities connected to a person
entity = client.graph.entities.get("entity_abc123")
for rel in entity.relationships:
print(f"{entity.name} --[{rel.type}]--> {rel.target.name}")
# Example output:
# John Doe --[works_at]--> Acme Inc
# John Doe --[knows]--> Jane Smith
# John Doe --[interested_in]--> Machine LearningGraph Traversal
Python (Traversal)
# Find connections up to 2 hops away
results = client.graph.query(
start_entity="John Doe",
relationship_types=["works_at", "knows"],
max_depth=2
)
# Discover hidden connections
for path in results.paths:
print(" -> ".join([node.name for node in path]))
# Example output:
# John Doe -> Acme Inc -> Jane Smith
# John Doe -> Bob Wilson -> TechCorpcURL Example
POST
/v1/graph/querycurl -X POST "https://api.hebbrix.com/v1/graph/query" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"start_entity": "John Doe",
"relationship_types": [
"works_at",
"knows"
],
"max_depth": 2,
"limit": 50
}'Common Entity Types
personorganizationlocationconceptproducteventtechnologycustom