General Introduction
Knowledge Graph Studio (KGS) is an open source platform designed to simplify the process of creating and managing RAG-native knowledge graphs. The platform provides rule-based entity parsing, modular graph construction, flexible data ingestion, and API-first design to support developers via an SDK. Whether dealing with structured or unstructured data, Knowledge Graph Studio provides users with scalable and flexible solutions for experimental and large-scale applications. Built on a NoSQL database, the platform supports fast data retrieval and easy traversal of complex relationships, and is committed to becoming a database-agnostic solution.
Function List
- Rule-based entity resolution
- Modular mapping construction
- Flexible data ingestion
- API-first design with SDK support
- Support for structured and unstructured data
- Scalable and flexible solutions
- Fast Data Retrieval and Complex Relational Traversal
- Support for multiple databases
Using Help
Installation process
- Cloning Warehouse:
git clone git@github.com:whyhow-ai/knowledge-graph-studio.git
cd knowledge-graph-studio
- Install the dependencies:
pip install .
- Developer Installation:
pip install -e . [dev,docs]
Quick Start
- Preparation:
- OpenAI API Key
- MongoDB Account
- Creating Projects and Clusters in MongoDB Atlas
- Configure environment variables:
cp .env.sample .env
update.env
values in the file:
WHYHOW__EMBEDDING__OPENAI__API_KEY=
WHYHOW__GENERATIVE__OPENAI__API_KEY=
WHYHOW__MONGODB__USERNAME=
WHYHOW__MONGODB__PASSWORD=
WHYHOW__MONGODB__DATABASE_NAME=main
WHYHOW__MONGODB__HOST=
- Create databases and collections:
cd src/whyhow_api/cli/
python admin.py setup-collections --config-file collection_index_config.json
- Create user and API keys:
python admin.py create-user --email --openai-key
- Start the API server:
uvicorn src.whyhow_api.main:app
Using the SDK
- Install the Python SDK:
pip install whyhow
- Configure the WhyHow client:
from whyhow import WhyHow
client = WhyHow(api_key='', base_url="http://localhost:8000")
- Create workspaces and maps:
workspace = client.workspaces.create(name="Demo Workspace")
chunk = client.chunks.create(workspace_id=workspace.workspace_id, chunks=[Chunk(content="Example Content")])
triples = [Triple(head=Node(name="example node", label="example label"), relation=Relation(name="example relation"), tail=Node(name="example tail node", label="example tail label"), chunk_ids = [c.chunk_id for c in chunk])]
graph = client.graphs.create_graph_from_triples(name="Demo Graph", workspace_id=workspace.workspace_id, triples=triples)
- Query Mapping:
query = client.graphs.query_unstructured(graph_id=graph.graph_id, query="example query")
Using Docker
- Build the mirror image:
docker build --platform=linux/amd64 -t kg_engine:v1 .
- Run the image:
docker run -it --rm -p 1234:8000 kg_engine:v1