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

fix: Error handling in loading components/features in Agent Component #5320

Merged
merged 3 commits into from
Dec 18, 2024

Conversation

edwinjosechittilappilly
Copy link
Collaborator

This pull request introduces logging and error handling improvements to the AgentComponent in the langflow package. The changes include adding logging for debugging purposes and handling exceptions more gracefully.

Key changes include:

Logging and Error Handling Improvements:

  • Added import statements for the logging module and logger from langflow.logging to the agent.py file. [1] [2]
  • Wrapped the retrieval of the language model in a try block and added logging for errors.
  • Wrapped the retrieval of chat history in a try block and added logging for errors.
  • Wrapped the addition of the current date tool in a try block and added logging for errors, changing the raised exception type from ValueError to TypeError.
  • Wrapped the setup of the agent in a try block and added logging for errors.

@github-actions github-actions bot added the bug Something isn't working label Dec 17, 2024
@edwinjosechittilappilly edwinjosechittilappilly marked this pull request as ready for review December 17, 2024 21:33
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Dec 17, 2024
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 17, 2024
Copy link

codspeed-hq bot commented Dec 17, 2024

CodSpeed Performance Report

Merging #5320 will improve performances by 10.44%

Comparing fix-errorhandling-agents-tools (2ba0ba3) with main (c3f36b6)

Summary

⚡ 1 improvements
✅ 14 untouched benchmarks

Benchmarks breakdown

Benchmark main fix-errorhandling-agents-tools Change
test_get_and_cache_all_types_dict 1.1 ms 1 ms +10.44%

@ogabrielluiz ogabrielluiz requested a review from Copilot December 18, 2024 01:23

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 8 changed files in this pull request and generated no comments.

Files not reviewed (7)
  • src/backend/base/langflow/initial_setup/starter_projects/Instagram Copywriter.json: Language not supported
  • src/backend/base/langflow/initial_setup/starter_projects/Market Research.json: Language not supported
  • src/backend/base/langflow/initial_setup/starter_projects/Research Agent.json: Language not supported
  • src/backend/base/langflow/initial_setup/starter_projects/SaaS Pricing.json: Language not supported
  • src/backend/base/langflow/initial_setup/starter_projects/Sequential Tasks Agents .json: Language not supported
  • src/backend/base/langflow/initial_setup/starter_projects/Simple Agent.json: Language not supported
  • src/backend/base/langflow/initial_setup/starter_projects/Travel Planning Agents.json: Language not supported
Comments suppressed due to low confidence (1)

src/backend/base/langflow/components/agents/agent.py:28

  • The error message should include the exception message for better debugging. Suggested change: msg = f"Error building {self.agent_llm} language model: {e}"
msg = f"Error building {self.agent_llm} language model"
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 18, 2024
@ogabrielluiz ogabrielluiz force-pushed the fix-errorhandling-agents-tools branch from 860f207 to 2ba0ba3 Compare December 18, 2024 01:25
@ogabrielluiz ogabrielluiz enabled auto-merge (squash) December 18, 2024 01:25
@github-actions github-actions bot added bug Something isn't working and removed bug Something isn't working labels Dec 18, 2024
@ogabrielluiz ogabrielluiz merged commit d31cb35 into main Dec 18, 2024
35 checks passed
@ogabrielluiz ogabrielluiz deleted the fix-errorhandling-agents-tools branch December 18, 2024 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants