llama-stack-haystack 2.0.0__tar.gz → 3.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/CHANGELOG.md +25 -0
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/LICENSE.txt +1 -1
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/PKG-INFO +7 -5
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/README.md +2 -2
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/examples/llama-stack-with-tools.py +8 -14
- llama_stack_haystack-3.0.1/pydoc/config_docusaurus.yml +13 -0
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/pyproject.toml +21 -5
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/src/haystack_integrations/components/generators/llama_stack/chat/chat_generator.py +7 -4
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/tests/test_llama_stack_chat_generator.py +3 -3
- llama_stack_haystack-2.0.0/pydoc/config_docusaurus.yml +0 -28
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/.gitignore +0 -0
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/examples/chatgenerator_with_structured_outputs.py +0 -0
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/src/haystack_integrations/components/generators/llama_stack/__init__.py +0 -0
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/src/haystack_integrations/components/generators/llama_stack/chat/__init__.py +0 -0
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/src/haystack_integrations/components/generators/py.typed +0 -0
- {llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/tests/__init__.py +0 -0
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [integrations/llama_stack-v3.0.0] - 2026-02-03
|
|
4
|
+
|
|
5
|
+
### 🐛 Bug Fixes
|
|
6
|
+
|
|
7
|
+
- *(llama_stack)* Support llama-stack>=0.4.0 (#2805)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [integrations/llama_stack-v2.0.0] - 2026-01-12
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### ⚙️ CI
|
|
14
|
+
|
|
15
|
+
- Add reruns when running nightly tests if tests fail (#2584)
|
|
16
|
+
|
|
17
|
+
### 🧹 Chores
|
|
18
|
+
|
|
19
|
+
- Remove Readme API CI workflow and configs (#2573)
|
|
20
|
+
- Make fmt command more forgiving (#2671)
|
|
21
|
+
- Pin llama-stack; X|Y typing (#2715)
|
|
22
|
+
|
|
3
23
|
## [integrations/llama_stack-v1.3.0] - 2025-11-23
|
|
4
24
|
|
|
5
25
|
### 🚀 Features
|
|
6
26
|
|
|
7
27
|
- Support structured outputs in `LlamaStackChatGenerator` (#2535)
|
|
8
28
|
|
|
29
|
+
### ⚙️ CI
|
|
30
|
+
|
|
31
|
+
- Change pytest command (#2475)
|
|
32
|
+
- Add pytest reruns to nightly tests for flaky tests (#2486)
|
|
33
|
+
|
|
9
34
|
### 🌀 Miscellaneous
|
|
10
35
|
|
|
11
36
|
- Enhancement: Adopt PEP 585 type hinting (part 4) (#2527)
|
|
@@ -58,7 +58,7 @@ APPENDIX: How to apply the Apache License to your work.
|
|
|
58
58
|
|
|
59
59
|
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
|
60
60
|
|
|
61
|
-
Copyright
|
|
61
|
+
Copyright 2023-present deepset GmbH
|
|
62
62
|
|
|
63
63
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
64
64
|
you may not use this file except in compliance with the License.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: llama-stack-haystack
|
|
3
|
-
Version:
|
|
3
|
+
Version: 3.0.1
|
|
4
4
|
Summary: Use Llama Stack framework for text generation
|
|
5
5
|
Project-URL: Documentation, https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/llama-stack#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/deepset-ai/haystack-core-integrations/issues
|
|
@@ -13,17 +13,19 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
13
13
|
Classifier: Programming Language :: Python
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
16
18
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
17
19
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
18
20
|
Requires-Python: >=3.12
|
|
19
21
|
Requires-Dist: haystack-ai>=2.22.0
|
|
20
|
-
Requires-Dist: llama-stack
|
|
22
|
+
Requires-Dist: llama-stack>=0.4.0
|
|
21
23
|
Description-Content-Type: text/markdown
|
|
22
24
|
|
|
23
25
|
# llama-stack-haystack
|
|
24
26
|
|
|
25
27
|
[](https://pypi.org/project/llama-stack-haystack)
|
|
26
|
-
[](https://pypi.org/project/llama-stack-haystack)
|
|
28
|
+
[](https://pypi.org/project/llama-stack-haystack)
|
|
27
29
|
|
|
28
30
|
- [Integration page](https://haystack.deepset.ai/integrations/llama_stack)
|
|
29
31
|
- [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/llama_stack/CHANGELOG.md)
|
|
@@ -34,4 +36,4 @@ Description-Content-Type: text/markdown
|
|
|
34
36
|
|
|
35
37
|
Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).
|
|
36
38
|
|
|
37
|
-
To run integration tests locally, you need to run Ollama and the Llama Stack Server. Refer to the [workflow file](https://github.com/deepset-ai/haystack-core-integrations/blob/main/.github/workflows/llama_stack.yml) for more details.
|
|
39
|
+
To run integration tests locally, you need to run Ollama and the Llama Stack Server. Refer to the [workflow file](https://github.com/deepset-ai/haystack-core-integrations/blob/main/.github/workflows/llama_stack.yml) for more details.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# llama-stack-haystack
|
|
2
2
|
|
|
3
3
|
[](https://pypi.org/project/llama-stack-haystack)
|
|
4
|
-
[](https://pypi.org/project/llama-stack-haystack)
|
|
4
|
+
[](https://pypi.org/project/llama-stack-haystack)
|
|
5
5
|
|
|
6
6
|
- [Integration page](https://haystack.deepset.ai/integrations/llama_stack)
|
|
7
7
|
- [Changelog](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/llama_stack/CHANGELOG.md)
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
|
|
13
13
|
Refer to the general [Contribution Guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md).
|
|
14
14
|
|
|
15
|
-
To run integration tests locally, you need to run Ollama and the Llama Stack Server. Refer to the [workflow file](https://github.com/deepset-ai/haystack-core-integrations/blob/main/.github/workflows/llama_stack.yml) for more details.
|
|
15
|
+
To run integration tests locally, you need to run Ollama and the Llama Stack Server. Refer to the [workflow file](https://github.com/deepset-ai/haystack-core-integrations/blob/main/.github/workflows/llama_stack.yml) for more details.
|
{llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/examples/llama-stack-with-tools.py
RENAMED
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
# set up Llama Stack Server through an inference provider and have a model available.
|
|
9
9
|
# For a quick start on how to setup server with Ollama, see [Llama Stack docs](https://llama-stack.readthedocs.io/en/latest/getting_started/index.html).
|
|
10
10
|
|
|
11
|
-
from haystack.components.
|
|
11
|
+
from haystack.components.agents import Agent
|
|
12
12
|
from haystack.dataclasses import ChatMessage
|
|
13
13
|
from haystack.tools import Tool
|
|
14
14
|
|
|
15
|
-
from .components.generators.llama_stack
|
|
15
|
+
from haystack_integrations.components.generators.llama_stack import LlamaStackChatGenerator
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
# Define a tool that models can call
|
|
@@ -30,20 +30,14 @@ weather_tool = Tool(
|
|
|
30
30
|
function=weather,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
# Create a tool invoker with the weather tool
|
|
34
|
-
tool_invoker = ToolInvoker(tools=[weather_tool])
|
|
35
|
-
|
|
36
33
|
client = LlamaStackChatGenerator(
|
|
37
34
|
model="ollama/llama3.2:3b", # model depends on the inference provider used for the Llama Stack Server.
|
|
38
|
-
api_base_url="http://localhost:8321/v1
|
|
35
|
+
api_base_url="http://localhost:8321/v1",
|
|
39
36
|
)
|
|
40
|
-
messages = [ChatMessage.from_user("What's the weather in Tokyo?")]
|
|
41
|
-
|
|
42
|
-
response = client.run(messages=messages, tools=[weather_tool])["replies"]
|
|
43
37
|
|
|
44
|
-
|
|
38
|
+
# The Agent calls the tool and feeds the result back to the model
|
|
39
|
+
agent = Agent(chat_generator=client, tools=[weather_tool])
|
|
40
|
+
result = agent.run(messages=[ChatMessage.from_user("What's the weather in Tokyo?")])
|
|
45
41
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
tool_messages = tool_invoker.run(messages=response)["tool_messages"]
|
|
49
|
-
print(f"tool messages: {tool_messages}") # noqa: T201
|
|
42
|
+
print(f"messages: {result['messages']}\n")
|
|
43
|
+
print(f"assistant final answer: {result['last_message'].text}")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
loaders:
|
|
2
|
+
- modules:
|
|
3
|
+
- haystack_integrations.components.generators.llama_stack.chat.chat_generator
|
|
4
|
+
search_path: [../src]
|
|
5
|
+
processors:
|
|
6
|
+
- type: filter
|
|
7
|
+
documented_only: true
|
|
8
|
+
skip_empty_modules: true
|
|
9
|
+
renderer:
|
|
10
|
+
description: Llama Stack integration for Haystack
|
|
11
|
+
id: integrations-llama-stack
|
|
12
|
+
filename: llama_stack.md
|
|
13
|
+
title: Llama Stack
|
|
@@ -17,10 +17,12 @@ classifiers = [
|
|
|
17
17
|
"Programming Language :: Python",
|
|
18
18
|
"Programming Language :: Python :: 3.12", # minimum supported version by llama-stack
|
|
19
19
|
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Programming Language :: Python :: 3.15",
|
|
20
22
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
21
23
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
22
24
|
]
|
|
23
|
-
dependencies = ["haystack-ai>=2.22.0", "llama-stack>=0.
|
|
25
|
+
dependencies = ["haystack-ai>=2.22.0", "llama-stack>=0.4.0"]
|
|
24
26
|
|
|
25
27
|
[project.urls]
|
|
26
28
|
Documentation = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/llama-stack#readme"
|
|
@@ -42,7 +44,7 @@ git_describe_command = 'git describe --tags --match="integrations/llama_stack-v[
|
|
|
42
44
|
installer = "uv"
|
|
43
45
|
dependencies = ["haystack-pydoc-tools", "ruff"]
|
|
44
46
|
[tool.hatch.envs.default.scripts]
|
|
45
|
-
docs = ["pydoc
|
|
47
|
+
docs = ["haystack-pydoc pydoc/config_docusaurus.yml"]
|
|
46
48
|
fmt = "ruff check --fix {args}; ruff format {args}"
|
|
47
49
|
fmt-check = "ruff check {args} && ruff format --check {args}"
|
|
48
50
|
|
|
@@ -61,7 +63,8 @@ dependencies = [
|
|
|
61
63
|
unit = 'pytest -m "not integration" {args:tests}'
|
|
62
64
|
integration = 'pytest -m "integration" {args:tests}'
|
|
63
65
|
all = 'pytest {args:tests}'
|
|
64
|
-
cov-retry = 'pytest --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x {args:tests}'
|
|
66
|
+
unit-cov-retry = 'pytest --cov=haystack_integrations --reruns 3 --reruns-delay 30 -x -m "not integration" {args:tests}'
|
|
67
|
+
integration-cov-append-retry = 'pytest --cov=haystack_integrations --cov-append --reruns 3 --reruns-delay 30 -x -m "integration" {args:tests}'
|
|
65
68
|
|
|
66
69
|
types = "mypy -p haystack_integrations.components.generators.llama_stack {args}"
|
|
67
70
|
|
|
@@ -73,15 +76,22 @@ disallow_incomplete_defs = true
|
|
|
73
76
|
|
|
74
77
|
|
|
75
78
|
[tool.ruff]
|
|
76
|
-
target-version = "py39"
|
|
77
79
|
line-length = 120
|
|
78
80
|
|
|
79
81
|
[tool.ruff.lint]
|
|
80
82
|
select = [
|
|
81
83
|
"A",
|
|
84
|
+
"ANN",
|
|
82
85
|
"ARG",
|
|
83
86
|
"B",
|
|
84
87
|
"C",
|
|
88
|
+
"D102", # Missing docstring in public method
|
|
89
|
+
"D103", # Missing docstring in public function
|
|
90
|
+
"D205", # 1 blank line required between summary line and description
|
|
91
|
+
"D209", # Closing triple quotes go to new line
|
|
92
|
+
"D213", # summary lines must be positioned on the second physical line of the docstring
|
|
93
|
+
"D417", # Missing argument descriptions in the docstring
|
|
94
|
+
"D419", # Docstring is empty
|
|
85
95
|
"DTZ",
|
|
86
96
|
"E",
|
|
87
97
|
"EM",
|
|
@@ -116,9 +126,12 @@ ignore = [
|
|
|
116
126
|
"PLR0912",
|
|
117
127
|
"PLR0913",
|
|
118
128
|
"PLR0915",
|
|
129
|
+
"PLR0917",
|
|
119
130
|
# Misc
|
|
120
131
|
"B008",
|
|
121
132
|
"S101",
|
|
133
|
+
# Allow `Any` - used legitimately for dynamic types and SDK boundaries
|
|
134
|
+
"ANN401",
|
|
122
135
|
]
|
|
123
136
|
unfixable = [
|
|
124
137
|
# Don't touch unused imports
|
|
@@ -133,11 +146,14 @@ ban-relative-imports = "parents"
|
|
|
133
146
|
|
|
134
147
|
[tool.ruff.lint.per-file-ignores]
|
|
135
148
|
# Tests can use magic values, assertions, and relative imports
|
|
136
|
-
"tests/**/*" = ["PLR2004", "S101", "TID252", "E501", "F841"]
|
|
149
|
+
"tests/**/*" = ["D", "PLR2004", "S101", "TID252", "ANN", "E501", "F841"]
|
|
150
|
+
# Examples can print their output and don't need type annotations
|
|
151
|
+
"examples/**/*" = ["T201", "ANN"]
|
|
137
152
|
|
|
138
153
|
[tool.coverage.run]
|
|
139
154
|
source = ["haystack_integrations"]
|
|
140
155
|
branch = true
|
|
156
|
+
relative_files = true
|
|
141
157
|
parallel = false
|
|
142
158
|
|
|
143
159
|
|
|
@@ -20,6 +20,7 @@ logger = logging.getLogger(__name__)
|
|
|
20
20
|
class LlamaStackChatGenerator(OpenAIChatGenerator):
|
|
21
21
|
"""
|
|
22
22
|
Enables text generation using Llama Stack framework.
|
|
23
|
+
|
|
23
24
|
Llama Stack Server supports multiple inference providers, including Ollama, Together,
|
|
24
25
|
and vLLM and other cloud providers.
|
|
25
26
|
For a complete list of inference providers, see [Llama Stack docs](https://llama-stack.readthedocs.io/en/latest/providers/inference/index.html).
|
|
@@ -59,7 +60,7 @@ class LlamaStackChatGenerator(OpenAIChatGenerator):
|
|
|
59
60
|
self,
|
|
60
61
|
*,
|
|
61
62
|
model: str,
|
|
62
|
-
api_base_url: str = "http://localhost:8321/v1
|
|
63
|
+
api_base_url: str = "http://localhost:8321/v1",
|
|
63
64
|
organization: str | None = None,
|
|
64
65
|
streaming_callback: StreamingCallbackT | None = None,
|
|
65
66
|
generation_kwargs: dict[str, Any] | None = None,
|
|
@@ -68,10 +69,12 @@ class LlamaStackChatGenerator(OpenAIChatGenerator):
|
|
|
68
69
|
tools_strict: bool = False,
|
|
69
70
|
max_retries: int | None = None,
|
|
70
71
|
http_client_kwargs: dict[str, Any] | None = None,
|
|
71
|
-
):
|
|
72
|
+
) -> None:
|
|
72
73
|
"""
|
|
73
|
-
Creates an instance of LlamaStackChatGenerator.
|
|
74
|
-
|
|
74
|
+
Creates an instance of LlamaStackChatGenerator.
|
|
75
|
+
|
|
76
|
+
To use this chat generator, you need to setup Llama Stack Server with an inference provider and have a model
|
|
77
|
+
available.
|
|
75
78
|
|
|
76
79
|
:param model:
|
|
77
80
|
The name of the model to use for chat completion.
|
{llama_stack_haystack-2.0.0 → llama_stack_haystack-3.0.1}/tests/test_llama_stack_chat_generator.py
RENAMED
|
@@ -105,7 +105,7 @@ class TestLlamaStackChatGenerator:
|
|
|
105
105
|
def test_init_default(self):
|
|
106
106
|
component = LlamaStackChatGenerator(model="ollama/llama3.2:3b")
|
|
107
107
|
assert component.model == "ollama/llama3.2:3b"
|
|
108
|
-
assert component.api_base_url == "http://localhost:8321/v1
|
|
108
|
+
assert component.api_base_url == "http://localhost:8321/v1"
|
|
109
109
|
assert component.streaming_callback is None
|
|
110
110
|
assert not component.generation_kwargs
|
|
111
111
|
|
|
@@ -134,7 +134,7 @@ class TestLlamaStackChatGenerator:
|
|
|
134
134
|
expected_params = {
|
|
135
135
|
"model": "ollama/llama3.2:3b",
|
|
136
136
|
"streaming_callback": None,
|
|
137
|
-
"api_base_url": "http://localhost:8321/v1
|
|
137
|
+
"api_base_url": "http://localhost:8321/v1",
|
|
138
138
|
"generation_kwargs": {},
|
|
139
139
|
"timeout": None,
|
|
140
140
|
"max_retries": None,
|
|
@@ -492,6 +492,6 @@ class TestLlamaStackChatGenerator:
|
|
|
492
492
|
assert len(results["replies"]) == 1
|
|
493
493
|
message: ChatMessage = results["replies"][0]
|
|
494
494
|
msg = json.loads(message.text)
|
|
495
|
-
assert "
|
|
495
|
+
assert "marketing summit" in msg["event_name"].lower()
|
|
496
496
|
assert isinstance(msg["event_date"], str)
|
|
497
497
|
assert isinstance(msg["event_location"], str)
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
loaders:
|
|
2
|
-
- ignore_when_discovered:
|
|
3
|
-
- __init__
|
|
4
|
-
modules:
|
|
5
|
-
- haystack_integrations.components.generators.llama_stack.chat.chat_generator
|
|
6
|
-
search_path:
|
|
7
|
-
- ../src
|
|
8
|
-
type: haystack_pydoc_tools.loaders.CustomPythonLoader
|
|
9
|
-
processors:
|
|
10
|
-
- do_not_filter_modules: false
|
|
11
|
-
documented_only: true
|
|
12
|
-
expression: null
|
|
13
|
-
skip_empty_modules: true
|
|
14
|
-
type: filter
|
|
15
|
-
- type: smart
|
|
16
|
-
- type: crossref
|
|
17
|
-
renderer:
|
|
18
|
-
description: Llama Stack integration for Haystack
|
|
19
|
-
id: integrations-llama-stack
|
|
20
|
-
markdown:
|
|
21
|
-
add_member_class_prefix: false
|
|
22
|
-
add_method_class_prefix: true
|
|
23
|
-
classdef_code_block: false
|
|
24
|
-
descriptive_class_title: false
|
|
25
|
-
descriptive_module_title: true
|
|
26
|
-
filename: llama_stack.md
|
|
27
|
-
title: Llama Stack
|
|
28
|
-
type: haystack_pydoc_tools.renderers.DocusaurusRenderer
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|