Skip to content

fix: Fix invoker to work when using dataclass with from_dict but dataclass… #9434

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

sjrl
Copy link
Contributor

@sjrl sjrl commented May 23, 2025

Related Issues

  • fixes #issue-number

Proposed Changes:

Fix invoker to work when using dataclass with from_dict but dataclas is already given

Updated the component_invoker method to allow fully formed dataclass objects to pass through. Otherwise we silently remove the parameter value.

Originally found by @bilgeyucel when creating an tool using Agent + ComponentTool and calling

agent_tool.invoke(messages=[ChatMessage.from_user("Tell me the latest news about gpus")])

How did you test it?

Notes for the reviewer

Checklist

  • I have read the contributors guidelines and the code of conduct
  • I have updated the related issue with new insights and changes
  • I added unit tests and updated the docstrings
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes.
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

@sjrl sjrl requested a review from bilgeyucel May 23, 2025 12:32
@coveralls
Copy link
Collaborator

coveralls commented May 23, 2025

Pull Request Test Coverage Report for Build 15210934031

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 26 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.03%) to 90.056%

Files with Coverage Reduction New Missed Lines %
core/pipeline/async_pipeline.py 3 67.32%
tools/component_tool.py 7 92.39%
core/pipeline/base.py 16 93.51%
Totals Coverage Status
Change from base Build 15210166613: -0.03%
Covered Lines: 11338
Relevant Lines: 12590

💛 - Coveralls

@sjrl sjrl self-assigned this May 23, 2025
@sjrl sjrl marked this pull request as ready for review May 23, 2025 12:42
@sjrl sjrl requested review from a team as code owners May 23, 2025 12:42
@sjrl sjrl requested review from dfokina, anakin87 and vblagoje and removed request for a team May 23, 2025 12:42
@sjrl
Copy link
Contributor Author

sjrl commented May 23, 2025

@vblagoje I'd also appreciate your review on this since you worked on ComponentTool in the past

@github-actions github-actions bot added the type:documentation Improvements on the docs label May 23, 2025
Copy link
Member

@anakin87 anakin87 left a comment

Choose a reason for hiding this comment

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

Looks OK but I would like if @vblagoje can review too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic:tests type:documentation Improvements on the docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants