Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/llama_stack_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
UnprocessableEntityError,
APIResponseValidationError,
)
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
from ._utils._logs import setup_logging as _setup_logging

from .lib.agents.agent import Agent
Expand Down Expand Up @@ -84,6 +84,7 @@
"DEFAULT_CONNECTION_LIMITS",
"DefaultHttpxClient",
"DefaultAsyncHttpxClient",
"DefaultAioHttpClient",
]

if not _t.TYPE_CHECKING:
Expand Down
22 changes: 22 additions & 0 deletions src/llama_stack_client/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,24 @@ def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


try:
import httpx_aiohttp
except ImportError:

class _DefaultAioHttpClient(httpx.AsyncClient):
def __init__(self, **_kwargs: Any) -> None:
raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra")
else:

class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
def __init__(self, **kwargs: Any) -> None:
kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
kwargs.setdefault("follow_redirects", True)

super().__init__(**kwargs)


if TYPE_CHECKING:
DefaultAsyncHttpxClient = httpx.AsyncClient
"""An alias to `httpx.AsyncClient` that provides the same defaults that this SDK
Expand All @@ -1297,8 +1315,12 @@ def __init__(self, **kwargs: Any) -> None:
This is useful because overriding the `http_client` with your own instance of
`httpx.AsyncClient` will result in httpx's defaults being used, not ours.
"""

DefaultAioHttpClient = httpx.AsyncClient
"""An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`."""
else:
DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient
DefaultAioHttpClient = _DefaultAioHttpClient


class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
Expand Down
2 changes: 1 addition & 1 deletion src/llama_stack_client/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
if not is_file_content(obj):
prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
raise RuntimeError(
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"
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"
) from None


Expand Down
8 changes: 4 additions & 4 deletions src/llama_stack_client/resources/agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def with_raw_response(self) -> AgentsResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return AgentsResourceWithRawResponse(self)

Expand All @@ -74,7 +74,7 @@ def with_streaming_response(self) -> AgentsResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return AgentsResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -166,7 +166,7 @@ def with_raw_response(self) -> AsyncAgentsResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return AsyncAgentsResourceWithRawResponse(self)

Expand All @@ -175,7 +175,7 @@ def with_streaming_response(self) -> AsyncAgentsResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return AsyncAgentsResourceWithStreamingResponse(self)

Expand Down
8 changes: 4 additions & 4 deletions src/llama_stack_client/resources/agents/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def with_raw_response(self) -> SessionResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return SessionResourceWithRawResponse(self)

Expand All @@ -40,7 +40,7 @@ def with_streaming_response(self) -> SessionResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return SessionResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -169,7 +169,7 @@ def with_raw_response(self) -> AsyncSessionResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return AsyncSessionResourceWithRawResponse(self)

Expand All @@ -178,7 +178,7 @@ def with_streaming_response(self) -> AsyncSessionResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return AsyncSessionResourceWithStreamingResponse(self)

Expand Down
8 changes: 4 additions & 4 deletions src/llama_stack_client/resources/agents/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def with_raw_response(self) -> StepsResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return StepsResourceWithRawResponse(self)

Expand All @@ -35,7 +35,7 @@ def with_streaming_response(self) -> StepsResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return StepsResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -89,7 +89,7 @@ def with_raw_response(self) -> AsyncStepsResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return AsyncStepsResourceWithRawResponse(self)

Expand All @@ -98,7 +98,7 @@ def with_streaming_response(self) -> AsyncStepsResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return AsyncStepsResourceWithStreamingResponse(self)

Expand Down
8 changes: 4 additions & 4 deletions src/llama_stack_client/resources/agents/turn.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def with_raw_response(self) -> TurnResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return TurnResourceWithRawResponse(self)

Expand All @@ -43,7 +43,7 @@ def with_streaming_response(self) -> TurnResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return TurnResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -428,7 +428,7 @@ def with_raw_response(self) -> AsyncTurnResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return AsyncTurnResourceWithRawResponse(self)

Expand All @@ -437,7 +437,7 @@ def with_streaming_response(self) -> AsyncTurnResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return AsyncTurnResourceWithStreamingResponse(self)

Expand Down
8 changes: 4 additions & 4 deletions src/llama_stack_client/resources/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def with_raw_response(self) -> BenchmarksResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return BenchmarksResourceWithRawResponse(self)

Expand All @@ -41,7 +41,7 @@ def with_streaming_response(self) -> BenchmarksResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return BenchmarksResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -169,7 +169,7 @@ def with_raw_response(self) -> AsyncBenchmarksResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return AsyncBenchmarksResourceWithRawResponse(self)

Expand All @@ -178,7 +178,7 @@ def with_streaming_response(self) -> AsyncBenchmarksResourceWithStreamingRespons
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return AsyncBenchmarksResourceWithStreamingResponse(self)

Expand Down
8 changes: 4 additions & 4 deletions src/llama_stack_client/resources/chat/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def with_raw_response(self) -> ChatResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return ChatResourceWithRawResponse(self)

Expand All @@ -36,7 +36,7 @@ def with_streaming_response(self) -> ChatResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return ChatResourceWithStreamingResponse(self)

Expand All @@ -52,7 +52,7 @@ def with_raw_response(self) -> AsyncChatResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return AsyncChatResourceWithRawResponse(self)

Expand All @@ -61,7 +61,7 @@ def with_streaming_response(self) -> AsyncChatResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return AsyncChatResourceWithStreamingResponse(self)

Expand Down
8 changes: 4 additions & 4 deletions src/llama_stack_client/resources/chat/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def with_raw_response(self) -> CompletionsResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return CompletionsResourceWithRawResponse(self)

Expand All @@ -44,7 +44,7 @@ def with_streaming_response(self) -> CompletionsResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return CompletionsResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -515,7 +515,7 @@ def with_raw_response(self) -> AsyncCompletionsResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return AsyncCompletionsResourceWithRawResponse(self)

Expand All @@ -524,7 +524,7 @@ def with_streaming_response(self) -> AsyncCompletionsResourceWithStreamingRespon
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return AsyncCompletionsResourceWithStreamingResponse(self)

Expand Down
8 changes: 4 additions & 4 deletions src/llama_stack_client/resources/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def with_raw_response(self) -> CompletionsResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return CompletionsResourceWithRawResponse(self)

Expand All @@ -41,7 +41,7 @@ def with_streaming_response(self) -> CompletionsResourceWithStreamingResponse:
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return CompletionsResourceWithStreamingResponse(self)

Expand Down Expand Up @@ -370,7 +370,7 @@ def with_raw_response(self) -> AsyncCompletionsResourceWithRawResponse:
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#accessing-raw-response-data-eg-headers
For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers
"""
return AsyncCompletionsResourceWithRawResponse(self)

Expand All @@ -379,7 +379,7 @@ def with_streaming_response(self) -> AsyncCompletionsResourceWithStreamingRespon
"""
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/stainless-sdks/llama-stack-python#with_streaming_response
For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response
"""
return AsyncCompletionsResourceWithStreamingResponse(self)

Expand Down
Loading
Loading