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

TLK-2090 tool errors processing #861

Merged

Conversation

EugeneLightsOn
Copy link
Collaborator

@EugeneLightsOn EugeneLightsOn commented Nov 29, 2024

Tools error processing
AI Description

This PR introduces a new ToolErrorException class in src/backend/tools/base.py and updates the tool.get_tool_error() function to handle this exception. The ToolErrorExceptionclass is imported intosrc/backend/chat/custom/tool_calls.pyand used to handle exceptions in the_call_tool_async()` function.

The PR also updates the ToolError class in src/backend/tools/base.pyto include adetails` attribute, which is used to provide additional information about the error. This change is reflected in various files throughout the codebase, including:

  • src/backend/tools/brave_search/tool.py
  • src/backend/tools/calculator.py
  • src/backend/tools/files.py
  • src/backend/tools/google_drive/tool.py
  • src/backend/tools/google_search.py
  • src/backend/tools/hybrid_search.py
  • src/backend/tools/lang_chain.py
  • src/backend/tools/python_interpreter.py
  • src/backend/tools/slack/tool.py
  • src/backend/tools/tavily_search.py
  • src/backend/tools/web_scrape.py
  • src/community/tools/arxiv.py
  • src/community/tools/clinicaltrials.py
  • src/community/tools/connector.py
  • src/community/tools/llama_index.py
  • src/community/tools/pub_med.py
  • src/community/tools/wolfram.py

Additionally, the PR updates the ToolError class to include a details attribute, which is used to provide additional information about the error. This change is reflected in various files throughout the codebase, including:

  • src/backend/tests/unit/tools/test_calculator.py

  • src/backend/tests/unit/tools/test_lang_chain.py

  • src/backend/tools/base.py is updated to include a new ToolErrorException class and a details attribute in the ToolError class.

  • src/backend/chat/custom/tool_calls.py is updated to handle the new ToolErrorException class.

  • src/backend/tools/brave_search/tool.py, src/backend/tools/calculator.py, src/backend/tools/files.py, src/backend/tools/google_drive/tool.py, src/backend/tools/google_search.py, src/backend/tools/hybrid_search.py, src/backend/tools/lang_chain.py, src/backend/tools/python_interpreter.py, src/backend/tools/slack/tool.py, src/backend/tools/tavily_search.py, src/backend/tools/web_scrape.py, src/community/tools/arxiv.py, src/community/tools/clinicaltrials.py, src/community/tools/connector.py, src/community/tools/llama_index.py, src/community/tools/pub_med.py, and src/community/tools/wolfram.py are updated to handle the new ToolError class and its details attribute.

  • src/backend/tests/unit/tools/test_calculator.py and src/backend/tests/unit/tools/test_lang_chain.py`` are updated to handle the new ToolErrorclass and itsdetails` attribute.

  • src/interfaces/assistants_web/src/components/MessageRow/ToolEvents.tsx is updated to handle the new ToolError class and its details attribute.

  • src/interfaces/assistants_web/src/hooks/use-chat.ts is updated to handle the new ToolError class and its details attribute.

@codecov-commenter
Copy link

codecov-commenter commented Nov 29, 2024

Codecov Report

Attention: Patch coverage is 15.49296% with 60 lines in your changes missing coverage. Please review.

Project coverage is 77.97%. Comparing base (925f3c2) to head (57c4840).

Files with missing lines Patch % Lines
src/backend/tools/lang_chain.py 26.31% 14 Missing ⚠️
src/backend/tools/google_drive/tool.py 0.00% 8 Missing ⚠️
src/backend/tools/python_interpreter.py 0.00% 8 Missing ⚠️
src/backend/tools/slack/tool.py 0.00% 8 Missing ⚠️
src/backend/tools/files.py 0.00% 6 Missing ⚠️
src/backend/tools/brave_search/tool.py 0.00% 5 Missing ⚠️
src/backend/tools/google_search.py 0.00% 5 Missing ⚠️
src/backend/tests/unit/tools/test_lang_chain.py 0.00% 2 Missing ⚠️
src/backend/tools/hybrid_search.py 0.00% 2 Missing ⚠️
src/backend/tools/base.py 66.66% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #861      +/-   ##
==========================================
- Coverage   78.19%   77.97%   -0.23%     
==========================================
  Files         259      259              
  Lines       11090    11123      +33     
==========================================
+ Hits         8672     8673       +1     
- Misses       2418     2450      +32     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

…rrors-from-tool-errors

# Conflicts:
#	src/backend/tools/web_scrape.py
src/backend/services/chat.py Outdated Show resolved Hide resolved
src/backend/chat/custom/tool_calls.py Outdated Show resolved Hide resolved
src/backend/tools/files.py Outdated Show resolved Hide resolved
src/backend/tools/files.py Outdated Show resolved Hide resolved
src/backend/tools/files.py Outdated Show resolved Hide resolved
src/backend/tools/brave_search/tool.py Outdated Show resolved Hide resolved
…rrors-from-tool-errors

# Conflicts:
#	src/backend/tools/base.py
#	src/backend/tools/google_search.py
Copy link
Collaborator

@tianjing-li tianjing-li left a comment

Choose a reason for hiding this comment

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

This is great, thank you!

@EugeneLightsOn EugeneLightsOn merged commit 320f6ef into main Dec 13, 2024
8 checks passed
@EugeneLightsOn EugeneLightsOn deleted the eugene/tlk-2090-generate-set-of-errors-from-tool-errors branch December 13, 2024 19:16
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.

3 participants