Skip to content

Conversation

@vblagoje
Copy link
Member

Why:

Adopts Haystack's ToolsType to enable flexible tool composition, developers can now mix individual Tool objects and Toolset instances in a single list

part of:

What:

  • Updated tools parameter from Union[List[Tool], Toolset] to ToolsType in constructor
  • Replaced manual tool handling with Haystack's built-in ToolsType support
  • Haystack dependency to 2.19.0 for ToolsType support
  • Added tests for mixed tool collection initialization and request parameter formatting

How can it be used:

from haystack.tools import Tool, Toolset
from haystack_integrations.components.generators.llama_stack import LlamaStackChatGenerator

weather_tool = Tool(name="weather", ...)
population_toolset = Toolset([...])

# NEW: Mix Tool and Toolset freely
generator = LlamaStackChatGenerator(tools=[weather_tool, population_toolset])

How did you test it:

  • Unit tests verify mixed tool initialization and correct parameter handling
  • Backward compatibility validated for existing patterns (list of tools, single toolset)

Notes for the reviewer:

  • Centralizes tool normalization logic with Haystack's ToolsType—eliminates duplicate handling code
  • Fully backward compatible; no migration needed
  • Added integration test test_live_run_with_mixed_tools() demonstrates end-to-end LLM tool invocation from mixed collections

@vblagoje vblagoje requested a review from a team as a code owner October 22, 2025 12:06
@vblagoje vblagoje requested review from anakin87 and removed request for a team October 22, 2025 12:06
@github-actions github-actions bot added integration:llama_stack type:documentation Improvements or additions to documentation labels Oct 22, 2025
@vblagoje vblagoje marked this pull request as draft October 22, 2025 12:14
@vblagoje vblagoje marked this pull request as ready for review October 23, 2025 16:10
@vblagoje
Copy link
Member Author

vblagoje commented Oct 23, 2025

Ok after a lot of small fixes - this one should be ready now @anakin87
I think a lot has changed since the last PR, the build for llama stack is now run. And the model naming is different. Perhaps you'd know more about these 🙏

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 good from the ToolsType point of view.

However, I'd appreciate it if @Amnah199 could take a look at other changes, since she is more familiar with this integration.

curl -f http://localhost:8321/v1/models || { cat server.log; exit 1; }
echo "Llama Stack Server started successfully."
set -euo pipefail
Copy link
Member

Choose a reason for hiding this comment

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

@Amnah199 please take a look

Copy link
Member Author

@vblagoje vblagoje Oct 24, 2025

Choose a reason for hiding this comment

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

So what was happening is this look at the date stamp - 2 days ago. And it seems like llama stack doesn't have build command any more. So I switched to run command because that one made sense. Using run made a difference and the server started properly.

Then I faced this issue of names. Tests would fail saying there is no such model. I then switched to full naming schema and then everything started to work. cc @anakin87 @Amnah199

def test_init_default(self):
component = LlamaStackChatGenerator(model="llama3.2:3b")
assert component.model == "llama3.2:3b"
component = LlamaStackChatGenerator(model="ollama/llama3.2:3b")
Copy link
Member

Choose a reason for hiding this comment

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

Why are we changing the way we pass the model name? Is it necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems to be - it was failing for the "llama3.2:3b". I looked at the CI run, the model was booted and ready. Then I tried this naming schema and it worked

@vblagoje
Copy link
Member Author

vblagoje commented Oct 24, 2025

Looks good from the ToolsType point of view.

However, I'd appreciate it if @Amnah199 could take a look at other changes, since she is more familiar with this integration.

Yes makes sense. @Amnah199 I spent half the day yesterday to get this integration up and running because the old llama stack build command doesn't work anymore. Then I somehow made it run with lamma stack run but the model wasn't recognized without full name. And then with full name it finally started to work.

@vblagoje vblagoje requested a review from anakin87 October 24, 2025 11:39
@vblagoje
Copy link
Member Author

Ah sorry @anakin87 I clicked by accident thinking it was Amna

@vblagoje vblagoje requested a review from Amnah199 October 24, 2025 11:40
@Amnah199
Copy link
Contributor

@vblagoje Thanks for the updates. When we created this integration, llama stack was still under development so they were making rapid breaking changes. Hence, all the trouble you had to go through.

@anakin87
Copy link
Member

If passing model="llama3.2:3b" is no longer supported, let's also change docstrings for this integration.
Then we would have to update docs and integration page.

@vblagoje
Copy link
Member Author

Ok I'll update the pydocs now as well. 🙏 @anakin87

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.

👍

Please also open a PR to update https://haystack.deepset.ai/integrations/llama_stack

For some reason, docs are already correct.

@vblagoje vblagoje merged commit a2a2ceb into main Oct 24, 2025
7 checks passed
@vblagoje vblagoje deleted the llama_stack-toolstype branch October 24, 2025 14:49
@vblagoje
Copy link
Member Author

👍

Please also open a PR to update https://haystack.deepset.ai/integrations/llama_stack

For some reason, docs are already correct.

That's crazy, premonition of a change! We were correct about their naming scheme even before them

@vblagoje
Copy link
Member Author

We need to verify and merge deepset-ai/haystack-integrations#368 cc @bilgeyucel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:llama_stack topic:CI type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants