LightRAG/lightrag
Ghazi-raad 207af40f54 Optimize for OpenAI Prompt Caching: Restructure entity extraction prompts
- Remove input_text from entity_extraction_system_prompt to enable caching
- Move input_text to entity_extraction_user_prompt for per-chunk variability
- Update operate.py to format system prompt once without input_text
- Format user prompts with input_text for each chunk

This enables OpenAI's automatic prompt caching (50% discount on cached tokens):
- ~1300 token system message cached and reused for ALL chunks
- Only ~150 token user message varies per chunk
- Expected 45% cost reduction on prompt tokens during indexing
- 2-3x faster response times from cached prompts

Fixes #2355
2025-11-26 21:56:25 +00:00
..
api Handle missing WebUI assets gracefully without blocking server startup 2025-11-25 02:51:55 +08:00
evaluation Update LLM cache migration docs and improve UX prompts 2025-11-08 23:48:19 +08:00
kg Add pipeline status lock function for legacy compatibility 2025-11-25 18:24:39 +08:00
llm fix:exception handling order error 2025-11-25 16:36:41 +08:00
tools Refactor main function to provide sync CLI entry point 2025-11-21 13:11:55 +08:00
__init__.py Bump core version to 1.4.9.9 and API to 0252 2025-11-08 11:27:26 +08:00
base.py Remove unused chunk-based node/edge retrieval methods 2025-11-06 18:17:10 +08:00
constants.py Refactor entity merging with unified attribute merge function 2025-10-27 00:04:17 +08:00
exceptions.py Fix ChunkTokenLimitExceededError message formatting 2025-11-19 18:50:45 +08:00
lightrag.py Fix linting 2025-11-18 22:38:43 +08:00
namespace.py Add entity/relation chunk tracking with configurable source ID limits 2025-10-20 15:24:15 +08:00
operate.py Optimize for OpenAI Prompt Caching: Restructure entity extraction prompts 2025-11-26 21:56:25 +00:00
prompt.py Optimize for OpenAI Prompt Caching: Restructure entity extraction prompts 2025-11-26 21:56:25 +00:00
rerank.py fix: Resolve default rerank config problem when env var missing 2025-08-23 01:07:59 +08:00
types.py
utils.py Fix double decoration in azure_openai_embed and document decorator usage 2025-11-21 18:03:53 +08:00
utils_graph.py Improve entity merge logging by removing redundant message and fixing typo 2025-10-31 17:16:59 +08:00