Commit graph

191 commits

Author SHA1 Message Date
yangdx
94ae13a037 Refactor workspace handling to use default workspace and namespace locks
- Remove DB-specific workspace configs
- Add default workspace auto-setting
- Replace global locks with namespace locks
- Simplify pipeline status management
- Remove redundant graph DB locking

(cherry picked from commit 926960e957)
2025-12-04 19:11:17 +08:00
wmsnp
3954bb6579 feat(postgres_impl): add vchordrq vector index support and unify vector index creation logic
(cherry picked from commit d07023c962)
2025-12-04 19:09:06 +08:00
yangdx
3780addc4c Fix logging message formatting
(cherry picked from commit e0fd31a60d)
2025-12-04 19:09:00 +08:00
yangdx
58f818c449 Change default docker image to offline version
• Add lite verion docker image with tiktoken cache
• Update docs and build scripts

(cherry picked from commit daeca17f38)
2025-12-04 19:08:59 +08:00
yangdx
8f924d6f21 Add PostgreSQL connection retry configuration options
- Add retry environment variables
- Fix asyncpg import in retry tests

(cherry picked from commit bd535e3e7a)
2025-12-04 19:08:57 +08:00
kevinnkansah
c8c73ab114 fix: renamed PostGreSQL options env variable and allowed LRU cache to be an optional env variable
(cherry picked from commit 22a7b482c5)
2025-12-04 19:08:56 +08:00
kevinnkansah
7ce46bacb6 feat: add options for PostGres connection
(cherry picked from commit 108cdbe133)
2025-12-04 19:08:56 +08:00
yangdx
ad6b36143e Update .env loading and add API authentication to RAG evaluator
• Load .env from current directory
• Support LIGHTRAG_API_KEY auth header
• Override=False for env precedence
• Add Bearer token to API requests
• Enable per-instance .env configs

(cherry picked from commit 72db042667)
2025-12-04 19:08:56 +08:00
yangdx
6de4bb9113 Fix logging message formatting
(cherry picked from commit e0fd31a60d)
2025-12-04 19:08:46 +08:00
yangdx
89f32c4c49 Add PostgreSQL connection retry configuration options
- Add retry environment variables
- Fix asyncpg import in retry tests

(cherry picked from commit bd535e3e7a)
2025-12-04 19:06:25 +08:00
kevinnkansah
8f5af8199b fix: renamed PostGreSQL options env variable and allowed LRU cache to be an optional env variable
(cherry picked from commit 22a7b482c5)
2025-12-04 19:05:24 +08:00
kevinnkansah
85a4f0e68e feat: add options for PostGres connection
(cherry picked from commit 108cdbe133)
2025-12-04 19:05:14 +08:00
yangdx
dec282694c Update .env loading and add API authentication to RAG evaluator
• Load .env from current directory
• Support LIGHTRAG_API_KEY auth header
• Override=False for env precedence
• Add Bearer token to API requests
• Enable per-instance .env configs

(cherry picked from commit 72db042667)
2025-12-04 19:04:25 +08:00
Raphael MANSUY
fe9b8ec02a
tests: stabilize integration tests + skip external services; fix multi-tenant API behavior and idempotency (#4)
* feat: Implement multi-tenant architecture with tenant and knowledge base models

- Added data models for tenants, knowledge bases, and related configurations.
- Introduced role and permission management for users in the multi-tenant system.
- Created a service layer for managing tenants and knowledge bases, including CRUD operations.
- Developed a tenant-aware instance manager for LightRAG with caching and isolation features.
- Added a migration script to transition existing workspace-based deployments to the new multi-tenant architecture.

* chore: ignore lightrag/api/webui/assets/ directory

* chore: stop tracking lightrag/api/webui/assets (ignore in .gitignore)

* feat: Initialize LightRAG Multi-Tenant Stack with PostgreSQL

- Added README.md for project overview, setup instructions, and architecture details.
- Created docker-compose.yml to define services: PostgreSQL, Redis, LightRAG API, and Web UI.
- Introduced env.example for environment variable configuration.
- Implemented init-postgres.sql for PostgreSQL schema initialization with multi-tenant support.
- Added reproduce_issue.py for testing default tenant access via API.

* feat: Enhance TenantSelector and update related components for improved multi-tenant support

* feat: Enhance testing capabilities and update documentation

- Updated Makefile to include new test commands for various modes (compatibility, isolation, multi-tenant, security, coverage, and dry-run).
- Modified API health check endpoint in Makefile to reflect new port configuration.
- Updated QUICK_START.md and README.md to reflect changes in service URLs and ports.
- Added environment variables for testing modes in env.example.
- Introduced run_all_tests.sh script to automate testing across different modes.
- Created conftest.py for pytest configuration, including database fixtures and mock services.
- Implemented database helper functions for streamlined database operations in tests.
- Added test collection hooks to skip tests based on the current MULTITENANT_MODE.

* feat: Implement multi-tenant support with demo mode enabled by default

- Added multi-tenant configuration to the environment and Docker setup.
- Created pre-configured demo tenants (acme-corp and techstart) for testing.
- Updated API endpoints to support tenant-specific data access.
- Enhanced Makefile commands for better service management and database operations.
- Introduced user-tenant membership system with role-based access control.
- Added comprehensive documentation for multi-tenant setup and usage.
- Fixed issues with document visibility in multi-tenant environments.
- Implemented necessary database migrations for user memberships and legacy support.

* feat(audit): Add final audit report for multi-tenant implementation

- Documented overall assessment, architecture overview, test results, security findings, and recommendations.
- Included detailed findings on critical security issues and architectural concerns.

fix(security): Implement security fixes based on audit findings

- Removed global RAG fallback and enforced strict tenant context.
- Configured super-admin access and required user authentication for tenant access.
- Cleared localStorage on logout and improved error handling in WebUI.

chore(logs): Create task logs for audit and security fixes implementation

- Documented actions, decisions, and next steps for both audit and security fixes.
- Summarized test results and remaining recommendations.

chore(scripts): Enhance development stack management scripts

- Added scripts for cleaning, starting, and stopping the development stack.
- Improved output messages and ensured graceful shutdown of services.

feat(starter): Initialize PostgreSQL with AGE extension support

- Created initialization scripts for PostgreSQL extensions including uuid-ossp, vector, and AGE.
- Ensured successful installation and verification of extensions.

* feat: Implement auto-select for first tenant and KB on initial load in WebUI

- Removed WEBUI_INITIAL_STATE_FIX.md as the issue is resolved.
- Added useTenantInitialization hook to automatically select the first available tenant and KB on app load.
- Integrated the new hook into the Root component of the WebUI.
- Updated RetrievalTesting component to ensure a KB is selected before allowing user interaction.
- Created end-to-end tests for multi-tenant isolation and real service interactions.
- Added scripts for starting, stopping, and cleaning the development stack.
- Enhanced API and tenant routes to support tenant-specific pipeline status initialization.
- Updated constants for backend URL to reflect the correct port.
- Improved error handling and logging in various components.

* feat: Add multi-tenant support with enhanced E2E testing scripts and client functionality

* update client

* Add integration and unit tests for multi-tenant API, models, security, and storage

- Implement integration tests for tenant and knowledge base management endpoints in `test_tenant_api_routes.py`.
- Create unit tests for tenant isolation, model validation, and role permissions in `test_tenant_models.py`.
- Add security tests to enforce role-based permissions and context validation in `test_tenant_security.py`.
- Develop tests for tenant-aware storage operations and context isolation in `test_tenant_storage_phase3.py`.

* feat(e2e): Implement OpenAI model support and database reset functionality

* Add comprehensive test suite for gpt-5-nano compatibility

- Introduced tests for parameter normalization, embeddings, and entity extraction.
- Implemented direct API testing for gpt-5-nano.
- Validated .env configuration loading and OpenAI API connectivity.
- Analyzed reasoning token overhead with various token limits.
- Documented test procedures and expected outcomes in README files.
- Ensured all tests pass for production readiness.

* kg(postgres_impl): ensure AGE extension is loaded in session and configure graph initialization

* dev: add hybrid dev helper scripts, Makefile, docker-compose.dev-db and local development docs

* feat(dev): add dev helper scripts and local development documentation for hybrid setup

* feat(multi-tenant): add detailed specifications and logs for multi-tenant improvements, including UX, backend handling, and ingestion pipeline

* feat(migration): add generated tenant/kb columns, indexes, triggers; drop unused tables; update schema and docs

* test(backward-compat): adapt tests to new StorageNameSpace/TenantService APIs (use concrete dummy storages)

* chore: multi-tenant and UX updates — docs, webui, storage, tenant service adjustments

* tests: stabilize integration tests + skip external services; fix multi-tenant API behavior and idempotency

- gpt5_nano_compatibility: add pytest-asyncio markers, skip when OPENAI key missing, prevent module-level asyncio.run collection, add conftest
- Ollama tests: add server availability check and skip markers; avoid pytest collection warnings by renaming helper classes
- Graph storage tests: rename interactive test functions to avoid pytest collection
- Document & Tenant routes: support external_ids for idempotency; ensure HTTPExceptions are re-raised
- LightRAG core: support external_ids in apipeline_enqueue_documents and idempotent logic
- Tests updated to match API changes (tenant routes & document routes)
- Add logs and scripts for inspection and audit
2025-12-04 16:04:21 +08:00
yangdx
9dd1790b5c Add "Creature" entity type and reorganize type mappings
- Add Creature to default entity types
- Map animals/beings to creature type
2025-09-23 21:58:33 +08:00
yangdx
55176a24b4 Update env.example 2025-09-22 17:49:22 +08:00
yangdx
e14cee69a3 Fix Neo4j typo and add fulltext search with performance optimizations
- Fix NEO4J_DATABASE typo in env.example
- Add fulltext index for entity searches
- Implement get_popular_labels method
- Add search_labels with fuzzy matching
- Simplify B-Tree index creation logic
2025-09-20 12:37:13 +08:00
yangdx
e644a3e02f Adjust OpenAI temperature default and add mitigation guidance 2025-09-17 02:56:05 +08:00
yangdx
4a97e9f469 Update env.example 2025-09-17 02:31:41 +08:00
yangdx
3b18c33770 Update env.example 2025-09-15 05:02:45 +08:00
Daniel.y
ad0a533d21
Merge pull request #2100 from danielaskdd/return-data-only
Feature: Add /query/data API Endpoint for Raw Retrieval Data
2025-09-15 04:07:21 +08:00
yangdx
5311083f43 Rename "Process" entity type to "Method" across all components 2025-09-14 02:30:05 +08:00
yangdx
7060cf17f0 Add Process and Data entity types to LLM extraction system
• Add Process and Data to default types
• Update env.example configuration
• Add translations for new entities
• Support 5 languages (en/zh/fr/ar/tw)
2025-09-14 01:14:47 +08:00
yangdx
2686fc526e Change entity type from CreativeWork to Content and update delimiter
• Replace CreativeWork with Content type
• Improve LLM output error messages
• Update prompt for binary relationships
• Fix delimiter corruption examples
2025-09-14 00:55:15 +08:00
yangdx
41cdeaeaad Add Concept and NaturalObject to default entity types 2025-09-13 15:37:11 +08:00
yangdx
f7aa108cc2 Update env.example 2025-09-13 11:27:02 +08:00
Francois van Schalkwyk
7075b3bec6
Update env.example
Fixed spelling typo.
2025-09-11 14:24:19 +01:00
yangdx
87f1b47218 Update env.examples 2025-09-11 15:50:16 +08:00
yangdx
4a21b7f53f Update OpenAI API config docs for max_tokens and max_completion_tokens
• Clarify max_tokens vs max_completion_tokens
• Add Gemini exception note
• Update parameter descriptions
• Add new completion tokens option
2025-09-10 16:23:10 +08:00
Daniel.y
298037d8f7
Merge pull request #2076 from danielaskdd/prompt-refactor
refactor: Optimize Entity Extraction for Small Parameter LLMs with Enhanced Prompt Caching
2025-09-08 15:40:13 +08:00
yangdx
d218f15a62 Refactor entity extraction with system prompts and output limits
- Add system/user prompt separation
- Set max tokens for endless output fix
- Improve extraction error logging
- Update cache type from extract to summary
2025-09-08 15:20:45 +08:00
Shlomi
8d7ef07bbf
fix env file example 2025-09-07 15:22:24 +03:00
yangdx
64bbe7233b Update env.example 2025-09-06 01:24:12 +08:00
yangdx
2db7e4a3e8 Update env.example 2025-09-05 17:13:29 +08:00
yangdx
c903b14849 Bump AIP version to 0214 and update env.example 2025-09-04 12:04:50 +08:00
yangdx
78abb397bf Reorder entity types and add Document type to extraction 2025-09-03 12:44:40 +08:00
yangdx
c86f863fa4 feat: optimize entity extraction for smaller LLMs
Simplify entity relationship extraction process to improve compatibility
and performance with smaller, less capable language models.

Changes:
- Remove iterative gleaning loop with LLM-based continuation decisions
- Simplify to single gleaning pass when entity_extract_max_gleaning > 0
- Streamline entity extraction prompts with clearer instructions
- Add explicit completion delimiter signals in all examples
2025-09-03 10:33:01 +08:00
yangdx
9d81cd724a Fix typo: change "Equiment" to "Equipment" in entity types 2025-09-02 03:19:31 +08:00
yangdx
c8c59c38b0 Fix entity types configuration to support JSON list parsing
- Add JSON parsing for list env vars
- Update entity types example format
- Add list type support to get_env_value
2025-09-01 00:14:57 +08:00
yangdx
57fe1403c3 Update default entity types in env.example configuration 2025-08-31 22:33:34 +08:00
yangdx
d9aa021682 Update env.example 2025-08-30 11:02:53 +08:00
Pedro Fernandes Steimbruch
8430e1a051 fix: adjust the EMBEDDING_BINDING_HOST for openai in the env.example 2025-08-29 09:48:42 -03:00
yangdx
d39afcb831 Add temperature guidance for Qwen3 models in env example 2025-08-29 15:13:52 +08:00
yangdx
925e631a9a refac: Add robust time out handling for LLM request 2025-08-29 13:50:35 +08:00
yangdx
ac2db35160 Update env.example 2025-08-29 10:18:12 +08:00
Sandmeyer
1cd27dc048
docs(config): fix typo in .env comments 2025-08-28 20:23:51 +08:00
yangdx
0be4f0144b Merge branch 'entityTypesServerSupport' 2025-08-27 12:23:58 +08:00
yangdx
ff0a18e08c Unify SUMMARY_LANGUANGE and ENTITY_TYPES implementation method 2025-08-27 12:23:22 +08:00
yangdx
cb0a035076 Update env.example 2025-08-27 11:12:52 +08:00
Thibo Rosemplatt
c3aabfc251 Merge branch 'main' into entityTypesServerSupport 2025-08-26 21:48:20 +02:00