Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search node centering #45

Merged
merged 8 commits into from
Aug 26, 2024
Merged

Search node centering #45

merged 8 commits into from
Aug 26, 2024

Conversation

prasmussen15
Copy link
Collaborator

@prasmussen15 prasmussen15 commented Aug 26, 2024

🚀 This description was created by Ellipsis for commit 517cedd

Summary:

Enhance Graphiti with node-centered search, node distance-based reranking, and updates for improved search relevance.

Key points:

  • Enhance Graphiti with node-centered search and node distance-based reranking.
  • Add center_node_uuid parameter to Graphiti.search.
  • Implement node_distance_reranker in graphiti_core/search/search_utils.py.
  • Update Graphiti._search for node distance reranking.
  • Modify SearchConfig to include enums for search_methods and reranker.
  • Adjust search utility functions for improved relevance.
  • Update rrf to use float scores.

Generated with ❤️ by ellipsis.dev

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to ae23826 in 22 seconds

More details
  • Looked at 328 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 16 drafted comments based on config settings.
1. graphiti_core/graphiti.py:88
  • Draft comment:
    The indentation for method parameters is inconsistent with PEP 8 style guidelines. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation for the method parameters is inconsistent with PEP 8 style guidelines. This is a minor style issue but should be corrected for consistency and readability.
2. graphiti_core/graphiti.py:96
  • Draft comment:
    The indentation for method parameters is inconsistent with PEP 8 style guidelines. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation for the method parameters is inconsistent with PEP 8 style guidelines. This is a minor style issue but should be corrected for consistency and readability.
3. graphiti_core/graphiti.py:255
  • Draft comment:
    The indentation for method parameters is inconsistent with PEP 8 style guidelines. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation for the method parameters is inconsistent with PEP 8 style guidelines. This is a minor style issue but should be corrected for consistency and readability.
4. graphiti_core/graphiti.py:356
  • Draft comment:
    The indentation for method parameters is inconsistent with PEP 8 style guidelines. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation for the method parameters is inconsistent with PEP 8 style guidelines. This is a minor style issue but should be corrected for consistency and readability.
5. graphiti_core/search/search_utils.py:104
  • Draft comment:
    The indentation for method parameters is inconsistent with PEP 8 style guidelines. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation for the method parameters is inconsistent with PEP 8 style guidelines. This is a minor style issue but should be corrected for consistency and readability.
6. graphiti_core/search/search_utils.py:153
  • Draft comment:
    The indentation for method parameters is inconsistent with PEP 8 style guidelines. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation for the method parameters is inconsistent with PEP 8 style guidelines. This is a minor style issue but should be corrected for consistency and readability.
7. graphiti_core/search/search_utils.py:187
  • Draft comment:
    The indentation for method parameters is inconsistent with PEP 8 style guidelines. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation for the method parameters is inconsistent with PEP 8 style guidelines. This is a minor style issue but should be corrected for consistency and readability.
8. graphiti_core/search/search_utils.py:222
  • Draft comment:
    The indentation for method parameters is inconsistent with PEP 8 style guidelines. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation for the method parameters is inconsistent with PEP 8 style guidelines. This is a minor style issue but should be corrected for consistency and readability.
9. graphiti_core/graphiti.py:88
  • Draft comment:
    The indentation for method parameters is not idiomatic. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code contains multiple instances of misaligned indentation for method parameters, which is not idiomatic in Python. This issue is present in several methods across different files.
10. graphiti_core/graphiti.py:96
  • Draft comment:
    The indentation for method parameters is not idiomatic. Consider aligning parameters with the opening parenthesis. This issue is also present in other methods like add_episode_bulk and _search.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code contains multiple instances of misaligned indentation for method parameters, which is not idiomatic in Python. This issue is present in several methods across different files.
11. graphiti_core/graphiti.py:255
  • Draft comment:
    The indentation for method parameters is not idiomatic. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code contains multiple instances of misaligned indentation for method parameters, which is not idiomatic in Python. This issue is present in several methods across different files.
12. graphiti_core/graphiti.py:356
  • Draft comment:
    The indentation for method parameters is not idiomatic. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code contains multiple instances of misaligned indentation for method parameters, which is not idiomatic in Python. This issue is present in several methods across different files.
13. graphiti_core/search/search_utils.py:104
  • Draft comment:
    The indentation for method parameters is not idiomatic. Consider aligning parameters with the opening parenthesis. This issue is also present in other methods like entity_similarity_search, entity_fulltext_search, and edge_fulltext_search.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code contains multiple instances of misaligned indentation for method parameters, which is not idiomatic in Python. This issue is present in several methods across different files.
14. graphiti_core/search/search_utils.py:153
  • Draft comment:
    The indentation for method parameters is not idiomatic. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code contains multiple instances of misaligned indentation for method parameters, which is not idiomatic in Python. This issue is present in several methods across different files.
15. graphiti_core/search/search_utils.py:187
  • Draft comment:
    The indentation for method parameters is not idiomatic. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code contains multiple instances of misaligned indentation for method parameters, which is not idiomatic in Python. This issue is present in several methods across different files.
16. graphiti_core/search/search_utils.py:222
  • Draft comment:
    The indentation for method parameters is not idiomatic. Consider aligning parameters with the opening parenthesis.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code contains multiple instances of misaligned indentation for method parameters, which is not idiomatic in Python. This issue is present in several methods across different files.

Workflow ID: wflow_wDXYNgfUxLbg0ZqR


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Incremental review on b4c2d57 in 26 seconds

More details
  • Looked at 188 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. graphiti_core/graphiti.py:88
  • Draft comment:
    Unnecessary indentation change. Revert to maintain consistency.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation in the graphiti.py file was changed, but it doesn't affect functionality. However, it is unnecessary and should be reverted to maintain consistency.
2. graphiti_core/graphiti.py:96
  • Draft comment:
    Unnecessary indentation change. Revert to maintain consistency.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation in the graphiti.py file was changed, but it doesn't affect functionality. However, it is unnecessary and should be reverted to maintain consistency.
3. graphiti_core/graphiti.py:256
  • Draft comment:
    Unnecessary indentation change. Revert to maintain consistency.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation in the graphiti.py file was changed, but it doesn't affect functionality. However, it is unnecessary and should be reverted to maintain consistency.
4. graphiti_core/graphiti.py:252
  • Draft comment:
    Avoid logging sensitive data like node names and UUIDs. This is also applicable at lines 127, 135, 139, 149, 150, 211, 220, 222, and 233.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code contains multiple instances of logging sensitive data, such as node names and UUIDs, which should be avoided.
5. graphiti_core/search/search.py:122
  • Draft comment:
    Avoid logging sensitive data like node names and UUIDs. This is also applicable at lines 101 and 138.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code contains multiple instances of logging sensitive data, such as node names and UUIDs, which should be avoided.
6. graphiti_core/search/search_utils.py:367
  • Draft comment:
    Avoid logging sensitive data like node names and UUIDs. This is also applicable at lines 99 and 299.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code contains multiple instances of logging sensitive data, such as node names and UUIDs, which should be avoided.

Workflow ID: wflow_BYh2btrLx6x9c9qO


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

graphiti_core/search/search_utils.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on c5752e9 in 13 seconds

More details
  • Looked at 77 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. graphiti_core/graphiti.py:176
  • Draft comment:
    Incorrect indentation for method parameters. Align them with the opening parenthesis of the function call. This issue is also present in add_episode, add_episode_bulk, and _search.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The indentation for the parameters in the methods retrieve_episodes, add_episode, add_episode_bulk, and _search is incorrect. This can lead to confusion and is not in line with PEP 8 style guidelines.
2. graphiti_core/graphiti.py:176
  • Draft comment:
    Align the parameters with the first parameter for consistency and readability. This applies to other methods as well.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The indentation for the parameters in the methods is inconsistent. It should be aligned with the first parameter for better readability and to follow idiomatic Python style.
3. graphiti_core/graphiti.py:571
  • Draft comment:
    Consider refactoring _search to adhere to the single responsibility principle. It directly calls hybrid_search, which might be better handled elsewhere.
  • Reason this comment was not posted:
    Confidence changes required: 70%
    The method _search is not following the single responsibility principle as it directly calls hybrid_search. It should be refactored to separate concerns if possible.

Workflow ID: wflow_Pf3oekI64vWbPBvC


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on d901d88 in 29 seconds

More details
  • Looked at 88 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 9 drafted comments based on config settings.
1. graphiti_core/search/search_utils.py:104
  • Draft comment:
    The indentation of the parameters in the function definitions is inconsistent. Consider aligning them with the opening parenthesis for better readability. This issue is also present in other functions like entity_similarity_search, entity_fulltext_search, edge_fulltext_search, get_relevant_nodes, get_relevant_edges, and node_distance_reranker.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The indentation of the parameters in the function definitions is inconsistent with PEP 8 style guidelines.
2. graphiti_core/search/search_utils.py:152
  • Draft comment:
    The indentation of the parameters in the function definitions is inconsistent. Consider aligning them with the opening parenthesis for better readability. This issue is also present in other functions like entity_fulltext_search, edge_fulltext_search, get_relevant_nodes, get_relevant_edges, and node_distance_reranker.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The indentation of the parameters in the function definitions is inconsistent with PEP 8 style guidelines.
3. graphiti_core/search/search_utils.py:186
  • Draft comment:
    The indentation of the parameters in the function definitions is inconsistent. Consider aligning them with the opening parenthesis for better readability. This issue is also present in other functions like edge_fulltext_search, get_relevant_nodes, get_relevant_edges, and node_distance_reranker.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The indentation of the parameters in the function definitions is inconsistent with PEP 8 style guidelines.
4. graphiti_core/search/search_utils.py:221
  • Draft comment:
    The indentation of the parameters in the function definitions is inconsistent. Consider aligning them with the opening parenthesis for better readability. This issue is also present in other functions like get_relevant_nodes, get_relevant_edges, and node_distance_reranker.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The indentation of the parameters in the function definitions is inconsistent with PEP 8 style guidelines.
5. graphiti_core/search/search_utils.py:272
  • Draft comment:
    The indentation of the parameters in the function definitions is inconsistent. Consider aligning them with the opening parenthesis for better readability. This issue is also present in other functions like get_relevant_edges and node_distance_reranker.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The indentation of the parameters in the function definitions is inconsistent with PEP 8 style guidelines.
6. graphiti_core/search/search_utils.py:303
  • Draft comment:
    The indentation of the parameters in the function definitions is inconsistent. Consider aligning them with the opening parenthesis for better readability. This issue is also present in the node_distance_reranker function.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The indentation of the parameters in the function definitions is inconsistent with PEP 8 style guidelines.
7. graphiti_core/search/search_utils.py:349
  • Draft comment:
    The indentation of the parameters in the function definitions is inconsistent. Consider aligning them with the opening parenthesis for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The indentation of the parameters in the function definitions is inconsistent with PEP 8 style guidelines.
8. graphiti_core/search/search_utils.py:104
  • Draft comment:
    The indentation of the parameters in the function definitions is inconsistent. Please align them properly for better readability. This issue is also present in entity_similarity_search, entity_fulltext_search, edge_fulltext_search, get_relevant_nodes, get_relevant_edges, and node_distance_reranker.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The indentation of the parameters in the function definitions is inconsistent. This should be corrected for better readability and to adhere to idiomatic Python style.
9. graphiti_core/search/search_utils.py:349
  • Draft comment:
    The node_distance_reranker function is complex and would benefit from comments explaining its logic, especially around the shortest path calculation and scoring mechanism.
  • Reason this comment was not posted:
    Confidence changes required: 70%
    The node_distance_reranker function is quite complex and lacks comments explaining its logic. Adding comments would help in understanding the code better.

Workflow ID: wflow_TRif2MottriIKb3i


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Incremental review on 13aa9fa in 19 seconds

More details
  • Looked at 22 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. graphiti_core/search/search_utils.py:336
  • Draft comment:
    The defaultdict should be initialized with float instead of int for consistency and correctness. This ensures that the default value is a float, which is important for calculations involving division.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The defaultdict should be initialized with float instead of int for consistency and correctness.

Workflow ID: wflow_29bR8aIOf0NNBvE8


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

graphiti_core/search/search_utils.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 094a489 in 17 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. graphiti_core/search/search_utils.py:336
  • Draft comment:
    The change from defaultdict(int) to defaultdict(float) is correct and necessary for handling float operations in the rrf function. Ensure similar changes are applied wherever float operations are expected.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The use of defaultdict(float) is correct for initializing scores with float values. However, the rrf function was previously using defaultdict(int), which would have caused issues with float operations. The change to defaultdict(float) is appropriate and necessary.
2. graphiti_core/search/search_utils.py:333
  • Draft comment:
    Add a copyright notice at the top of the file.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code lacks a copyright notice at the top of the file, which is a requirement.

Workflow ID: wflow_y0OjWUshCSWBKoRQ


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 517cedd in 27 seconds

More details
  • Looked at 202 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 12 drafted comments based on config settings.
1. graphiti_core/graphiti.py:176
  • Draft comment:
    The indentation of the parameters in this function is inconsistent with PEP 8 style guidelines. Consider aligning them with the opening parenthesis for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation in the function parameters is inconsistent with PEP 8 style guidelines. This should be corrected for better readability and maintainability.
2. graphiti_core/graphiti.py:206
  • Draft comment:
    The indentation of the parameters in this function is inconsistent with PEP 8 style guidelines. Consider aligning them with the opening parenthesis for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation in the function parameters is inconsistent with PEP 8 style guidelines. This should be corrected for better readability and maintainability.
3. graphiti_core/graphiti.py:408
  • Draft comment:
    The indentation of the parameters in this function is inconsistent with PEP 8 style guidelines. Consider aligning them with the opening parenthesis for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation in the function parameters is inconsistent with PEP 8 style guidelines. This should be corrected for better readability and maintainability.
4. graphiti_core/graphiti.py:572
  • Draft comment:
    The indentation of the parameters in this function is inconsistent with PEP 8 style guidelines. Consider aligning them with the opening parenthesis for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation in the function parameters is inconsistent with PEP 8 style guidelines. This should be corrected for better readability and maintainability.
5. graphiti_core/search/search_utils.py:104
  • Draft comment:
    The indentation of the parameters in this function is inconsistent with PEP 8 style guidelines. Consider aligning them with the opening parenthesis for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation in the function parameters is inconsistent with PEP 8 style guidelines. This should be corrected for better readability and maintainability.
6. graphiti_core/search/search_utils.py:153
  • Draft comment:
    The indentation of the parameters in this function is inconsistent with PEP 8 style guidelines. Consider aligning them with the opening parenthesis for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation in the function parameters is inconsistent with PEP 8 style guidelines. This should be corrected for better readability and maintainability.
7. graphiti_core/search/search_utils.py:187
  • Draft comment:
    The indentation of the parameters in this function is inconsistent with PEP 8 style guidelines. Consider aligning them with the opening parenthesis for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation in the function parameters is inconsistent with PEP 8 style guidelines. This should be corrected for better readability and maintainability.
8. graphiti_core/search/search_utils.py:222
  • Draft comment:
    The indentation of the parameters in this function is inconsistent with PEP 8 style guidelines. Consider aligning them with the opening parenthesis for better readability.
  • Reason this comment was not posted:
    Confidence changes required: 10%
    The indentation in the function parameters is inconsistent with PEP 8 style guidelines. This should be corrected for better readability and maintainability.
9. graphiti_core/search/search_utils.py:349
  • Draft comment:
    Add comments to explain the logic in node_distance_reranker, especially the graph traversal and scoring based on path lengths.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code lacks comments explaining the complex logic in the node_distance_reranker function, which involves graph traversal and scoring based on path lengths.
10. graphiti_core/graphiti.py:205
  • Draft comment:
    Add comments to explain the complex logic in add_episode, especially the asynchronous operations and data processing steps.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code lacks comments explaining the complex logic in the add_episode method, which involves multiple asynchronous operations and data processing steps.
11. graphiti_core/graphiti.py:407
  • Draft comment:
    Add comments to explain the complex logic in add_episode_bulk, especially the asynchronous operations and data processing steps.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code lacks comments explaining the complex logic in the add_episode_bulk method, which involves multiple asynchronous operations and data processing steps.
12. graphiti_core/graphiti.py:175
  • Draft comment:
    Add comments to explain the logic in retrieve_episodes, especially the asynchronous data retrieval process.
  • Reason this comment was not posted:
    Confidence changes required: 80%
    The code lacks comments explaining the complex logic in the retrieve_episodes method, which involves asynchronous data retrieval.

Workflow ID: wflow_7jcdfbiGB6KTGboK


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@prasmussen15 prasmussen15 merged commit 2d01e5d into main Aug 26, 2024
6 checks passed
@prasmussen15 prasmussen15 deleted the search-node-centering branch August 26, 2024 22:35
@github-actions github-actions bot locked and limited conversation to collaborators Aug 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants