graphiti/graphiti_core
codeflash-ai[bot] 2110dbe564
️ Speed up function validate_entity_types by 70%
Here is an optimized version of your program.  
### Major inefficiency  
The code computed `EntityNode.model_fields.keys()` **every call** to the function, but that is invariant and need only be computed once per module. Likewise, it looked up `.keys()` for every entity type model, though these could be checked far more efficiently via set intersection.



### Key performance improvements.
- `EntityNode.model_fields.keys()` evaluated **once**, as a set, and reused.
- Comparison per entity type uses `set` intersection (O(min(N, M))) instead of repeated linear search.  
- Only a single scan over each entity type model's fields, not recomputed unnecessarily.

The function signature and error handling are unchanged, and all preserved comments are respected. This implementation will be significantly faster for many input types.
2025-07-21 00:23:15 +00:00
..
cross_encoder Bulk ingestion (#698) 2025-07-10 12:14:49 -04:00
driver [REFACTOR][FIX] Move away from DEFAULT_DATABASE environment variable in favour of driver-config support (dc) (#699) 2025-07-10 17:25:39 -04:00
embedder save edge update (#721) 2025-07-14 11:15:38 -04:00
llm_client save edge update (#721) 2025-07-14 11:15:38 -04:00
models save edge update (#721) 2025-07-14 11:15:38 -04:00
prompts Bulk updates (#732) 2025-07-16 02:26:33 -04:00
search update search filters (#706) 2025-07-11 10:53:15 -04:00
telemetry feat: add telemetry with PostHog and update Docker configurations (#633) 2025-06-27 12:23:30 -07:00
utils ️ Speed up function validate_entity_types by 70% 2025-07-21 00:23:15 +00:00
__init__.py chore: Fix packaging (#38) 2024-08-25 10:07:50 -07:00
edges.py [REFACTOR][FIX] Move away from DEFAULT_DATABASE environment variable in favour of driver-config support (dc) (#699) 2025-07-10 17:25:39 -04:00
errors.py Add group ID validation and error handling (#618) 2025-06-24 09:33:54 -07:00
graph_queries.py update driver (#583) 2025-06-13 14:12:09 -04:00
graphiti.py Bulk updates (#732) 2025-07-16 02:26:33 -04:00
graphiti_types.py Add support for falkordb (#575) 2025-06-13 12:06:57 -04:00
helpers.py [REFACTOR][FIX] Move away from DEFAULT_DATABASE environment variable in favour of driver-config support (dc) (#699) 2025-07-10 17:25:39 -04:00
nodes.py [REFACTOR][FIX] Move away from DEFAULT_DATABASE environment variable in favour of driver-config support (dc) (#699) 2025-07-10 17:25:39 -04:00
py.typed Add py.typed file (#105) 2024-09-11 08:44:06 -04:00