Skip to content

Conversation

@HamidOna
Copy link
Contributor

@HamidOna HamidOna commented Nov 1, 2025

Related Issues:

Proposed Changes:

The warm_up_tools() utility function was only calling warm_up() on Toolset objects themselves, but not on the individual Tool instances contained within them. This meant tools inside a Toolset were not properly initialized before use. This PR modifies warm_up_tools() to iterate through Toolsets and call warm_up() on each individual tool, in addition to calling warm_up() on the Toolset itself.

Changes:

  • Modified warm_up_tools() in haystack/tools/utils.py to iterate through
    Toolsets when encountered (both as single argument and within lists)
  • Added iteration to call warm_up() on each individual Tool inside Toolsets
  • Added comprehensive test class TestWarmUpTools with 7 test cases

How did you test it:

  • Added 7 comprehensive unit tests in test/tools/test_tools_utils.py:
    • test_warm_up_tools_with_none - handles None input
    • test_warm_up_tools_with_single_tool - single tool in list
    • test_warm_up_tools_with_single_toolset - KEY TEST: verifies both
      Toolset and individual tools are warmed
    • test_warm_up_tools_with_list_containing_toolset - toolset within list
    • test_warm_up_tools_with_multiple_toolsets - multiple toolsets
    • test_warm_up_tools_with_mixed_tools_and_toolsets - mixed scenarios
    • test_warm_up_tools_idempotency - safe to call multiple times

Notes for the reviewer:

I discovered this bug while implementing PR #9942 (for issue #9907). When a Toolset object is passed to a component's tools parameter, the warm_up_tools() function only calls Toolset.warm_up(), which is a no-op. It doesn't iterate through the individual tools inside the Toolset to warm them up.

Acknowledged by @vblagoje and @sjrl

This implementation:

  • Modified warm_up_tools() to iterate through Toolsets and call warm_up() on each individual tool
  • Added comprehensive tests for Toolset warming behavior
  • Verified both the Toolset and its contained tools are warmed up

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:
  • I documented my code
  • I ran pre-commit hooks and fixed any issue

Related Issues:

* Follows up on PR deepset-ai#9942 (feat: Add warm_up() method to ChatGenerators)

* Addresses bug discovered during implementation of PR deepset-ai#9942 for issue deepset-ai#9907

Proposed Changes:

The warm_up_tools() utility function was only calling warm_up() on

Toolset objects themselves, but not on the individual Tool instances

contained within them. This meant tools inside a Toolset were not

properly initialized before use.

This PR modifies warm_up_tools() to iterate through Toolsets and call

warm_up() on each individual tool, in addition to calling warm_up() on

the Toolset itself.

Changes:

- Modified warm_up_tools() in haystack/tools/utils.py to iterate through

  Toolsets when encountered (both as single argument and within lists)

- Added iteration to call warm_up() on each individual Tool inside Toolsets

- Added comprehensive test class TestWarmUpTools with 7 test cases

How did you test it:

- Added 7 comprehensive unit tests in test/tools/test_tools_utils.py:

  * test_warm_up_tools_with_none - handles None input

  * test_warm_up_tools_with_single_tool - single tool in list

  * test_warm_up_tools_with_single_toolset - KEY TEST: verifies both

    Toolset and individual tools are warmed

  * test_warm_up_tools_with_list_containing_toolset - toolset within list

  * test_warm_up_tools_with_multiple_toolsets - multiple toolsets

  * test_warm_up_tools_with_mixed_tools_and_toolsets - mixed scenarios

  * test_warm_up_tools_idempotency - safe to call multiple times

Notes for the reviewer:

I discovered this bug while implementing PR deepset-ai#9942 (for issue deepset-ai#9907).

When a Toolset object is passed to a component's tools parameter, the

warm_up_tools() function only calls Toolset.warm_up(), which is a no-op.

It doesn't iterate through the individual tools inside the Toolset to

warm them up.

 acknowledged by @vblagoje and @sjrl

This implementation:

- Modified warm_up_tools() to iterate through Toolsets and call warm_up() on each individual tool

 - Added comprehensive tests for Toolset warming behavior

- Verified both the Toolset and its contained tools are warmed up

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:

I documented my code

I ran pre-commit hooks and fixed any issue
@HamidOna HamidOna requested a review from a team as a code owner November 1, 2025 02:56
@HamidOna HamidOna requested review from Amnah199 and removed request for a team November 1, 2025 02:56
@vercel
Copy link

vercel bot commented Nov 1, 2025

@HamidOna13 is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@coveralls
Copy link
Collaborator

coveralls commented Nov 1, 2025

Pull Request Test Coverage Report for Build 18990344825

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.004%) to 92.248%

Totals Coverage Status
Change from base Build 18976263337: 0.004%
Covered Lines: 13507
Relevant Lines: 14642

💛 - Coveralls

@vblagoje
Copy link
Member

vblagoje commented Nov 1, 2025

@Amnah199 let me take this one

@vblagoje vblagoje self-requested a review November 1, 2025 08:03
@sjrl sjrl removed the request for review from Amnah199 November 3, 2025 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants