AI Personal Learning
and practical guidance
讯飞绘镜

Knowledge Graph Studio (WhyHow): open source platform for creating and managing knowledge graphs, with native support for RAG applications

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.

WhyHow(知识图谱工作室):创建和管理知识图谱的开源平台,RAG应用原生支持-1


 

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

  1. Cloning Warehouse:
   git clone git@github.com:whyhow-ai/knowledge-graph-studio.git
cd knowledge-graph-studio
  1. Install the dependencies:
   pip install .
  1. Developer Installation:
   pip install -e .[dev,docs]

Quick Start

  1. Preparation:
    • OpenAI API Key
    • MongoDB Account
    • Creating Projects and Clusters in MongoDB Atlas
  2. Configure environment variables:
   cp .env.sample .env

update.envvalues in the file:

   WHYHOW__EMBEDDING__OPENAI__API_KEY=<你的OpenAI API密钥>
WHYHOW__GENERATIVE__OPENAI__API_KEY=<你的OpenAI API密钥>
WHYHOW__MONGODB__USERNAME=<你的MongoDB用户名>
WHYHOW__MONGODB__PASSWORD=<你的MongoDB密码>
WHYHOW__MONGODB__DATABASE_NAME=main
WHYHOW__MONGODB__HOST=<你的MongoDB主机>
  1. Create databases and collections:
   cd src/whyhow_api/cli/
python admin.py setup-collections --config-file collection_index_config.json
  1. Create user and API keys:
   python admin.py create-user --email <你的邮箱地址> --openai-key <你的OpenAI API密钥>
  1. Start the API server:
   uvicorn src.whyhow_api.main:app

Using the SDK

  1. Install the Python SDK:
   pip install whyhow
  1. Configure the WhyHow client:
   from whyhow import WhyHow
client = WhyHow(api_key='<你的WhyHow API密钥>', base_url="http://localhost:8000")
  1. Create workspaces and maps:
   workspace = client.workspaces.create(name="Demo Workspace")
chunk = client.chunks.create(workspace_id=workspace.workspace_id, chunks=[Chunk(content="示例内容")])
triples = [Triple(head=Node(name="示例节点", label="示例标签"), relation=Relation(name="示例关系"), tail=Node(name="示例尾节点", 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)
  1. Query Mapping:
   query = client.graphs.query_unstructured(graph_id=graph.graph_id, query="示例查询")

Using Docker

  1. Build the mirror image:
   docker build --platform=linux/amd64 -t kg_engine:v1 .
  1. Run the image:
   docker run -it --rm -p 1234:8000 kg_engine:v1
May not be reproduced without permission:Chief AI Sharing Circle " Knowledge Graph Studio (WhyHow): open source platform for creating and managing knowledge graphs, with native support for RAG applications
en_USEnglish