Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
8c6f8e6
feat: entity extraction uses JSON structured output instead of delimi…
MrGidea Feb 7, 2026
c115342
fix: resolve CI linting - add extraction_max_tokens definition, apply…
MrGidea Feb 7, 2026
a6da346
refactor: remove extraction_max_tokens (not essential, json_repair ha…
MrGidea Feb 7, 2026
3c4aa8a
feat: integrate multimodal pipeline and role-based models
MrGidea Mar 8, 2026
7a63ae4
docs: add RAG-Anything parser alignment notes
MrGidea Mar 8, 2026
51084a3
chore: extend env.example for structured multimodal pipeline
MrGidea Mar 8, 2026
7c940af
fix: apply lint cleanup for multimodal PR
MrGidea Mar 8, 2026
deeb177
chore: align env.example with interactive setup template
MrGidea Mar 11, 2026
8147a47
chore: refresh env.example against latest upstream wizard
MrGidea Mar 11, 2026
bd491a4
fix: align runtime target lines in env.example
MrGidea Mar 14, 2026
f1d59d1
chore: sync env.example with latest upstream wizard changes
MrGidea Mar 14, 2026
1e85f95
fix: install offline storage deps for offline tests
MrGidea Mar 14, 2026
4df267e
fix: sort offline storage requirements
MrGidea Mar 14, 2026
02084d5
feat: add runtime role llm updates and role options
MrGidea Mar 14, 2026
0dbee05
feat: sink docx upload to pipeline, add positions and assets
MrGidea Mar 15, 2026
4de2dfd
fix: sync zhipu.py with upstream to resolve merge conflict
MrGidea Mar 15, 2026
584307c
fix: add upstream runtime_validation module for CI compatibility
MrGidea Mar 15, 2026
651a996
fix: add upstream opensearch storage impl for CI compatibility
MrGidea Mar 15, 2026
7ae58c2
chore: sync all upstream-only files to prevent CI collection failures
MrGidea Mar 15, 2026
84e555a
fix: align interactive setup test assertions with actual setup.sh output
MrGidea Mar 15, 2026
2b435f7
fix: revert test_interactive_setup_outputs to upstream main version
MrGidea Mar 15, 2026
2f60c67
chore: sync setup.sh with upstream fix for port mapping
MrGidea Mar 15, 2026
881096f
Merge branch 'dev' into feat/upstream-combined-no-disambiguation
danielaskdd Mar 19, 2026
9a05371
Merge branch 'main' into dev
danielaskdd Mar 20, 2026
5e81d51
Bump core version to 1.5.0
danielaskdd Mar 20, 2026
4cdb582
Merge branch 'dev' into ydh/multimodal-pipeline
danielaskdd Mar 20, 2026
322fd3e
Merge branch 'main' into dev
danielaskdd Mar 20, 2026
1df9f45
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 20, 2026
b4ddad3
👷 ci(workflows): skip CI runs on draft pull requests
danielaskdd Mar 20, 2026
5cd90f3
Merge branch 'main' into dev
danielaskdd Mar 20, 2026
669a676
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 20, 2026
ec160ba
Update README.md
danielaskdd Mar 20, 2026
5dc0ab4
Merge branch 'main' into dev
danielaskdd Mar 20, 2026
b152083
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 20, 2026
8213d2b
Merge branch 'main' into dev
danielaskdd Mar 21, 2026
db6ce44
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 21, 2026
608a06d
Merge branch 'main' into dev
danielaskdd Mar 21, 2026
415a275
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 21, 2026
35226ed
👷 ci(tests): remove offline-storage dependency from test installation
danielaskdd Mar 21, 2026
8a06dbf
Merge branch 'main' into dev
danielaskdd Mar 21, 2026
598ff5a
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 21, 2026
24ef95c
Merge branch 'main' into dev
danielaskdd Mar 21, 2026
85807f6
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 21, 2026
119cd44
Merge branch 'main' into dev
danielaskdd Mar 21, 2026
184c85e
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 21, 2026
a70ce2e
Merge branch 'main' into dev
danielaskdd Mar 21, 2026
6295f7f
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 21, 2026
d835c21
Merge branch 'main' into dev
danielaskdd Mar 22, 2026
84f07f7
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 22, 2026
999c17b
Merge branch 'main' into dev
danielaskdd Mar 23, 2026
1e9d5f6
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 23, 2026
a425600
🔧 chore(lightrag): suppress type checking warning for raganything import
danielaskdd Mar 23, 2026
9bb1da9
Merge branch 'main' into dev
danielaskdd Mar 24, 2026
b86b48c
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 24, 2026
e285eb4
Merge branch 'main' into dev
danielaskdd Mar 24, 2026
983cc1b
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 24, 2026
5f8f53e
Merge branch 'main' into dev
danielaskdd Mar 24, 2026
56fcda6
Merge branch 'dev' into feat/multimodal-pipeline
danielaskdd Mar 24, 2026
0154f0c
Merge pull request #2830 from HKUDS/feat/multimodal-pipeline
danielaskdd Mar 25, 2026
57b9ee7
Ensures timestamp consistency by explicitly using UTC timezone instea…
danielaskdd Mar 26, 2026
f615a9c
Merge branch 'main' into dev
danielaskdd Mar 26, 2026
59d4eae
Merge branch 'main' into dev
danielaskdd Mar 26, 2026
0f04fae
Add parsing/analyzing document statuses with race condition fix
danielaskdd Mar 27, 2026
00d0434
♻️ refactor(documentManager): consolidate document status buckets
danielaskdd Mar 27, 2026
1993e50
Merge branch 'new-doc-state' into dev
danielaskdd Mar 27, 2026
ddf7cf2
Merge branch 'main' into dev
danielaskdd Mar 27, 2026
0f5d8a7
Merge branch 'main' into dev
danielaskdd Mar 28, 2026
a88cb41
♻️ refactor(documentManager): reorganize document status filtering an…
danielaskdd Mar 28, 2026
cab9700
✨ feat(document): add multi-status filter support for document pagina…
danielaskdd Mar 28, 2026
0f4253c
Merge pull request #2851 from danielaskdd/fix/ui-doc-status
danielaskdd Mar 28, 2026
5925a2e
Merge remote-tracking branch 'origin/refact/pg-performance' into dev
danielaskdd Mar 28, 2026
28f1d99
Merge branch 'main' into dev
danielaskdd Mar 28, 2026
980057b
Merge branch 'main' into dev
danielaskdd Mar 29, 2026
7e7ced3
Fix linting
danielaskdd Mar 29, 2026
66f50b2
Merge branch 'main' into dev
danielaskdd Mar 29, 2026
200fd5b
🐛 fix(document-manager): correct component state check in async handlers
danielaskdd Mar 29, 2026
798ccac
🐛 fix(document_routes): handle missing workspace attribute gracefully
danielaskdd Mar 29, 2026
0547aeb
♻️ refactor(documents): remove unused refs and imports from DocumentM…
danielaskdd Mar 29, 2026
474bd20
Merge branch 'main' into dev
danielaskdd Mar 29, 2026
ad1ba07
Merge branch 'main' into dev
danielaskdd Mar 30, 2026
44cb8b2
fix: resolve conflicts with dev branch
Mar 31, 2026
2f5a41a
fix: run pre-commit
Mar 31, 2026
f1d7274
feature: Enhance entity extraction stability based on dev branch
Mar 31, 2026
e938f07
fix: run pre-commit
Mar 31, 2026
97ca24c
feature: add test file
Mar 31, 2026
03ea555
Merge branch 'feature/Enhance_entity_extraction_stability_dev' of htt…
Mar 31, 2026
2a9aacc
fix: fix format error
Mar 31, 2026
e5b3ef1
fix: correct the prompt
Mar 31, 2026
1c9e612
Merge branch 'main' into dev
danielaskdd Apr 2, 2026
d0ae0db
Merge branch 'main' into dev
danielaskdd Apr 3, 2026
abc7b9c
Merge branch 'main' into dev
danielaskdd Apr 3, 2026
01d24f0
🔧 chore(tsconfig): remove baseUrl configuration
danielaskdd Apr 4, 2026
be413c5
Merge branch 'main' into dev
danielaskdd Apr 4, 2026
6e30e4a
Merge branch 'main' into dev
danielaskdd Apr 4, 2026
8b81383
Merge branch 'main' into dev
danielaskdd Apr 4, 2026
de34cdd
Merge branch 'main' into dev
danielaskdd Apr 6, 2026
235a20c
chore: remove config.ini from compose samples
danielaskdd Apr 7, 2026
36be85b
Merge pull request #2906 from danielaskdd/chore/remove-config-ini-com…
danielaskdd Apr 7, 2026
b6109f4
Merge branch 'main' into dev
danielaskdd Apr 7, 2026
b3cf3c2
Merge branch 'main' into dev
danielaskdd Apr 7, 2026
6297a07
Merge branch 'dev' into feature/Enhance_entity_extraction_stability_dev
danielaskdd Apr 7, 2026
f219ea9
fix(openai): handle length finish reason fallback
danielaskdd Apr 7, 2026
6011b79
📝 docs(openai): add note on truncated structured output handling
danielaskdd Apr 7, 2026
8ee461d
Merge pull request #2913 from danielaskdd/fix/openai-length-finish-re…
danielaskdd Apr 7, 2026
447bf66
Merge branch 'dev' into feat/Enhance_entity_extraction_stability
danielaskdd Apr 7, 2026
f405bc3
test: add controlled benchmark for entity extraction stability
Apr 7, 2026
ec41aa4
feature: add full-service comparison artifacts
Apr 8, 2026
381c456
Merge pull request #2914 from MrGidea/test/attention-json-prompt-benc…
danielaskdd Apr 12, 2026
b7d24e9
Merge branch 'main' into dev
danielaskdd Apr 12, 2026
ebfd2d3
Merge branch 'main' into dev
danielaskdd Apr 12, 2026
302909d
Merge branch 'main' into dev
danielaskdd Apr 12, 2026
90b69b1
Merge branch 'main' into dev
danielaskdd Apr 14, 2026
f3cc90d
Merge branch 'main' into dev
danielaskdd Apr 14, 2026
958d2ee
Merge branch 'main' into dev
danielaskdd Apr 14, 2026
2f45e41
Merge branch 'main' into dev
danielaskdd Apr 15, 2026
b447d7e
Merge branch 'main' into dev
danielaskdd Apr 15, 2026
7380557
Merge branch 'dev' into feat/Enhance_entity_extraction_stability
danielaskdd Apr 15, 2026
e2e0e78
🔧 chore(docs): remove benchmark documentation files
danielaskdd Apr 17, 2026
145da35
✅ test(entity_extraction): add test for relationship endpoint entity …
danielaskdd Apr 17, 2026
0a44a38
♻️ refactor(prompt): standardize entity extraction prompt structure
danielaskdd Apr 17, 2026
68244bd
perf(postgres): use binary parameter for vector similarity queries
wkpark Apr 17, 2026
0d6e055
♻️ refactor(prompts): standardize json field names in entity extraction
danielaskdd Apr 17, 2026
a9fb95c
📝 docs(prompt): refine entity extraction prompts for clarity and cons…
danielaskdd Apr 17, 2026
04953c6
📝 docs(prompt): refine entity extraction system prompt
danielaskdd Apr 17, 2026
f4b7eb3
✨ feat(operate): add automatic recovery for mis-prefixed relation row…
danielaskdd Apr 17, 2026
8e4a81c
🔧 chore(config): change default value of entity extraction json mode …
danielaskdd Apr 17, 2026
a805669
🔧 chore(config): update entity extraction default setting
danielaskdd Apr 17, 2026
fd8b032
Merge branch 'feat/Enhance_entity_extraction_stability' into dev
danielaskdd Apr 17, 2026
576021e
Merge branch 'main' into dev
danielaskdd Apr 17, 2026
4a7b83d
🔧 chore(operate): reduce verbose logging in edge merging operations
danielaskdd Apr 18, 2026
9bcad36
🔧 chore(operate): remove redundant logging in entity extraction
danielaskdd Apr 18, 2026
1731c47
✨ feat(extraction): cap per-response output and expose limits via env
danielaskdd Apr 18, 2026
fd37cdf
✨ feat(prompt): allow relationships to reference entities from previo…
danielaskdd Apr 18, 2026
721ed6d
Merge pull request #2950 from danielaskdd/feat/configurable-extractio…
danielaskdd Apr 18, 2026
e9d077a
♻️ refactor(llm): unify keyword extraction across providers
danielaskdd Apr 18, 2026
59919b8
♻️ refactor(operate): improve keyword extraction reliability and erro…
danielaskdd Apr 18, 2026
282b0fd
♻️ refactor(types): remove unused GPTKeywordExtractionFormat class
danielaskdd Apr 18, 2026
3508947
Merge pull request #2953 from danielaskdd/refac/keyword-extration
danielaskdd Apr 18, 2026
a315a85
♻️ refactor(llm): unify structured output control via response_format
danielaskdd Apr 18, 2026
a5a56e1
📝 docs(llm): add structured output documentation across all LLM adapters
danielaskdd Apr 18, 2026
5a1efa1
✅ test(llm): update bedrock and zhipu tests for parameter changes
danielaskdd Apr 18, 2026
c0ad4c3
✨ feat(llm): add response_json_schema support for Gemini and improve …
danielaskdd Apr 18, 2026
b5a3d45
✨ feat(gemini): add support for OpenAI json_schema and Pydantic models
danielaskdd Apr 19, 2026
89a8afb
♻️ refactor(llm): standardize response_format validation across provi…
danielaskdd Apr 19, 2026
10585f7
♻️ refactor(zhipu): add deprecation shims for legacy extraction param…
danielaskdd Apr 19, 2026
05d8416
🐛 fix(llm): disable chain-of-thought when structured output is requested
danielaskdd Apr 19, 2026
e592b8b
Merge pull request #2956 from danielaskdd/refac/unify-response-format
danielaskdd Apr 19, 2026
81a14fa
♻️ refactor(gemini): improve default endpoint handling and sdk integr…
danielaskdd Apr 19, 2026
ba4e74d
Fix linting
danielaskdd Apr 19, 2026
a327134
✅ test(gemini): add api_key parameter to streaming test
danielaskdd Apr 19, 2026
47c71a5
Merge pull request #2957 from danielaskdd/fix/gemini-url
danielaskdd Apr 19, 2026
c8a7df6
refactor(bedrock): support default and custom endpoints
danielaskdd Apr 19, 2026
bb889e1
♻️ refactor(bedrock): extract client kwargs builder and clean up imports
danielaskdd Apr 19, 2026
02c1680
Merge pull request #2958 from danielaskdd/fix/bedrock-endpoint-url
danielaskdd Apr 19, 2026
4aabcd9
📝 docs(env): clarify DEFAULT_GEMINI_ENDPOINT usage in comments
danielaskdd Apr 19, 2026
9bc83b2
♻️ refactor(setup): replace hardcoded provider endpoints with sentine…
danielaskdd Apr 19, 2026
8b3b961
Merge pull request #2959 from danielaskdd/refact/setup-wizard-use-sen…
danielaskdd Apr 19, 2026
19d6652
Merge branch 'main' into dev
danielaskdd Apr 19, 2026
03c030e
Merge branch 'main' into dev
danielaskdd Apr 19, 2026
950f3a3
💄 style(documentManager): fix switch statement indentation
danielaskdd Apr 19, 2026
925bdf7
Merge pull request #2949 from wkpark/perf-postgres-safe-param-dev
danielaskdd Apr 19, 2026
95813e0
Merge branch 'main' into dev
danielaskdd Apr 19, 2026
b8936ba
Merge branch 'main' into dev
danielaskdd Apr 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docker-compose-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ services:
volumes:
- ./data/rag_storage:/app/data/rag_storage
- ./data/inputs:/app/data/inputs
- ./config.ini:/app/config.ini
- ./.env:/app/.env
deploy:
restart_policy:
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ services:
volumes:
- ./data/rag_storage:/app/data/rag_storage
- ./data/inputs:/app/data/inputs
- ./config.ini:/app/config.ini
- ./.env:/app/.env
deploy:
restart_policy:
Expand Down
91 changes: 91 additions & 0 deletions docs/RAGAnythingParserAlignment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
## RAG-Anything Parser Alignment Notes

This document summarizes the companion changes made on the `RAG-Anything` side to better align its parser output with the LightRAG multimodal pipeline introduced in this PR.

These notes are provided as reviewer context. The code changes described below live in the `RAG-Anything` repository, mainly in `raganything/parser.py`, rather than in this LightRAG pull request.

## Why This Alignment Was Needed

The LightRAG-side pipeline in this PR expects parser output to preserve heading structure, normalize multimodal block types consistently, and expose enough table metadata to generate correct LightRAG document sidecars.

Without the parser-side alignment, several downstream issues appear more easily:

- section headings may be lost before LightRAG sidecar generation
- table dimensions can degrade to `[0, 0]`
- table content may be harder to serialize into stable sidecar payloads
- parser output shape may drift between Docling variants

## RAG-Anything Changes

### 1. Add safe helper functions for parser normalization

Two small helpers were added:

- `_to_int(value, default=0)`
- `_grid_to_rows(grid)`

Their purpose is to make parser output more defensive and consistent when Docling returns numeric fields or table cell structures in slightly different formats.

### 2. Normalize text labels before branching

Docling text blocks are now normalized through:

- `label = str(block.get("label", "")).strip().lower()`

This avoids relying on a raw case-sensitive label and makes formula / title / section-header detection more stable.

### 3. Preserve section heading structure explicitly

For Docling text blocks, `section_header` and `title` are now emitted as dedicated structured blocks:

- `type: "section_header"` or `type: "title"`
- `text`
- `level`
- `page_idx`

This is important because the LightRAG-side conversion logic uses heading information to:

- propagate `heading`
- build `parent_headings`
- keep multimodal sidecars attached to the correct section context

### 4. Preserve label and level on normal text blocks

For non-heading text blocks, the parser now also retains:

- `label`
- `level`

This gives LightRAG more context when converting parser output into LightRAG document blocks and helps preserve document structure more faithfully.

### 5. Improve table normalization for Docling output

Table parsing was expanded to support both:

- dict-style table payloads with `grid`, `num_rows`, `num_cols`
- legacy list-style table payloads

The parser now derives and exposes:

- `table_body`
- `rows`
- `num_rows`
- `num_cols`

This is the key alignment needed for LightRAG-side table sidecar generation, especially to avoid empty dimensions and to keep table content serializable in a stable form.

## Practical Impact on This PR

These RAG-Anything parser changes are the external counterpart of the LightRAG work in this PR:

- LightRAG now converts structured parser output into LightRAG document artifacts
- multimodal sidecars depend on parser-side heading and table metadata
- heading propagation and table dimension fixes are more reliable when the parser emits normalized structure upstream

In short, the LightRAG code in this PR can run independently, but the best end-to-end behavior for Docling/RAG-Anything-driven multimodal ingestion depends on this parser alignment on the `RAG-Anything` side as well.

## Scope Note

This document is intentionally limited to parser-alignment notes for `RAG-Anything`.

It does not describe the entity disambiguation experiment, which is explicitly excluded from this PR.
108 changes: 100 additions & 8 deletions env.example
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,6 @@ SUMMARY_LANGUAGE=English
### Note: If using Nginx as reverse proxy, also configure client_max_body_size
# MAX_UPLOAD_SIZE=104857600

### Entity types that the LLM will attempt to recognize
# ENTITY_TYPES='["Person", "Creature", "Organization", "Location", "Event", "Concept", "Method", "Content", "Data", "Artifact", "NaturalObject"]'

### Chunk size for document splitting, 500~1500 is recommended
# CHUNK_SIZE=1200
# CHUNK_OVERLAP_SIZE=100
Expand All @@ -206,6 +203,51 @@ SUMMARY_LANGUAGE=English
### Maximum token size allowed for entity extraction input context
# MAX_EXTRACT_INPUT_TOKENS=20480

### Per-response cap on total entity+relationship rows/records emitted by the LLM
# MAX_EXTRACTION_RECORDS=100
### Per-response cap on entity rows/objects emitted by the LLM
# MAX_EXTRACTION_ENTITIES=40

### Use JSON structured output for entity extraction (false: default, JSON is slower but more reliable)
ENTITY_EXTRACTION_USE_JSON=true

### Multimodal parsing/analyze integration
### Optional parser routing rules, for example:
### pdf:mineru-iet,docx:docling,pptx:docling,*:native
# LIGHTRAG_PARSER=
### Optional local checkout path of RAG-Anything for parser integration
# RAGANYTHING_ROOT=/path/to/RAG-Anything
### Retry count for multimodal VLM analysis JSON normalization/writeback
# VLM_ANALYZE_RETRIES=2
### Maximum image bytes sent to VLM per multimodal item
# VLM_MAX_IMAGE_BYTES=5242880

### Async parser service protocol (optional)
### Configure these when using remote MinerU/Docling async services
# MINERU_ENDPOINT=http://localhost:8000/api/v1/task
# MINERU_POLL_ENDPOINT=http://localhost:8000/api/v1/task/{trace_id}
# MINERU_POLL_METHOD=GET
# MINERU_ID_FIELD=trace_id
# MINERU_STATUS_FIELD=status
# MINERU_RESULT_URL_FIELD=result_url
# MINERU_CONTENT_FIELD=content
# MINERU_SUCCESS_VALUES=done,success,completed
# MINERU_FAILED_VALUES=failed,error,cancelled
# MINERU_POLL_INTERVAL_SECONDS=2
# MINERU_MAX_POLLS=180

# DOCLING_ENDPOINT=http://localhost:8081/v1/convert/file/async
# DOCLING_POLL_ENDPOINT=http://localhost:8081/v1/convert/file/async/{task_id}
# DOCLING_POLL_METHOD=GET
# DOCLING_ID_FIELD=task_id
# DOCLING_STATUS_FIELD=status
# DOCLING_RESULT_URL_FIELD=result_url
# DOCLING_CONTENT_FIELD=content
# DOCLING_SUCCESS_VALUES=done,success,completed
# DOCLING_FAILED_VALUES=failed,error,cancelled
# DOCLING_POLL_INTERVAL_SECONDS=2
# DOCLING_MAX_POLLS=180

### control the maximum chunk_ids stored in vector and graph db
# MAX_SOURCE_IDS_PER_ENTITY=300
# MAX_SOURCE_IDS_PER_RELATION=300
Expand All @@ -227,6 +269,14 @@ SUMMARY_LANGUAGE=English
MAX_ASYNC=4
### Number of parallel processing documents(between 2~10, MAX_ASYNC/3 is recommended)
MAX_PARALLEL_INSERT=2
### Optional per-stage document pipeline concurrency
# MAX_PARALLEL_PARSE_NATIVE=5
# MAX_PARALLEL_PARSE_MINERU=3
# MAX_PARALLEL_PARSE_DOCLING=3
# MAX_PARALLEL_ANALYZE=2
### Optional queue sizes for staged pipeline workers
# QUEUE_SIZE_DEFAULT=100
# QUEUE_SIZE_INSERT=4
### Max concurrency requests for Embedding
# EMBEDDING_FUNC_MAX_ASYNC=8
### Num of chunks send to Embedding in single request
Expand All @@ -235,7 +285,7 @@ MAX_PARALLEL_INSERT=2
###########################################################################
### LLM Configuration
### LLM_BINDING type: openai, ollama, lollms, azure_openai, aws_bedrock, gemini
### LLM_BINDING_HOST: Service endpoint (left empty if using default endpoint provided by openai or gemini SDK)
### LLM_BINDING_HOST: Service endpoint (left empty if using the provider SDK default endpoint)
### LLM_BINDING_API_KEY: api key
### If LightRAG deployed in Docker:
### uses host.docker.internal instead of localhost in LLM_BINDING_HOST
Expand All @@ -262,7 +312,7 @@ LLM_MODEL=gpt-5-mini
# OPENAI_LLM_TEMPERATURE=0.9
### Set the max_tokens to mitigate endless output of some LLM (less than LLM_TIMEOUT * llm_output_tokens/second, i.e. 9000 = 180s * 50 tokens/s)
### Typically, max_tokens does not include prompt content
### For vLLM/SGLang deployed models, or most of OpenAI compatible API provider
### For vLLM/SGLang and most of OpenAI compatible API provider
# OPENAI_LLM_MAX_TOKENS=9000
### For OpenAI o1-mini or newer modles utilizes max_completion_tokens instead of max_tokens
# OPENAI_LLM_MAX_COMPLETION_TOKENS=9000
Expand All @@ -283,8 +333,9 @@ LLM_MODEL=gpt-5-mini

### Google Gemini example (AI Studio)
# # LLM_BINDING=gemini
### DEFAULT_GEMINI_ENDPOINT means selecting endpoit by SDK automatically
# # LLM_BINDING_HOST=DEFAULT_GEMINI_ENDPOINT
# # LLM_BINDING_API_KEY=your_gemini_api_key
# # LLM_BINDING_HOST=https://generativelanguage.googleapis.com
# # LLM_MODEL=gemini-flash-latest

### use the following command to see all support options for OpenAI, azure_openai or OpenRouter
Expand All @@ -298,7 +349,6 @@ LLM_MODEL=gpt-5-mini

### Google Vertex AI example
### Vertex AI use GOOGLE_APPLICATION_CREDENTIALS instead of API-KEY for authentication
### LLM_BINDING_HOST=DEFAULT_GEMINI_ENDPOINT means select endpoit based on project and location automatically
# # LLM_BINDING=gemini
# # LM_BINDING_HOST=https://aiplatform.googleapis.com
### or use DEFAULT_GEMINI_ENDPOINT to select endpoint based on project and location automatically
Expand Down Expand Up @@ -329,13 +379,52 @@ OLLAMA_LLM_NUM_CTX=32768
### Bedrock uses AWS credentials from the environment / AWS credential chain.
### It does not use LLM_BINDING_API_KEY.
# # LLM_BINDING=aws_bedrock
# # LLM_BINDING_HOST=DEFAULT_BEDROCK_ENDPOINT
# # Or set LLM_BINDING_HOST to a custom Bedrock-compatible proxy/gateway URL
# # LLM_MODEL=anthropic.claude-3-5-sonnet-20241022-v2:0
# AWS_ACCESS_KEY_ID=your_aws_access_key_id
# AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
# AWS_SESSION_TOKEN=your_optional_aws_session_token
# AWS_REGION=us-east-1
# BEDROCK_LLM_TEMPERATURE=1.0

###########################################################################
### Optional role-specific LLM/VLM overrides
### If unset, each role falls back to the base LLM_* configuration above.
### Available roles: EXTRACT, KEYWORD, QUERY, VLM
###########################################################################
### Example: use a dedicated model/provider for entity extraction
# EXTRACT_LLM_BINDING=openai
# EXTRACT_LLM_MODEL=your_extract_model
# EXTRACT_LLM_BINDING_HOST=https://api.example.com/v1
# EXTRACT_LLM_BINDING_API_KEY=your_extract_api_key
# MAX_ASYNC_EXTRACT_LLM=4
# LLM_TIMEOUT_EXTRACT_LLM=180

### Example: use a dedicated model/provider for keyword extraction
# KEYWORD_LLM_BINDING=openai
# KEYWORD_LLM_MODEL=your_keyword_model
# KEYWORD_LLM_BINDING_HOST=https://api.example.com/v1
# KEYWORD_LLM_BINDING_API_KEY=your_keyword_api_key
# MAX_ASYNC_KEYWORD_LLM=4
# LLM_TIMEOUT_KEYWORD_LLM=180

### Example: use a dedicated model/provider for query answering
# QUERY_LLM_BINDING=openai
# QUERY_LLM_MODEL=your_query_model
# QUERY_LLM_BINDING_HOST=https://api.example.com/v1
# QUERY_LLM_BINDING_API_KEY=your_query_api_key
# MAX_ASYNC_QUERY_LLM=4
# LLM_TIMEOUT_QUERY_LLM=180

### Example: use a dedicated model/provider for multimodal analysis
# VLM_LLM_BINDING=openai
# VLM_LLM_MODEL=your_vlm_model
# VLM_LLM_BINDING_HOST=https://api.example.com/v1
# VLM_LLM_BINDING_API_KEY=your_vlm_api_key
# MAX_ASYNC_VLM_LLM=4
# LLM_TIMEOUT_VLM_LLM=180

#######################################################################################
### Embedding Configuration (Should not be changed after the first file processed)
### EMBEDDING_BINDING: ollama, openai, azure_openai, jina, lollms, aws_bedrock
Expand Down Expand Up @@ -377,7 +466,8 @@ EMBEDDING_SEND_DIM=false
# # EMBEDDING_MODEL=gemini-embedding-001
# # EMBEDDING_DIM=1536
# # EMBEDDING_TOKEN_LIMIT=2048
# # EMBEDDING_BINDING_HOST=https://generativelanguage.googleapis.com
### DEFAULT_GEMINI_ENDPOINT means selecting endpoit by SDK automatically
# # EMBEDDING_BINDING_HOST=DEFAULT_GEMINI_ENDPOINT
# # EMBEDDING_BINDING_API_KEY=your_api_key
### Gemini embedding requires sending dimension to server
# # EMBEDDING_SEND_DIM=true
Expand All @@ -397,6 +487,8 @@ OLLAMA_EMBEDDING_NUM_CTX=8192
### Bedrock uses AWS credentials from the environment / AWS credential chain.
### It does not use EMBEDDING_BINDING_API_KEY.
# # EMBEDDING_BINDING=aws_bedrock
# # EMBEDDING_BINDING_HOST=DEFAULT_BEDROCK_ENDPOINT
# # Or set EMBEDDING_BINDING_HOST to a custom Bedrock-compatible proxy/gateway URL
# # EMBEDDING_MODEL=amazon.titan-embed-text-v2:0
# # EMBEDDING_DIM=1024
# AWS_ACCESS_KEY_ID=your_aws_access_key_id
Expand Down
21 changes: 3 additions & 18 deletions examples/lightrag_gemini_workspace_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
which ensures that Knowledge Graphs, Vector Databases, and Chunks are
stored in separate, non-conflicting directories.
- Independent Configuration: Different workspaces can utilize different
ENTITY_TYPES and document sets simultaneously.
entity type guidance and document sets simultaneously.

Prerequisites:
1. Set the following environment variables:
- GEMINI_API_KEY: Your Google Gemini API key.
- ENTITY_TYPES: A JSON string of entity categories (e.g., '["Person", "Organization"]').
2. Ensure your data directory contains:
- Data/book-small.txt
- Data/HR_policies.txt
Expand All @@ -25,12 +24,10 @@

import os
import asyncio
import json
import numpy as np
from lightrag import LightRAG, QueryParam
from lightrag.llm.gemini import gemini_model_complete, gemini_embed
from lightrag.utils import wrap_embedding_func_with_attrs
from lightrag.constants import DEFAULT_ENTITY_TYPES


async def llm_model_func(
Expand Down Expand Up @@ -59,25 +56,14 @@ async def embedding_func(texts: list[str]) -> np.ndarray:

async def initialize_rag(
workspace: str = "default_workspace",
entities=None,
) -> LightRAG:
"""
Initializes a LightRAG instance with data isolation.

- entities (if provided) overrides everything
- else ENTITY_TYPES env var is used
- else DEFAULT_ENTITY_TYPES is used
Entity type guidance can be customized by passing
addon_params={'entity_types_guidance': '...'} to LightRAG.
"""

if entities is not None:
entity_types = entities
else:
env_entities = os.getenv("ENTITY_TYPES")
if env_entities:
entity_types = json.loads(env_entities)
else:
entity_types = DEFAULT_ENTITY_TYPES

rag = LightRAG(
workspace=workspace,
llm_model_name="gemini-2.0-flash",
Expand All @@ -86,7 +72,6 @@ async def initialize_rag(
embedding_func_max_async=4,
embedding_batch_num=8,
llm_model_max_async=2,
addon_params={"entity_types": entity_types},
)

await rag.initialize_storages()
Expand Down
2 changes: 1 addition & 1 deletion lightrag/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Lightweight version definitions shared by packaging and runtime code."""

__version__ = "1.4.16"
__version__ = "1.5.0"
__api_version__ = "0288"
Loading
Loading