Skip to content

Commit b89ff2d

Browse files
authored
Sync updates from stainless: a3a4573 (#249)
Syncing stainless changes as the title says. The repository is at: https://github.com/llamastack/llama-stack-client-python/ Please see #2 for the source of the changes. The commit hash in the PR title is the commit hash after the PR above landed in the source repository. > [!NOTE] > This repository will soon be deprecated. We will be moving source of truth to https://github.com/llamastack/llama-stack-client-python/
1 parent 29f75d0 commit b89ff2d

File tree

84 files changed

+934
-194
lines changed

Some content is hidden

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

84 files changed

+934
-194
lines changed

src/llama_stack_client/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
UnprocessableEntityError,
3737
APIResponseValidationError,
3838
)
39-
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
39+
from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
4040
from ._utils._logs import setup_logging as _setup_logging
4141

4242
from .lib.agents.agent import Agent
@@ -84,6 +84,7 @@
8484
"DEFAULT_CONNECTION_LIMITS",
8585
"DefaultHttpxClient",
8686
"DefaultAsyncHttpxClient",
87+
"DefaultAioHttpClient",
8788
]
8889

8990
if not _t.TYPE_CHECKING:

src/llama_stack_client/_base_client.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,24 @@ def __init__(self, **kwargs: Any) -> None:
12891289
super().__init__(**kwargs)
12901290

12911291

1292+
try:
1293+
import httpx_aiohttp
1294+
except ImportError:
1295+
1296+
class _DefaultAioHttpClient(httpx.AsyncClient):
1297+
def __init__(self, **_kwargs: Any) -> None:
1298+
raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra")
1299+
else:
1300+
1301+
class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
1302+
def __init__(self, **kwargs: Any) -> None:
1303+
kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
1304+
kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
1305+
kwargs.setdefault("follow_redirects", True)
1306+
1307+
super().__init__(**kwargs)
1308+
1309+
12921310
if TYPE_CHECKING:
12931311
DefaultAsyncHttpxClient = httpx.AsyncClient
12941312
"""An alias to `httpx.AsyncClient` that provides the same defaults that this SDK
@@ -1297,8 +1315,12 @@ def __init__(self, **kwargs: Any) -> None:
12971315
This is useful because overriding the `http_client` with your own instance of
12981316
`httpx.AsyncClient` will result in httpx's defaults being used, not ours.
12991317
"""
1318+
1319+
DefaultAioHttpClient = httpx.AsyncClient
1320+
"""An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`."""
13001321
else:
13011322
DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient
1323+
DefaultAioHttpClient = _DefaultAioHttpClient
13021324

13031325

13041326
class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):

src/llama_stack_client/_files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
3434
if not is_file_content(obj):
3535
prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
3636
raise RuntimeError(
37-
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/stainless-sdks/llama-stack-python/tree/main#file-uploads"
37+
f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/llamastack/llama-stack-client-python/tree/main#file-uploads"
3838
) from None
3939

4040

src/llama_stack_client/resources/agents/agents.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def with_raw_response(self) -> AgentsResourceWithRawResponse:
6565
This property can be used as a prefix for any HTTP method call to return
6666
the raw response object instead of the parsed content.
6767
68-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
68+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
6969
"""
7070
return AgentsResourceWithRawResponse(self)
7171

@@ -74,7 +74,7 @@ def with_streaming_response(self) -> AgentsResourceWithStreamingResponse:
7474
"""
7575
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
7676
77-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
77+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
7878
"""
7979
return AgentsResourceWithStreamingResponse(self)
8080

@@ -166,7 +166,7 @@ def with_raw_response(self) -> AsyncAgentsResourceWithRawResponse:
166166
This property can be used as a prefix for any HTTP method call to return
167167
the raw response object instead of the parsed content.
168168
169-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
169+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
170170
"""
171171
return AsyncAgentsResourceWithRawResponse(self)
172172

@@ -175,7 +175,7 @@ def with_streaming_response(self) -> AsyncAgentsResourceWithStreamingResponse:
175175
"""
176176
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
177177
178-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
178+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
179179
"""
180180
return AsyncAgentsResourceWithStreamingResponse(self)
181181

src/llama_stack_client/resources/agents/session.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def with_raw_response(self) -> SessionResourceWithRawResponse:
3131
This property can be used as a prefix for any HTTP method call to return
3232
the raw response object instead of the parsed content.
3333
34-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
34+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
3535
"""
3636
return SessionResourceWithRawResponse(self)
3737

@@ -40,7 +40,7 @@ def with_streaming_response(self) -> SessionResourceWithStreamingResponse:
4040
"""
4141
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
4242
43-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
43+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
4444
"""
4545
return SessionResourceWithStreamingResponse(self)
4646

@@ -169,7 +169,7 @@ def with_raw_response(self) -> AsyncSessionResourceWithRawResponse:
169169
This property can be used as a prefix for any HTTP method call to return
170170
the raw response object instead of the parsed content.
171171
172-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
172+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
173173
"""
174174
return AsyncSessionResourceWithRawResponse(self)
175175

@@ -178,7 +178,7 @@ def with_streaming_response(self) -> AsyncSessionResourceWithStreamingResponse:
178178
"""
179179
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
180180
181-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
181+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
182182
"""
183183
return AsyncSessionResourceWithStreamingResponse(self)
184184

src/llama_stack_client/resources/agents/steps.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def with_raw_response(self) -> StepsResourceWithRawResponse:
2626
This property can be used as a prefix for any HTTP method call to return
2727
the raw response object instead of the parsed content.
2828
29-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
29+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
3030
"""
3131
return StepsResourceWithRawResponse(self)
3232

@@ -35,7 +35,7 @@ def with_streaming_response(self) -> StepsResourceWithStreamingResponse:
3535
"""
3636
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
3737
38-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
38+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
3939
"""
4040
return StepsResourceWithStreamingResponse(self)
4141

@@ -89,7 +89,7 @@ def with_raw_response(self) -> AsyncStepsResourceWithRawResponse:
8989
This property can be used as a prefix for any HTTP method call to return
9090
the raw response object instead of the parsed content.
9191
92-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
92+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
9393
"""
9494
return AsyncStepsResourceWithRawResponse(self)
9595

@@ -98,7 +98,7 @@ def with_streaming_response(self) -> AsyncStepsResourceWithStreamingResponse:
9898
"""
9999
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
100100
101-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
101+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
102102
"""
103103
return AsyncStepsResourceWithStreamingResponse(self)
104104

src/llama_stack_client/resources/agents/turn.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def with_raw_response(self) -> TurnResourceWithRawResponse:
3434
This property can be used as a prefix for any HTTP method call to return
3535
the raw response object instead of the parsed content.
3636
37-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
37+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
3838
"""
3939
return TurnResourceWithRawResponse(self)
4040

@@ -43,7 +43,7 @@ def with_streaming_response(self) -> TurnResourceWithStreamingResponse:
4343
"""
4444
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
4545
46-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
46+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
4747
"""
4848
return TurnResourceWithStreamingResponse(self)
4949

@@ -428,7 +428,7 @@ def with_raw_response(self) -> AsyncTurnResourceWithRawResponse:
428428
This property can be used as a prefix for any HTTP method call to return
429429
the raw response object instead of the parsed content.
430430
431-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
431+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
432432
"""
433433
return AsyncTurnResourceWithRawResponse(self)
434434

@@ -437,7 +437,7 @@ def with_streaming_response(self) -> AsyncTurnResourceWithStreamingResponse:
437437
"""
438438
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
439439
440-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
440+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
441441
"""
442442
return AsyncTurnResourceWithStreamingResponse(self)
443443

src/llama_stack_client/resources/benchmarks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def with_raw_response(self) -> BenchmarksResourceWithRawResponse:
3232
This property can be used as a prefix for any HTTP method call to return
3333
the raw response object instead of the parsed content.
3434
35-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
35+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
3636
"""
3737
return BenchmarksResourceWithRawResponse(self)
3838

@@ -41,7 +41,7 @@ def with_streaming_response(self) -> BenchmarksResourceWithStreamingResponse:
4141
"""
4242
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
4343
44-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
44+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
4545
"""
4646
return BenchmarksResourceWithStreamingResponse(self)
4747

@@ -169,7 +169,7 @@ def with_raw_response(self) -> AsyncBenchmarksResourceWithRawResponse:
169169
This property can be used as a prefix for any HTTP method call to return
170170
the raw response object instead of the parsed content.
171171
172-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
172+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
173173
"""
174174
return AsyncBenchmarksResourceWithRawResponse(self)
175175

@@ -178,7 +178,7 @@ def with_streaming_response(self) -> AsyncBenchmarksResourceWithStreamingRespons
178178
"""
179179
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
180180
181-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
181+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
182182
"""
183183
return AsyncBenchmarksResourceWithStreamingResponse(self)
184184

src/llama_stack_client/resources/chat/chat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def with_raw_response(self) -> ChatResourceWithRawResponse:
2727
This property can be used as a prefix for any HTTP method call to return
2828
the raw response object instead of the parsed content.
2929
30-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
30+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
3131
"""
3232
return ChatResourceWithRawResponse(self)
3333

@@ -36,7 +36,7 @@ def with_streaming_response(self) -> ChatResourceWithStreamingResponse:
3636
"""
3737
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
3838
39-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
39+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
4040
"""
4141
return ChatResourceWithStreamingResponse(self)
4242

@@ -52,7 +52,7 @@ def with_raw_response(self) -> AsyncChatResourceWithRawResponse:
5252
This property can be used as a prefix for any HTTP method call to return
5353
the raw response object instead of the parsed content.
5454
55-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
55+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
5656
"""
5757
return AsyncChatResourceWithRawResponse(self)
5858

@@ -61,7 +61,7 @@ def with_streaming_response(self) -> AsyncChatResourceWithStreamingResponse:
6161
"""
6262
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
6363
64-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
64+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
6565
"""
6666
return AsyncChatResourceWithStreamingResponse(self)
6767

src/llama_stack_client/resources/chat/completions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def with_raw_response(self) -> CompletionsResourceWithRawResponse:
3535
This property can be used as a prefix for any HTTP method call to return
3636
the raw response object instead of the parsed content.
3737
38-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
38+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
3939
"""
4040
return CompletionsResourceWithRawResponse(self)
4141

@@ -44,7 +44,7 @@ def with_streaming_response(self) -> CompletionsResourceWithStreamingResponse:
4444
"""
4545
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
4646
47-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
47+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
4848
"""
4949
return CompletionsResourceWithStreamingResponse(self)
5050

@@ -515,7 +515,7 @@ def with_raw_response(self) -> AsyncCompletionsResourceWithRawResponse:
515515
This property can be used as a prefix for any HTTP method call to return
516516
the raw response object instead of the parsed content.
517517
518-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
518+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
519519
"""
520520
return AsyncCompletionsResourceWithRawResponse(self)
521521

@@ -524,7 +524,7 @@ def with_streaming_response(self) -> AsyncCompletionsResourceWithStreamingRespon
524524
"""
525525
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
526526
527-
For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
527+
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
528528
"""
529529
return AsyncCompletionsResourceWithStreamingResponse(self)
530530

0 commit comments

Comments
 (0)