llm-graph-builder

neo4j-labsApache-2.0活跃维护

用 LLM 从非结构化文本里自动抽取实体和关系,直接建成 Neo4j 知识图谱,省去手工建模和写 Cypher 的麻烦,适合做 GraphRAG 和知识库。

Neo4j graph construction from unstructured data using LLMs

v0.8.7发布于 2026-07-23 06:14 UTC5,302star +1 / 7 天884fork同步于 2026-11-10 23:37 UTC

怎么上手

由 README 提炼,执行前请确认
cd backend && python3.12 -m venv venv && source venv/bin/activate && pip install -r requirements.txt && uvicorn score:app --reload
硬件要求按 README 说明

README 未说明显存或 GPU 要求;后端为 Python 3.12 + FastAPI,需连接 Neo4j 5.23 及以上(含 Aura 免费版)并安装 APOC。

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 LLM 把 PDF、网页、视频等非结构化数据抽取成 Neo4j 知识图谱的实验性工具

用 LLM 从非结构化文本里自动抽取实体和关系,直接建成 Neo4j 知识图谱,省去手工建模和写 Cypher 的麻烦,适合做 GraphRAG 和知识库。

核心能力

  • 用 LLM 从文档中抽取节点、关系和属性
  • 支持自定义 schema 或复用已有 schema 建图
  • 在 Neo4j Bloom 中可视化单个或多个数据源的图
  • 用对话方式查询图数据并追溯答案来源
  • 可切换 OpenAI、Gemini、Diffbot、Ollama 等多种 LLM

容易踩的坑

Neo4j 必须 5.23 及以上并装 APOC,5.20 等旧版因 Cypher 语法不兼容会失败;需先复制 backend/example.env 并填好 NEO4J_URI、用户名、密码和数据库名;用 Neo4j Desktop 时 docker-compose 不可用,需分别部署前后端;默认只启用 OpenAI 和 Diffbot,Gemini 需额外 GCP 配置。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.8.7
  1. v0.8.7最新正式版2026-07-23 · 2026-07-23 06:14 UTC

    Release Notes

    Features & Enhancements

    • Updated support for latest models across OpenAI, Gemini, Anthropic Claude, Fireworks DeepSeek and others #1549
    • Added link to Neo4j Document Intelligence — users can try the newer agentic extraction app #1575
    • File table “select all” checkbox now selects only rows on the current page, with clearer tooltip #1563
    • Fix metrics tooltip width to prevent oversized popovers in DataGrid #1545

    Bug Fixes

    • Fixed embedding dimension mismatch during post-processing #1562
    • Fixed layout breaking when the side chat drawer is open at browser zoom above 100% #1563

    Security

    This release includes a broad security hardening pass across the application:

    • Authentication & access control — all APIs now require verified token-based authentication, and user data is scoped to the authenticated user
    • Input validation — file uploads and web URLs are validated and sanitized before processing
    • Credential handling — sensitive data removed from logs and configuration files
    • Safer defaults — restricted cross-origin access, disabled risky query execution, and added safeguards against untrusted external content

    Maintenance

    • Replaced discontinued langchain-experimental and langchain-community packages (#1571)
  2. v0.8.62026-06-11 · 2026-06-11 06:18 UTC
    查看更新说明
    Release note:
    1. Updated packages and dependencies Upgraded core packages and project dependencies to ensure security, stability, and compatibility.
    2. Wikipedia extraction failing error resolved Resolved an issue where Wikipedia data extraction failed due to rate limiting done by wikipedia.
    3. Documentation updated - readme updated Updated the README and setup documentation.
    4. Updated llm models Expanded LLM provider support to include the latest production models from Google, OpenAI, Anthropic, and DeepSeek.
    5. Bugs resolved
    • Index mismatch: Fixed a post-processing crash caused by index mismatches when switching between multiple historical embedding models.
    • Source table deletion: Resolved a issue that prevented users from deleting all rows simultaneously in the source table.-
    • Web page extraction: Fixed web page extraction failing issue for mismatched HTTP/HTTPS protocols.
    • Graph visualization: Fixed a UI freeze issue where the graph visualization crashed upon clicking the 'Cancel' button.
  3. v0.8.52026-02-11 · 2026-02-11 05:52 UTC
    查看更新说明

    Release Notes This release focuses on embedding model support, and improved token usage tracking.

    Embeddding Model

    • User can select variety of embedding models to generate vector embeddings for your data. This can be configured from the frontend in Graph Settings > Processing Configuration > Select Embedding Model.
    • Supported model providers include OpenAI, Gemini, Amazon Titan, and Sentence Transformers.
    • Your selected embedding model is saved to your user profile when TRACK_USER_USAGE is enabled.

    Token usage tracking issues fixed

    • Null email in for some users leading to errors of exhausted token limit #1463
    • Modular approach to disable token tracking error by env variable LIMIT_TOKEN_USAGE_PER_USER
    • Add a team contact option when token limit is exhausted
  4. v0.8.42026-01-15 · 2026-01-15 13:04 UTC
    查看更新说明

    Release Notes

    This release focuses on dependency upgrades, model updates, cleaner architecture, and improved usage tracking.

    Dependencies

    • Updated all frontend and backend dependencies to their latest stable versions.

    Authentication

    • Login functionality is now enabled for the production-deployed environment.

    LLM Model Updates

    • Added and upgraded to the latest supported LLMs, including Gemini 2.5, OpenAI GPT-5.x, Anthropic Claude 4.5, Bedrock Nova variants, Groq, Fireworks models, and others.

    • Gemini 2.5 flash is default model

    Codebase Improvements

    • Refactored codebase to remove unnecessary logic.
    • Introduced Dependency Injection and Reduced API function parameters.
    • Streamlined API flows with uniform input parameters for better consistency and maintainability.

    Documentation

    • Updated README and refreshed both backend and frontend documentation.
    • Updated example env for better understanding of what are optional and mandatory envs required.

    Token Usage Tracking

    • Token usage is now tracked per user for extract, chatbot, and post-processing APIs.
    • Non-Neo4j users receive a daily limit of 250,000 tokens and a monthly limit of 1,000,000 tokens.
    • Limits can be reset via cron jobs.
    • Repository users can enable tracking using TRACK_USER_USAGE=true.
    • Current usage is visible in the UI under the logged-in user section.
  5. v0.8.32025-06-24 · 2025-06-24 09:00 UTC
    查看更新说明

    🚀 Features • Added Data Importer support – import graph models from Neo4j Console Preview into LLM Graph Builder. (#1301 ) • Claude 4 Sonnet (Anthropic) now available in production. (#1299 ) 🛠️ Updates • Backend dependencies upgraded to latest versions. (#1321 ) 🐞 Fixes • Protobuf file duplicate error resolved (#1323 ) • Resolved issue with missing YouTube transcripts. (#1321)

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Knowledge Graph Builder

    This is an experimental Neo4j Labs project and not part of Neo4j's supported product lineup. See the Neo4j Labs disclaimer. Python FastAPI React

    Transform unstructured data (PDFs, DOCs, TXTs, YouTube videos, web pages, etc.) into a structured Knowledge Graph stored in Neo4j using the power of Large Language Models (LLMs) and the LangChain framework.

    This application allows you to upload files from various sources (local machine, GCS, S3 bucket, or web sources), choose your preferred LLM model, and generate a Knowledge Graph.

    Getting Started

    Prerequisites

    • Python 3.12 or higher (for local/separate backend deployment)
    • Neo4j Database 5.23 or later with APOC installed.
      • Neo4j 5.23 is required because the backend uses the Cypher variable-scope subquery syntax (CALL (variable) { ... }), which is not supported by earlier Neo4j 5.x releases such as 5.20.
      • Neo4j Aura databases (including the free tier) are supported.
      • If using Neo4j Desktop, you will need to deploy the backend and frontend separately (docker-compose is not supported).
    Backend Setup
    1. Create a .env file in the backend folder by copying backend/example.env.
    2. Pre-configure user credentials in the .env file to bypass the login dialog:
      NEO4J_URI=<your-neo4j-uri>
      NEO4J_USERNAME=<your-username>
      NEO4J_PASSWORD=<your-password>
      NEO4J_DATABASE=<your-database-name>
      
    3. Run:
      cd backend
      python3.12 -m venv venv
      source venv/bin/activate  # On Windows: venv\Scripts\activate
      pip install -r requirements.txt
      uvicorn score:app --reload
      

    Key Features

    Knowledge Graph Creation

    • Seamlessly transform unstructured data into structured Knowledge Graphs using advanced LLMs.
    • Extract nodes, relationships, and their properties to create structured graphs.

    Schema Support

    • Use a custom schema or existing schemas configured in the settings to generate graphs.

    Graph Visualization

    • View graphs for specific or multiple data sources simultaneously in Neo4j Bloom.

    Chat with Data

    • Interact with your data in the Neo4j database through conversational queries.
    • Retrieve metadata about the source of responses to your queries.
    • For a dedicated chat interface, use the standalone chat application with the /chat-only route.

    LLMs Supported

    1. OpenAI
    2. Gemini
    3. Diffbot
    4. Azure OpenAI (dev deployed version)
    5. Anthropic (dev deployed version)
    6. Fireworks (dev deployed version)
    7. Groq (dev deployed version)
    8. Amazon Bedrock (dev deployed version)
    9. Ollama (dev deployed version)
    10. Deepseek (dev deployed version)
    11. Other OpenAI-compatible base URL models (dev deployed version)

    Token Usage Tracking

    • Easily monitor and track your LLM token usage for each user and database connection.
    • Enable this feature by setting the TRACK_USER_USAGE environment variable to true in your backend configuration.
    • View your daily and monthly token consumption and limits, helping you manage usage and avoid overages.
    • You can check your remaining token limits at any time using the provided API endpoint.

    Embedding Model Selection

    • Choose from a variety of embedding models to generate vector embeddings for your data. This can be configured from the frontend in Graph Settings > Processing Configuration > Select Embedding Model.
    • Supported model providers include OpenAI, Gemini, Amazon Titan, and Sentence Transformers.
    • Your selected embedding model is saved to your user profile when TRACK_USER_USAGE is enabled.
    Local Configuration

    You have two ways to configure the embedding model locally:

    1. With User Tracking (TRACK_USER_USAGE=true):

      • Set TRACK_USER_USAGE to true in your backend .env file.
      • Provide your token tracking database credentials (TOKEN_TRACKER_DB_URI, TOKEN_TRACKER_DB_USERNAME, etc.).
      • Select your desired embedding model from the frontend. Your selection will be saved and automatically used in subsequent sessions.
    2. Without User Tracking (TRACK_USER_USAGE=false):

      • Set TRACK_USER_USAGE to false.
      • Specify the embedding model and provider directly in your backend .env file using EMBEDDING_MODEL and EMBEDDING_PROVIDER.
      • If these variables are not set, the application defaults to a Sentence Transformer model.
      • In this mode, the embedding model cannot be changed from the frontend.

    Getting Started

    Prerequisites

    • Neo4j Database 5.23 or later with APOC installed.
      • Neo4j 5.23 is required because the backend uses the Cypher variable-scope subquery syntax (CALL (variable) { ... }), which is not supported by earlier Neo4j 5.x releases such as 5.20.
      • Neo4j Aura databases (including the free tier) are supported.
      • If using Neo4j Desktop, you will need to deploy the backend and frontend separately (docker-compose is not supported).

    Deployment Options

    Local Deployment

    Using Docker-Compose

    Run the application using the default docker-compose configuration.

    1. Supported LLM Models:
      By default, only OpenAI and Diffbot are enabled. Gemini requires additional GCP configurations.
      Use the VITE_LLM_MODELS_PROD variable to configure the models you need. Example:

      VITE_LLM_MODELS_PROD="gemini_3.8_flash,openai_gpt_6_luna,diffbot,anthropic_claude_5.5_haiku"
      
    2. Anthropic Models: Use the latest Claude model in your config:

      LLM_MODEL_CONFIG_ANTHROPIC_CLAUDE_4_7_OPUS="claude-opus-4-7,anthropic_api_key"
      
    3. Input Sources:
      By default, the following sources are enabled: local, YouTube, Wikipedia, AWS S3, and web.
      To add Google Cloud Storage (GCS) integration, include gcs and your Google client ID:

      VITE_REACT_APP_SOURCES="local,youtube,wiki,s3,gcs,web"
      VITE_GOOGLE_CLIENT_ID="your-google-client-id"
      
    Chat Modes

    Configure chat modes using the VITE_CHAT_MODES variable:

    • By default, all modes are enabled: vector, graph_vector, graph, fulltext, graph_vector_fulltext, entity_vector, and global_vector.
    • To specify specific modes, update the variable. For example:
      VITE_CHAT_MODES="vector,graph"
      

    Running Backend and Frontend Separately

    For development, you can run the backend and frontend independently.

    Frontend Setup
    1. Create a .env file in the frontend folder by copying frontend/example.env.
    2. Update environment variables as needed.
    3. Run:
      cd frontend
      

    yarn yarn run dev

    
    ##### **Backend Setup**
    1. Create a `.env` file in the `backend` folder by copying `backend/example.env`.
    2. Pre-configure user credentials in the `.env` file to bypass the login dialog:
    ```bash
    NEO4J_URI=<your-neo4j-uri>
    NEO4J_USERNAME=<your-username>
    NEO4J_PASSWORD=<your-password>
    NEO4J_DATABASE=<your-database-name>
    
    1. Run:
      cd backend
      

    python -m venv envName source envName/bin/activate pip install -r requirements.txt uvicorn score:app --reload

    
    ---
    
    #### **Cloud Deployment**
    
    Deploy the application on **Google Cloud Platform** using the following commands:
    
    ##### **Frontend Deployment**
    ```bash
    gcloud run deploy dev-frontend \
    --source . \
    --region us-central1 \
    --allow-unauthenticated
    
    Backend Deployment
    gcloud run deploy dev-backend \
      --set-env-vars "OPENAI_API_KEY=<your-openai-api-key>" \
      --set-env-vars "DIFFBOT_API_KEY=<your-diffbot-api-key>" \
      --set-env-vars "NEO4J_URI=<your-neo4j-uri>" \
      --set-env-vars "NEO4J_USERNAME=<your-username>" \
      --set-env-vars "NEO4J_PASSWORD=<your-password>" \
      --source . \
      --region us-central1 \
      --allow-unauthenticated
    

    For local llms (Ollama)

    1. Pull the docker image of ollama
      docker pull ollama/ollama
      
    2. Run the ollama docker image
      docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
      
    3. Execute any llm model, e.g., llama3
      docker exec -it ollama ollama run llama3
      
    4. Configure env variable in docker compose.
      LLM_MODEL_CONFIG_ollama_<model_name>
      # example
      LLM_MODEL_CONFIG_ollama_llama3=${LLM_MODEL_CONFIG_ollama_llama3-llama3,http://host.docker.internal:11434}
      
    5. Configure the backend API url
      VITE_BACKEND_API_URL=${VITE_BACKEND_API_URL-backendurl}
      
    6. Open the application in browser and select the ollama model for the extraction.
    7. Enjoy Graph Building.

    Usage

    1. Connect to a Neo4j Aura Instance, which can be either AURA DS or AURA DB, by passing the URI and password through the backend environment, filling in the login dialog, or dragging and dropping the Neo4j credentials file.
    2. To differentiate, we have added different icons. For AURA DB, there is a database icon, and for AURA DS, there is a scientific molecule icon right under the Neo4j Connection details label.
    3. Choose your source from a list of unstructured sources to create a graph.
    4. Change the LLM (if required) from the dropdown, which will be used to generate the graph.
    5. Optionally, define the schema (nodes and relationship labels) in the entity graph extraction settings.
    6. Either select multiple files to 'Generate Graph', or all the files in 'New' status will be processed for graph creation.
    7. View the graph for individual files using 'View' in the grid, or select one or more files and 'Preview Graph'.
    8. Ask questions related to the processed/completed sources to the chatbot. Also, get detailed information about your answers generated by the LLM.

    ENV

    Env Variable NameMandatory/OptionalDefault ValueDescription
    BACKEND ENV
    OPENAI_API_KEYOptionalAn OpenAI Key is required to use OpenAI LLM model to authenticate and track requests
    DIFFBOT_API_KEYMandatoryAPI key is required to use Diffbot's NLP service to extract entities and relationships from unstructured data
    BUCKET_UPLOAD_FILEOptionalBucket name to store uploaded file on GCS
    BUCKET_FAILED_FILEOptionalBucket name to store failed file on GCS while extraction
    USER_AGENTOptionalllm-graph-builderName of the user agent to track Neo4j database activity
    ENABLE_USER_AGENTOptionaltrueBoolean value to enable/disable Neo4j user agent
    DUPLICATE_TEXT_DISTANCEOptional5This value is used to find distance for all node pairs in the graph and is calculated based on node properties
    DUPLICATE_SCORE_VALUEOptional0.97Node score value to match duplicate nodes
    EFFECTIVE_SEARCH_RATIOOptional1Ratio used for effective search calculations
    GRAPH_CLEANUP_MODELOptionalopenai_gpt_5_miniModel name to clean up graph in post processing
    MAX_TOKEN_CHUNK_SIZEOptional10000Maximum token size to process file content
    YOUTUBE_TRANSCRIPT_PROXYMandatoryProxy key to process YouTube videos for getting transcripts
    IS_EMBEDDINGOptionaltrueFlag to enable text embedding
    KNN_MIN_SCOREOptional0.8Minimum score for KNN algorithm
    GCP_LOG_METRICS_ENABLEDOptionalFalseFlag to enable Google Cloud logs
    NEO4J_URIOptionalneo4j://database:7687URI for Neo4j database
    NEO4J_USERNAMEOptionalneo4jUsername for Neo4j database
    NEO4J_PASSWORDOptionalpasswordPassword for Neo4j database
    GCS_FILE_CACHEOptionalFalseIf set to True, will save files to process into GCS. If False, will save files locally
    ENTITY_EMBEDDINGOptionalFalseIf set to True, it will add embeddings for each entity in the database
    LLM_MODEL_CONFIG_ollama_<model_name>OptionalSet ollama config as model_name,model_local_url for local deployments
    FRONTEND ENV
    VITE_BLOOM_URLMandatoryBloom URLURL for Bloom visualization
    VITE_REACT_APP_SOURCESMandatorylocal,youtube,wiki,s3List of input sources that will be available
    VITE_CHAT_MODESMandatoryvector,graph+vector,graph,hybridChat modes available for Q&A
    VITE_ENVMandatoryDEV or PRODEnvironment variable for the app
    VITE_LLM_MODELSOptionalopenai_gpt_5_mini,gemini_flash_latest,anthropic_claude_4.5_haikuSupported models for the application
    VITE_BACKEND_API_URLOptionallocalhostURL for backend API
    VITE_TIME_PER_PAGEOptional50Time per page for processing
    VITE_CHUNK_SIZEOptional5242880Size of each chunk of file for upload
    VITE_GOOGLE_CLIENT_IDOptionalClient ID for Google authentication
    VITE_LLM_MODELS_PRODOptionalopenai_gpt_5_mini,gemini_flash_latest,anthropic_claude_4.5_haikuTo distinguish models based on environment (PROD or DEV)
    VITE_AUTH0_CLIENT_IDMandatory if you are enabling Authentication otherwise it is optionalOkta OAuth Client ID for authentication
    VITE_AUTH0_DOMAINMandatory if you are enabling Authentication otherwise it is optionalOkta OAuth Client Domain
    VITE_SKIP_AUTHOptionaltrueFlag to skip authentication
    VITE_CHUNK_OVERLAPOptional20Variable to configure chunk overlap
    VITE_TOKENS_PER_CHUNKOptional100Variable to configure tokens count per chunk. This gives flexibility for users who may require different chunk sizes for various tokenization tasks
    VITE_CHUNK_TO_COMBINEOptional1Variable to configure number of chunks to combine for parallel processing

    Example Environment Files

    Refer to the example environment files for additional variables and configuration:


    Cloud Build Deployment

    You can deploy the backend and the frontend to Google Cloud Run using Cloud Build, either manually or via automated triggers.

    Automated Deployment (Recommended)

    1. Connect your repository to Google Cloud Build:

      • In the Google Cloud Console, go to Cloud Build > Triggers.
      • Create a new trigger and select your repository.
      • Set the trigger to run on push to your desired branch (main, staging, or dev).
      • Cloud Build will automatically use the cloudbuild.yaml file in the root of your repository.
    2. Configure Substitutions and Secrets:

      • In the trigger settings, add required substitutions (e.g., _OPENAI_API_KEY, _DIFFBOT_API_KEY, etc.) as environment variables or use Secret Manager for sensitive data.
    3. Push your code:

      • When you push to the configured branch, Cloud Build will build and deploy your backend (and optionally frontend) to Cloud Run using the steps defined in cloudbuild.yaml.

    Manual Deployment

    1. Set up Google Cloud SDK and authenticate:

      gcloud auth login
      gcloud config set project <YOUR_PROJECT_ID>
      
    2. Run Cloud Build manually:

      gcloud builds submit --config cloudbuild.yaml \
        --substitutions=_REGION=us-central1,_REPO=cloud-run-repo,_OPENAI_API_KEY=<your-openai-key>,_DIFFBOT_API_KEY=<your-diffbot-key>,_BUCKET_UPLOAD_FILE=<your-bucket>,_BUCKET_FAILED_FILE=<your-bucket>,_PROJECT_ID=<your-project-id>,_GCS_FILE_CACHE=False,_TRACK_USER_USAGE=False,_TOKEN_TRACKER_DB_URI=...,_TOKEN_TRACKER_DB_USERNAME=...,_TOKEN_TRACKER_DB_PASSWORD=...,_TOKEN_TRACKER_DB_DATABASE=...,_DEFAULT_DIFFBOT_CHAT_MODEL=...,_YOUTUBE_TRANSCRIPT_PROXY=...,_EMBEDDING_MODEL=...,
          _EMBEDDING_PROVIDER=...,_BEDROCK_EMBEDDING_MODEL_KEY=...,_LLM_MODEL_CONFIG_OPENAI_GPT_5_2=...,_LLM_MODEL_CONFIG_OPENAI_GPT_5_MINI=...,_LLM_MODEL_CONFIG_GEMINI_2_5_FLASH=...,_LLM_MODEL_CONFIG_GEMINI_2_5_PRO=...,_LLM_MODEL_CONFIG_DIFFBOT=...,_LLM_MODEL_CONFIG_GROQ_LLAMA3_1_8B=...,_LLM_MODEL_CONFIG_ANTHROPIC_CLAUDE_4_5_SONNET=...,_LLM_MODEL_CONFIG_ANTHROPIC_CLAUDE_4_5_HAIKU=...,_LLM_MODEL_CONFIG_LLAMA4_MAVERICK=...,_LLM_MODEL_CONFIG_FIREWORKS_QWEN3_6=...,_LLM_MODEL_CONFIG_FIREWORKS_GPT_OSS=...,_LLM_MODEL_CONFIG_FIREWORKS_DEEPSEEK_V3=...,_LLM_MODEL_CONFIG_BEDROCK_NOVA_MICRO_V1=...,_LLM_MODEL_CONFIG_BEDROCK_NOVA_LITE_V1=...,_LLM_MODEL_CONFIG_BEDROCK_NOVA_PRO_V1=...,_LLM_MODEL_CONFIG_OLLAMA_LLAMA3=...
      
      • Replace the values in angle brackets with your actual configuration and secrets.
      • LLM_MODEL_CONFIG_FIREWORKS_QWEN3_6 is the app-facing config key for the fireworks_qwen3_6 model option and should map to the Fireworks serverless slug accounts/fireworks/models/qwen3p6-plus.
      • You can omit or add substitutions as needed for your deployment.
    3. Monitor the build:

      • The build and deployment process will be visible in the Cloud Build console.
    4. Access your deployed service:

      • After deployment, your backend will be available at the Cloud Run service URL shown in the Cloud Console.

    Note:

    • The cloudbuild.yaml file supports multiple environments (main, staging, dev) based on the branch name.
    • The frontend build and deployment steps are commented out by default. Uncomment them in cloudbuild.yaml if you wish to deploy the frontend as well.

    For more details, see the comments in cloudbuild.yaml.


    Links

    LLM Knowledge Graph Builder Application

    Neo4j Workspace

    Reference

    Demo of application

    Contact

    For any inquiries or support, feel free to raise GitHub Issues

    Happy Graph Building!