graphiti/graphiti_core/prompts
HUGO SON ce9ef3ca79
Add support for non-ASCII characters in LLM prompts (#805)
* Add support for non-ASCII characters in LLM prompts

- Add ensure_ascii parameter to Graphiti class (default: True)
- Create to_prompt_json helper function for consistent JSON serialization
- Update all prompt files to use new helper function
- Preserve Korean/Japanese/Chinese characters when ensure_ascii=False
- Maintain backward compatibility with existing behavior

Fixes issue where non-ASCII characters were escaped as unicode sequences
in prompts, making them unreadable in LLM logs and potentially affecting
model understanding.

* Remove unused json imports after replacing with to_prompt_json helper

- Fix ruff lint errors (F401) for unused json imports
- All prompt files now use to_prompt_json helper instead of json.dumps
- Maintains clean code style and passes lint checks

* Fix ensure_ascii propagation to all LLM calls

- Add ensure_ascii parameter to maintenance operation functions that were missing it
- Update function signatures in node_operations, community_operations, temporal_operations, and edge_operations
- Ensure all llm_client.generate_response calls receive proper ensure_ascii context
- Fix hardcoded ensure_ascii: True values that prevented non-ASCII character preservation
- Maintain backward compatibility with default ensure_ascii=True
- Complete the fix for issue #804 ensuring Korean/Japanese/Chinese characters are properly handled in LLM prompts
2025-08-08 11:07:32 -04:00
..
__init__.py chore: Fix packaging (#38) 2024-08-25 10:07:50 -07:00
dedupe_edges.py Add support for non-ASCII characters in LLM prompts (#805) 2025-08-08 11:07:32 -04:00
dedupe_nodes.py Add support for non-ASCII characters in LLM prompts (#805) 2025-08-08 11:07:32 -04:00
eval.py Add support for non-ASCII characters in LLM prompts (#805) 2025-08-08 11:07:32 -04:00
extract_edge_dates.py prompt update (#378) 2025-04-18 00:09:12 -04:00
extract_edges.py Add support for non-ASCII characters in LLM prompts (#805) 2025-08-08 11:07:32 -04:00
extract_nodes.py Add support for non-ASCII characters in LLM prompts (#805) 2025-08-08 11:07:32 -04:00
invalidate_edges.py Node dedupe efficiency (#490) 2025-05-15 13:56:33 -04:00
lib.py Gemini support (#324) 2025-04-06 09:27:04 -07:00
models.py chore: update version to 0.9.3 and restructure dependencies (#338) 2025-04-08 20:47:38 -07:00
prompt_helpers.py Add support for non-ASCII characters in LLM prompts (#805) 2025-08-08 11:07:32 -04:00
summarize_nodes.py Add support for non-ASCII characters in LLM prompts (#805) 2025-08-08 11:07:32 -04:00