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

refactor(agents-api): Add decorator to wrap cozo queries inside and execute #273

Merged
merged 2 commits into from
Apr 18, 2024

Conversation

creatorrr
Copy link
Contributor

@creatorrr creatorrr commented Apr 18, 2024


🚀 This description was created by Ellipsis for commit 86414f9

Summary:

This PR introduces a decorator to simplify database query execution in the agents_api/models directory, and includes various updates to the TypeScript and Python SDKs, fixes, and documentation improvements.

Key points:

  • Introduced cozo_query decorator in agents_api/models/utils.py to wrap functions returning a query and variables, executing the query and returning a DataFrame.
  • Applied cozo_query decorator to various functions across agents_api/models, simplifying code by removing repeated query execution logic.
  • Included various updates to TypeScript and Python SDKs.
  • Provided fixes for model serving and function calling.
  • Removed model surgery notebooks.
  • Improved documentation and comments.

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 the entire pull request up to 86414f9
  • Looked at 1729 lines of code in 39 files
  • Took 4 minutes and 59 seconds to review
More info
  • Skipped 0 files when reviewing.
  • Skipped posting 17 additional comments because they didn't meet confidence threshold of 50%.
1. agents-api/agents_api/models/utils.py:9:
  • Assessed confidence : 0%
  • Comment:
    Good use of a decorator to handle query execution and reduce code duplication.
  • Reasoning:
    The decorator cozo_query is used to wrap functions that return a tuple of a query string and a dictionary of variables. The decorator executes the query using the cozo_client and returns a DataFrame. This is a good practice as it reduces code duplication and makes the code cleaner.
2. agents-api/agents_api/models/agent/create_agent.py:8:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function create_agent_query in create_agent.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
3. agents-api/agents_api/models/agent/delete_agent.py:8:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function delete_agent_query in delete_agent.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
4. agents-api/agents_api/models/agent/get_agent.py:8:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function get_agent_query in get_agent.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
5. agents-api/agents_api/models/agent/list_agents.py:6:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function list_agents_query in list_agents.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
6. agents-api/agents_api/models/agent/patch_agent.py:7:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function patch_agent_query in patch_agent.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
7. agents-api/agents_api/models/agent/update_tool.py:4:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function update_tool_by_id_query in update_tool.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
8. agents-api/agents_api/models/docs/create_docs.py:8:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function create_docs_query in create_docs.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
9. agents-api/agents_api/models/docs/delete_docs.py:5:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function delete_docs_by_id_query in delete_docs.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
10. agents-api/agents_api/models/docs/embed_docs.py:8:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function embed_docs_snippets_query in embed_docs.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
11. agents-api/agents_api/models/docs/get_docs.py:8:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function get_docs_snippets_by_id_query in get_docs.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
12. agents-api/agents_api/models/docs/list_docs.py:5:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function ensure_owner_exists_query in list_docs.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
13. agents-api/agents_api/models/docs/search_docs.py:8:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function search_docs_snippets_by_embedding_query in search_docs.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
14. agents-api/agents_api/models/entry/delete_entries.py:5:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function delete_entries_query in delete_entries.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
15. agents-api/agents_api/models/entry/entries_summarization.py:8:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function entries_summarization_query in entries_summarization.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
16. agents-api/agents_api/models/entry/proc_mem_context.py:8:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function proc_mem_context_query in proc_mem_context.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.
17. agents-api/agents_api/models/session/create_session.py:12:
  • Assessed confidence : 0%
  • Comment:
    The function now returns a tuple of a query string and a dictionary of variables, which is consistent with the use of the cozo_query decorator for query execution.
  • Reasoning:
    The function create_session_query in create_session.py has been refactored to return a tuple of a query string and a dictionary of variables instead of executing the query and returning a DataFrame. This is consistent with the changes made throughout the codebase to use the cozo_query decorator for query execution.

Workflow ID: wflow_CvXjbS9LaqzIzeEK


Not what you expected? You can customize the content of the reviews using rules. Learn more here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant