-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: Add warm_up() method to ChatGenerators for tool initialization #9942
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
Merged
vblagoje
merged 6 commits into
deepset-ai:main
from
HamidOna:feature/add-warm-up-to-chat-generators
Oct 29, 2025
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bcb3ade
Add warm_up() method to OpenAIChatGenerator
HamidOna13 da59ca0
Add warm_up() method to AzureOpenAIChatGenerator
HamidOna13 b1aa6f5
Add warm_up() method to HuggingFaceAPIChatGenerator
HamidOna13 c3d300b
Enhance warm_up() method in HuggingFaceLocalChatGenerator
HamidOna13 50c6689
Add warm_up() method to FallbackChatGenerator
HamidOna13 9ca93ec
docs: Add release notes for warm_up() feature
HamidOna13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
releasenotes/notes/add-warm-up-to-chat-generators-cb0fa9429d721074.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| features: | ||
| - | | ||
| Added warm_up() method to all ChatGenerator components (OpenAIChatGenerator, | ||
| AzureOpenAIChatGenerator, HuggingFaceAPIChatGenerator, HuggingFaceLocalChatGenerator, | ||
| and FallbackChatGenerator) to properly initialize tools that require warm-up before | ||
| pipeline execution. The warm_up() method is idempotent and follows the same pattern | ||
| used in Agent and ToolInvoker components. This enables proper tool initialization | ||
| in pipelines that use ChatGenerators with tools but without an Agent component. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah @HamidOna do we need this one as its parent already implements the warm_up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, Azure needs both the flag initialization and the warm_up() method because:
Azure does not call super().init() - See line 73 and the comment on lines 152-53. It explicitly skips the parent's initialization because it only needs to instantiate the Azure-specific client.
Since Azure's init() doesn't call the parent's init():
The warm_up() method implementation is identical to OpenAI's, so technically we could remove Azure's warm_up() method and let it inherit from OpenAI (since the flag is now initialized). However, It makes sense to keep both for explicitness. Let me know if you'd prefer I remove the warm_up() method from Azure and just keep the flag initialization!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, right this is a tension between DRY and explicitness you advocate. We could simply add:
self._is_warmed_up = Falsein Azure init and be done with it. Let me ask my colleague @sjrl for an opinion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather reimplemt the warm up method so it's more explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thanks @sjrl then we are gtg here @HamidOna
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏 @HamidOna keep these PRs coming. Great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@HamidOna you can, if you want, also add this method to all Chat Generators in https://github.com/deepset-ai/haystack-core-integrations/ Just lmk