Skip to content

Commit 0d93230

Browse files
authored
Send X-LlamaStack-Client-Version header (#76)
As the title says. See llamastack/llama-stack#735 for the corresponding PR
1 parent eedbf51 commit 0d93230

File tree

116 files changed

+1475
-348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1475
-348
lines changed

src/llama_stack_client/_client.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2-
from __future__ import annotations
32

43
import json
4+
from __future__ import annotations
5+
56
import os
67
from typing import Any, Union, Mapping
78
from typing_extensions import Self, override
@@ -130,7 +131,10 @@ def __init__(
130131
if provider_data is not None:
131132
if default_headers is None:
132133
default_headers = {}
133-
default_headers["X-LlamaStack-ProviderData"] = json.dumps(provider_data)
134+
default_headers.update({
135+
"X-LlamaStack-Provider-Data": json.dumps(provider_data),
136+
"X-LlamaStack-Client-Version": __version__
137+
})
134138

135139
super().__init__(
136140
version=__version__,
@@ -327,7 +331,10 @@ def __init__(
327331
if provider_data is not None:
328332
if default_headers is None:
329333
default_headers = {}
330-
default_headers["X-LlamaStack-ProviderData"] = json.dumps(provider_data)
334+
default_headers.update({
335+
"X-LlamaStack-Provider-Data": json.dumps(provider_data),
336+
"X-LlamaStack-Client-Version": __version__
337+
})
331338

332339
super().__init__(
333340
version=__version__,

src/llama_stack_client/resources/agents/agents.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def create(
8686
self,
8787
*,
8888
agent_config: AgentConfig,
89+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
8990
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
9091
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
9192
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -105,7 +106,12 @@ def create(
105106
timeout: Override the client-level default timeout for this request, in seconds
106107
"""
107108
extra_headers = {
108-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
109+
**strip_not_given(
110+
{
111+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
112+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
113+
}
114+
),
109115
**(extra_headers or {}),
110116
}
111117
return self._post(
@@ -121,6 +127,7 @@ def delete(
121127
self,
122128
*,
123129
agent_id: str,
130+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
124131
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
125132
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
126133
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -141,7 +148,12 @@ def delete(
141148
"""
142149
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
143150
extra_headers = {
144-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
151+
**strip_not_given(
152+
{
153+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
154+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
155+
}
156+
),
145157
**(extra_headers or {}),
146158
}
147159
return self._post(
@@ -190,6 +202,7 @@ async def create(
190202
self,
191203
*,
192204
agent_config: AgentConfig,
205+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
193206
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
194207
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
195208
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -209,7 +222,12 @@ async def create(
209222
timeout: Override the client-level default timeout for this request, in seconds
210223
"""
211224
extra_headers = {
212-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
225+
**strip_not_given(
226+
{
227+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
228+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
229+
}
230+
),
213231
**(extra_headers or {}),
214232
}
215233
return await self._post(
@@ -225,6 +243,7 @@ async def delete(
225243
self,
226244
*,
227245
agent_id: str,
246+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
228247
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
229248
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
230249
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -245,7 +264,12 @@ async def delete(
245264
"""
246265
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
247266
extra_headers = {
248-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
267+
**strip_not_given(
268+
{
269+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
270+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
271+
}
272+
),
249273
**(extra_headers or {}),
250274
}
251275
return await self._post(

src/llama_stack_client/resources/agents/session.py

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def create(
5353
*,
5454
agent_id: str,
5555
session_name: str,
56+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
5657
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
5758
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5859
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -72,7 +73,12 @@ def create(
7273
timeout: Override the client-level default timeout for this request, in seconds
7374
"""
7475
extra_headers = {
75-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
76+
**strip_not_given(
77+
{
78+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
79+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
80+
}
81+
),
7682
**(extra_headers or {}),
7783
}
7884
return self._post(
@@ -96,6 +102,7 @@ def retrieve(
96102
agent_id: str,
97103
session_id: str,
98104
turn_ids: List[str] | NotGiven = NOT_GIVEN,
105+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
99106
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
100107
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
101108
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -115,7 +122,12 @@ def retrieve(
115122
timeout: Override the client-level default timeout for this request, in seconds
116123
"""
117124
extra_headers = {
118-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
125+
**strip_not_given(
126+
{
127+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
128+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
129+
}
130+
),
119131
**(extra_headers or {}),
120132
}
121133
return self._post(
@@ -142,6 +154,7 @@ def delete(
142154
*,
143155
agent_id: str,
144156
session_id: str,
157+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
145158
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
146159
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
147160
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -162,7 +175,12 @@ def delete(
162175
"""
163176
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
164177
extra_headers = {
165-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
178+
**strip_not_given(
179+
{
180+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
181+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
182+
}
183+
),
166184
**(extra_headers or {}),
167185
}
168186
return self._post(
@@ -206,6 +224,7 @@ async def create(
206224
*,
207225
agent_id: str,
208226
session_name: str,
227+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
209228
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
210229
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
211230
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -225,7 +244,12 @@ async def create(
225244
timeout: Override the client-level default timeout for this request, in seconds
226245
"""
227246
extra_headers = {
228-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
247+
**strip_not_given(
248+
{
249+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
250+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
251+
}
252+
),
229253
**(extra_headers or {}),
230254
}
231255
return await self._post(
@@ -249,6 +273,7 @@ async def retrieve(
249273
agent_id: str,
250274
session_id: str,
251275
turn_ids: List[str] | NotGiven = NOT_GIVEN,
276+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
252277
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
253278
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
254279
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -268,7 +293,12 @@ async def retrieve(
268293
timeout: Override the client-level default timeout for this request, in seconds
269294
"""
270295
extra_headers = {
271-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
296+
**strip_not_given(
297+
{
298+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
299+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
300+
}
301+
),
272302
**(extra_headers or {}),
273303
}
274304
return await self._post(
@@ -295,6 +325,7 @@ async def delete(
295325
*,
296326
agent_id: str,
297327
session_id: str,
328+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
298329
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
299330
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
300331
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -315,7 +346,12 @@ async def delete(
315346
"""
316347
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
317348
extra_headers = {
318-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
349+
**strip_not_given(
350+
{
351+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
352+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
353+
}
354+
),
319355
**(extra_headers or {}),
320356
}
321357
return await self._post(

src/llama_stack_client/resources/agents/steps.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def retrieve(
5252
session_id: str,
5353
step_id: str,
5454
turn_id: str,
55+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
5556
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
5657
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5758
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -71,7 +72,12 @@ def retrieve(
7172
timeout: Override the client-level default timeout for this request, in seconds
7273
"""
7374
extra_headers = {
74-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
75+
**strip_not_given(
76+
{
77+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
78+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
79+
}
80+
),
7581
**(extra_headers or {}),
7682
}
7783
return self._get(
@@ -122,6 +128,7 @@ async def retrieve(
122128
session_id: str,
123129
step_id: str,
124130
turn_id: str,
131+
x_llama_stack_client_version: str | NotGiven = NOT_GIVEN,
125132
x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN,
126133
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
127134
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -141,7 +148,12 @@ async def retrieve(
141148
timeout: Override the client-level default timeout for this request, in seconds
142149
"""
143150
extra_headers = {
144-
**strip_not_given({"X-LlamaStack-ProviderData": x_llama_stack_provider_data}),
151+
**strip_not_given(
152+
{
153+
"X-LlamaStack-Client-Version": x_llama_stack_client_version,
154+
"X-LlamaStack-Provider-Data": x_llama_stack_provider_data,
155+
}
156+
),
145157
**(extra_headers or {}),
146158
}
147159
return await self._get(

0 commit comments

Comments
 (0)