Graph Connectivity Awareness: - Add db_degree property to all KG implementations (NetworkX, Postgres, Neo4j, Mongo, Memgraph) - Show database degree vs visual degree in node panel with amber badge - Add visual indicator (amber border) for nodes with hidden connections - Add "Load X hidden connection(s)" button to expand hidden neighbors - Add configurable "Expand Depth" setting (1-5) in graph settings - Use global maxNodes setting for node expansion consistency Orphan Connection UI: - Add OrphanConnectionDialog component for manual orphan entity connection - Add OrphanConnectionControl button in graph sidebar - Expose /graph/orphans/connect API endpoint for frontend use Backend Improvements: - Add get_orphan_entities() and connect_orphan_entities() to base storage - Add orphan connection configuration parameters - Improve entity extraction with relationship density requirements Frontend: - Add graphExpandDepth and graphIncludeOrphans to settings store - Add min_degree and include_orphans graph filtering parameters - Update translations (en.json, zh.json)
139 lines
4.5 KiB
YAML
139 lines
4.5 KiB
YAML
name: lightrag-entity-resolution-test
|
|
|
|
services:
|
|
postgres:
|
|
container_name: lightrag-postgres
|
|
build:
|
|
context: ./docker/postgres-age-vector
|
|
dockerfile: Dockerfile
|
|
environment:
|
|
POSTGRES_DB: lightrag
|
|
POSTGRES_USER: lightrag
|
|
POSTGRES_PASSWORD: lightrag_pass
|
|
ports:
|
|
- "5433:5432" # Use 5433 to avoid conflict with agent-sdk postgres
|
|
volumes:
|
|
- pgdata_test:/var/lib/postgresql/data
|
|
command: |
|
|
postgres
|
|
-c shared_preload_libraries='vector,age'
|
|
-c max_connections=150
|
|
-c shared_buffers=768MB
|
|
-c work_mem=32MB
|
|
-c checkpoint_completion_target=0.9
|
|
-c effective_cache_size=2GB
|
|
-c maintenance_work_mem=192MB
|
|
-c wal_compression=on
|
|
-c checkpoint_timeout=10min
|
|
-c max_wal_size=1GB
|
|
-c random_page_cost=1.1
|
|
-c effective_io_concurrency=200
|
|
-c max_worker_processes=12
|
|
-c max_parallel_workers_per_gather=4
|
|
-c max_parallel_workers=8
|
|
-c max_parallel_maintenance_workers=4
|
|
-c jit_above_cost=50000
|
|
-c jit_inline_above_cost=250000
|
|
-c jit_optimize_above_cost=250000
|
|
-c default_statistics_target=200
|
|
-c hash_mem_multiplier=4
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U lightrag -d lightrag"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
mem_limit: 2g
|
|
|
|
lightrag:
|
|
container_name: lightrag-test
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
ports:
|
|
- "9622:9621" # Use 9622 to avoid conflict
|
|
volumes:
|
|
- ./data/rag_storage_test:/app/data/rag_storage
|
|
- ./data/inputs_test:/app/data/inputs
|
|
environment:
|
|
# Server
|
|
- HOST=0.0.0.0
|
|
- PORT=9621
|
|
- LOG_LEVEL=DEBUG
|
|
|
|
# LLM (OpenAI)
|
|
- LLM_BINDING=openai
|
|
- LLM_MODEL=gpt-4o-mini
|
|
- LLM_BINDING_HOST=https://api.openai.com/v1
|
|
- LLM_BINDING_API_KEY=${OPENAI_API_KEY}
|
|
|
|
# Embedding
|
|
- EMBEDDING_BINDING=openai
|
|
- EMBEDDING_MODEL=text-embedding-3-small
|
|
- EMBEDDING_DIM=1536
|
|
- EMBEDDING_BINDING_HOST=https://api.openai.com/v1
|
|
- EMBEDDING_BINDING_API_KEY=${OPENAI_API_KEY}
|
|
|
|
# Storage Configuration - Full PostgreSQL!
|
|
# Custom postgres image has pgvector + Apache AGE
|
|
- LIGHTRAG_KV_STORAGE=PGKVStorage
|
|
- LIGHTRAG_VECTOR_STORAGE=PGVectorStorage
|
|
- LIGHTRAG_GRAPH_STORAGE=PGGraphStorage
|
|
- LIGHTRAG_DOC_STATUS_STORAGE=PGDocStatusStorage
|
|
- POSTGRES_HOST=postgres
|
|
- POSTGRES_PORT=5432
|
|
- POSTGRES_USER=lightrag
|
|
- POSTGRES_PASSWORD=lightrag_pass
|
|
- POSTGRES_DATABASE=lightrag
|
|
|
|
# Entity Resolution - ENABLED!
|
|
- ENTITY_RESOLUTION_ENABLED=true
|
|
- ENTITY_RESOLUTION_FUZZY_THRESHOLD=0.85
|
|
- ENTITY_RESOLUTION_VECTOR_THRESHOLD=0.5
|
|
- ENTITY_RESOLUTION_MAX_CANDIDATES=3
|
|
|
|
# Orphan Connection - MANUAL (use UI button instead of auto)
|
|
- AUTO_CONNECT_ORPHANS=false
|
|
|
|
# Processing - Aggressive settings from agent-sdk
|
|
- MAX_ASYNC=96
|
|
- MAX_PARALLEL_INSERT=10
|
|
- EMBEDDING_FUNC_MAX_ASYNC=16
|
|
- EMBEDDING_BATCH_NUM=48
|
|
|
|
# Gunicorn - 8 workers x 4 threads = 32 concurrent handlers
|
|
- GUNICORN_CMD_ARGS=--workers=8 --worker-class=gthread --threads=4 --worker-connections=1000 --timeout=120 --keep-alive=5 --graceful-timeout=30
|
|
|
|
# Extraction Optimization - Reduce Orphan Nodes
|
|
- CHUNK_SIZE=800 # Smaller chunks for focused extraction
|
|
- CHUNK_OVERLAP_SIZE=400 # 50% overlap captures cross-boundary relationships
|
|
- MAX_GLEANING=1 # Enable gleaning refinement pass
|
|
- FORCE_LLM_SUMMARY_ON_MERGE=4 # More aggressive entity consolidation
|
|
|
|
# Orphan Connection - Use UI button for manual triggering
|
|
# AUTO_CONNECT_ORPHANS is set to false above (manual mode)
|
|
- ORPHAN_CONNECTION_THRESHOLD=0.3 # Vector similarity pre-filter threshold
|
|
- ORPHAN_CONFIDENCE_THRESHOLD=0.7 # LLM confidence required for connection
|
|
- ORPHAN_CROSS_CONNECT=true # Allow orphan-to-orphan connections
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
entrypoint: []
|
|
command:
|
|
- python
|
|
- /app/lightrag/api/run_with_gunicorn.py
|
|
- --workers
|
|
- "8"
|
|
- --llm-binding
|
|
- openai
|
|
- --embedding-binding
|
|
- openai
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -f http://localhost:9621/health || exit 1"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
start_period: 60s
|
|
mem_limit: 2g
|
|
|
|
volumes:
|
|
pgdata_test:
|