Skip to content

Fix/toolset warm up individual tools#10014

Closed
vblagoje wants to merge 3 commits into
mainfrom
fix/toolset-warm-up-individual-tools
Closed

Fix/toolset warm up individual tools#10014
vblagoje wants to merge 3 commits into
mainfrom
fix/toolset-warm-up-individual-tools

Conversation

@vblagoje

@vblagoje vblagoje commented Nov 5, 2025

Copy link
Copy Markdown
Member

test CI run, don't touch

Related Issues:

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

* Addresses bug discovered during implementation of PR #9942 for issue #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 #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
Addresses architectural feedback - moved iteration logic from warm_up_tools()
to base Toolset.warm_up() for better encapsulation. Subclasses can now
override warm_up() to customize initialization without breaking the contract.

- Toolset.warm_up() now iterates and warms tools by default
- warm_up_tools() simplified to delegate to warm_up()
- Updated tests and release notes
@vercel

vercel Bot commented Nov 5, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
haystack-docs Ignored Ignored Preview Nov 5, 2025 8:46am

@github-actions github-actions Bot added topic:tests type:documentation Improvements on the docs labels Nov 5, 2025
@coveralls

Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 19096281390

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 14 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.02%) to 92.229%

Files with Coverage Reduction New Missed Lines %
core/pipeline/async_pipeline.py 3 65.88%
tools/toolset.py 11 84.71%
Totals Coverage Status
Change from base Build 19078717113: -0.02%
Covered Lines: 13506
Relevant Lines: 14644

💛 - Coveralls

@vblagoje vblagoje closed this Nov 5, 2025
@sjrl sjrl deleted the fix/toolset-warm-up-individual-tools branch March 20, 2026 09:12
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