Commit graph

1205 commits

Author SHA1 Message Date
Raphaël MANSUY
e4f14b2907 cherry-pick 289337b2 2025-12-04 19:17:42 +08:00
Raphaël MANSUY
bf1a8cf8ba cherry-pick dde728a3 2025-12-04 19:17:42 +08:00
Raphaël MANSUY
f9f4555b48 cherry-pick ef659a1e 2025-12-04 19:15:05 +08:00
Raphaël MANSUY
196033bf75 cherry-pick 87de2b3e 2025-12-04 19:15:05 +08:00
Raphaël MANSUY
57c1330b54 cherry-pick 3efb1716 2025-12-04 19:15:05 +08:00
Raphaël MANSUY
a3fb244631 cherry-pick 2b160163 2025-12-04 19:15:05 +08:00
Raphaël MANSUY
2a247bdda1 cherry-pick 0244699d 2025-12-04 19:15:04 +08:00
Raphaël MANSUY
4501740849 cherry-pick fa887d81 2025-12-04 19:15:04 +08:00
Raphaël MANSUY
7e53eaabee cherry-pick e7d2803a 2025-12-04 19:15:04 +08:00
Raphaël MANSUY
cfc9348de6 cherry-pick 95cd0ece 2025-12-04 19:15:04 +08:00
Raphaël MANSUY
5a9677396b cherry-pick 4438ba41 2025-12-04 19:15:04 +08:00
Raphaël MANSUY
d3d59b0dca cherry-pick 186c8f0e 2025-12-04 19:15:04 +08:00
Raphaël MANSUY
aff704e58a cherry-pick c434879c 2025-12-04 19:15:03 +08:00
Raphaël MANSUY
a4d6692e2d cherry-pick 61b57cbb 2025-12-04 19:15:03 +08:00
Raphaël MANSUY
fce5dc6be6 cherry-pick c46c1b26 2025-12-04 19:15:03 +08:00
Raphaël MANSUY
fae72fab75 cherry-pick 754d2ad2 2025-12-04 19:14:31 +08:00
Raphaël MANSUY
96f23d59af cherry-pick fc40a369 2025-12-04 19:14:30 +08:00
Raphaël MANSUY
7fa3cab355 cherry-pick 162370b6 2025-12-04 19:14:29 +08:00
Raphaël MANSUY
af3b2cf118 cherry-pick 0b3d3150 2025-12-04 19:14:29 +08:00
Raphaël MANSUY
84ac688666 cherry-pick 83d99e14 2025-12-04 19:14:29 +08:00
Raphaël MANSUY
250640e8a5 cherry-pick ea8d55ab 2025-12-04 19:14:28 +08:00
Raphaël MANSUY
086191ae5a cherry-pick 56e0365c 2025-12-04 19:14:28 +08:00
Raphaël MANSUY
49b0953ac1 cherry-pick 4ab4a7ac 2025-12-04 19:14:28 +08:00
Raphaël MANSUY
d2ffd7794d cherry-pick e5addf4d 2025-12-04 19:14:27 +08:00
Raphaël MANSUY
759980e522 cherry-pick ab4d7ac2 2025-12-04 19:14:27 +08:00
Raphaël MANSUY
778e6d57c4 cherry-pick 6b2af2b5 2025-12-04 19:14:27 +08:00
Raphaël MANSUY
7f5afd0a4d cherry-pick 5dec4dea 2025-12-04 19:14:27 +08:00
Raphaël MANSUY
c83a76786a cherry-pick 14a6c24e 2025-12-04 19:14:27 +08:00
Raphaël MANSUY
da7683a001 cherry-pick de4ed736 2025-12-04 19:14:26 +08:00
Raphaël MANSUY
395b76cdc9 cherry-pick a624a950 2025-12-04 19:14:26 +08:00
Raphaël MANSUY
f389b0d63a cherry-pick 0b2a15c4 2025-12-04 19:14:26 +08:00
Raphaël MANSUY
3c8507358c cherry-pick 03cc6262 2025-12-04 19:14:26 +08:00
Raphaël MANSUY
0166a38d01 cherry-pick ce28f30c 2025-12-04 19:14:26 +08:00
Raphaël MANSUY
cacea8ab56 cherry-pick 33a1482f 2025-12-04 19:14:26 +08:00
yangdx
d0e3c8a4a3 Fix duplicate document responses to return original track_id
- Return existing track_id for duplicates
- Remove track_id generation in reprocess
- Update reprocess response documentation
- Clarify track_id behavior in comments
- Update API response examples

(cherry picked from commit 8d28b95966)
2025-12-04 19:11:24 +08:00
yangdx
21fc61ecd2 Add content deduplication check for document insertion endpoints
• Check content hash before insertion
• Return duplicated status if exists
• Use sanitized text for hash computation
• Apply to both single and batch inserts
• Prevent duplicate content processing

(cherry picked from commit 19c16bc464)
2025-12-04 19:11:23 +08:00
netbrah
b65ef37569 Add Cohere reranker config, chunking, and tests
(cherry picked from commit a05bbf105e)
2025-12-04 19:11:22 +08:00
anouarbm
7ce251c319 docs: Add documentation and examples for include_chunk_content parameter
Added comprehensive documentation for the new include_chunk_content parameter
that enables retrieval of actual chunk text content in API responses.

Documentation Updates:
- Added "Include Chunk Content in References" section to API README
- Explained use cases: RAG evaluation, debugging, citations, transparency
- Provided JSON request/response examples
- Clarified parameter interaction with include_references

OpenAPI/Swagger Examples:
- Added "Response with chunk content" example to /query endpoint
- Shows complete reference structure with content field
- Demonstrates realistic chunk text content

This makes the feature discoverable through:
1. API documentation (README.md)
2. Interactive Swagger UI (http://localhost:9621/docs)
3. Code examples for developers

(cherry picked from commit 963ad4c637)
2025-12-04 19:11:20 +08:00
anouarbm
349c1945db Optimize RAGAS evaluation with parallel execution and chunk content enrichment
Added efficient RAG evaluation system with optimized API calls and comprehensive benchmarking.

Key Features:
- Single API call per evaluation (2x faster than before)
- Parallel evaluation based on MAX_ASYNC environment variable
- Chunk content enrichment in /query endpoint responses
- Comprehensive benchmark statistics (moyennes)
- NaN-safe metric calculations

API Changes:
- Added include_chunk_content parameter to QueryRequest (backward compatible)
- /query endpoint enriches references with actual chunk content when requested
- No breaking changes - default behavior unchanged

Evaluation Improvements:
- Parallel execution using asyncio.Semaphore (respects MAX_ASYNC)
- Shared HTTP client with connection pooling
- Proper timeout handling (3min connect, 5min read)
- Debug output for context retrieval verification
- Benchmark statistics with averages, min/max scores

Results:
- Moyenne RAGAS Score: 0.9772
- Perfect Faithfulness: 1.0000
- Perfect Context Recall: 1.0000
- Perfect Context Precision: 1.0000
- Excellent Answer Relevance: 0.9087

(cherry picked from commit 0bbef9814e)
2025-12-04 19:11:20 +08:00
yangdx
5febb88824 Fix missing workspace parameter in update flags status call
(cherry picked from commit 1745b30a5f)
2025-12-04 19:11:18 +08:00
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
yangdx
dfab175c16 Fix workspace isolation for pipeline status across all operations
- Fix final_namespace error in get_namespace_data()
- Fix get_workspace_from_request return type
- Add workspace param to pipeline status calls

(cherry picked from commit 52c812b9a0)
2025-12-04 19:11:16 +08:00
BukeLy
fe1576943f fix: Add default workspace support for backward compatibility
Fixes two compatibility issues in workspace isolation:

1. Problem: lightrag_server.py calls initialize_pipeline_status()
   without workspace parameter, causing pipeline to initialize in
   global namespace instead of rag's workspace.

   Solution: Add set_default_workspace() mechanism in shared_storage.
   LightRAG.initialize_storages() now sets default workspace, which
   initialize_pipeline_status() uses when called without parameters.

2. Problem: /health endpoint hardcoded to use "pipeline_status",
   cannot return workspace-specific status or support frontend
   workspace selection.

   Solution: Add LIGHTRAG-WORKSPACE header support. Endpoint now
   extracts workspace from header or falls back to server default,
   returning correct workspace-specific pipeline status.

Changes:
- lightrag/kg/shared_storage.py: Add set/get_default_workspace()
- lightrag/lightrag.py: Call set_default_workspace() in initialize_storages()
- lightrag/api/lightrag_server.py: Add get_workspace_from_request() helper,
  update /health endpoint to support LIGHTRAG-WORKSPACE header

Testing:
- Backward compatibility: Old code works without modification
- Multi-instance safety: Explicit workspace passing preserved
- /health endpoint: Supports both default and header-specified workspaces

Related: #2353
(cherry picked from commit 18a4870229)
2025-12-04 19:11:16 +08:00
BukeLy
f7b500bca2 feat: Add workspace isolation support for pipeline status
Problem:
In multi-tenant scenarios, different workspaces share a single global
pipeline_status namespace, causing pipelines from different tenants to
block each other, severely impacting concurrent processing performance.

Solution:
- Extended get_namespace_data() to recognize workspace-specific pipeline
  namespaces with pattern "{workspace}:pipeline" (following GraphDB pattern)
- Added workspace parameter to initialize_pipeline_status() for per-tenant
  isolated pipeline namespaces
- Updated all 7 call sites to use workspace-aware locks:
  * lightrag.py: process_document_queue(), aremove_document()
  * document_routes.py: background_delete_documents(), clear_documents(),
    cancel_pipeline(), get_pipeline_status(), delete_documents()

Impact:
- Different workspaces can process documents concurrently without blocking
- Backward compatible: empty workspace defaults to "pipeline_status"
- Maintains fail-fast: uninitialized pipeline raises clear error
- Expected N× performance improvement for N concurrent tenants

Bug fixes:
- Fixed AttributeError by using self.workspace instead of self.global_config
- Fixed pipeline status endpoint to show workspace-specific status
- Fixed delete endpoint to check workspace-specific busy flag

Code changes: 4 files, 141 insertions(+), 28 deletions(-)

Testing: All syntax checks passed, comprehensive workspace isolation tests completed
(cherry picked from commit eb52ec94d7)
2025-12-04 19:11:16 +08:00
yangdx
322ff19f72 Remove ascii_colors dependency and fix stream handling errors
• Remove ascii_colors.trace_exception calls
• Add SafeStreamHandler for closed streams
• Patch ascii_colors console handler
• Prevent ValueError on stream close
• Improve logging error handling

(cherry picked from commit 0fb2925c6a)
2025-12-04 19:11:13 +08:00
yangdx
9cf7476dd4 Improve docling integration with macOS compatibility and CLI flag
- Add --docling CLI flag for easier setup
- Add numpy version constraints
- Exclude docling on macOS (fork-safety)

(cherry picked from commit c246eff725)
2025-12-04 19:11:10 +08:00
yangdx
95d47566c1 Improve docling integration with macOS compatibility and CLI flag
- Add --docling CLI flag for easier setup
- Add numpy version constraints
- Exclude docling on macOS (fork-safety)

(cherry picked from commit a24d8181c2)
2025-12-04 19:11:10 +08:00
xiaojunxiang
355aa2593c fix(docs): correct typo "acivate" → "activate"
(cherry picked from commit 9e5004e24f)
2025-12-04 19:11:08 +08:00
yangdx
ed46d375fb Auto-initialize pipeline status in LightRAG.initialize_storages()
• Remove manual initialize_pipeline_status calls
• Auto-init in initialize_storages method
• Update error messages for clarity
• Warn on workspace conflicts

(cherry picked from commit e22ac52ebc)
2025-12-04 19:09:05 +08:00
yangdx
db508954d1 Add uv package manager support to installation docs
(cherry picked from commit 7bc6ccea19)
2025-12-04 19:09:04 +08:00