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
18 changes: 16 additions & 2 deletions src/llama_stack_client/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,14 @@ def _process_response(
) -> ResponseT:
origin = get_origin(cast_to) or cast_to

if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
if (
inspect.isclass(origin)
and issubclass(origin, BaseAPIResponse)
# we only want to actually return the custom BaseAPIResponse class if we're
# returning the raw response, or if we're not streaming SSE, as if we're streaming
# SSE then `cast_to` doesn't actively reflect the type we need to parse into
and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
):
if not issubclass(origin, APIResponse):
raise TypeError(f"API Response types must subclass {APIResponse}; Received {origin}")

Expand Down Expand Up @@ -1574,7 +1581,14 @@ async def _process_response(
) -> ResponseT:
origin = get_origin(cast_to) or cast_to

if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse):
if (
inspect.isclass(origin)
and issubclass(origin, BaseAPIResponse)
# we only want to actually return the custom BaseAPIResponse class if we're
# returning the raw response, or if we're not streaming SSE, as if we're streaming
# SSE then `cast_to` doesn't actively reflect the type we need to parse into
and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER)))
):
if not issubclass(origin, AsyncAPIResponse):
raise TypeError(f"API Response types must subclass {AsyncAPIResponse}; Received {origin}")

Expand Down
2 changes: 1 addition & 1 deletion src/llama_stack_client/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
toolgroups,
vector_dbs,
completions,
vector_stores,
scoring_functions,
synthetic_data_generation,
)
Expand All @@ -58,6 +57,7 @@
from .resources.responses import responses
from .resources.tool_runtime import tool_runtime
from .resources.post_training import post_training
from .resources.vector_stores import vector_stores

__all__ = [
"Timeout",
Expand Down
22 changes: 22 additions & 0 deletions src/llama_stack_client/resources/completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def create(
stop: Union[str, List[str]] | NotGiven = NOT_GIVEN,
stream: Literal[False] | NotGiven = NOT_GIVEN,
stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | NotGiven = NOT_GIVEN,
suffix: str | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN,
top_p: float | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -109,6 +110,8 @@ def create(

stream_options: (Optional) The stream options to use.

suffix: (Optional) The suffix that should be appended to the completion.

temperature: (Optional) The temperature to use.

top_p: (Optional) The top p to use.
Expand Down Expand Up @@ -145,6 +148,7 @@ def create(
seed: int | NotGiven = NOT_GIVEN,
stop: Union[str, List[str]] | NotGiven = NOT_GIVEN,
stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | NotGiven = NOT_GIVEN,
suffix: str | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN,
top_p: float | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -189,6 +193,8 @@ def create(

stream_options: (Optional) The stream options to use.

suffix: (Optional) The suffix that should be appended to the completion.

temperature: (Optional) The temperature to use.

top_p: (Optional) The top p to use.
Expand Down Expand Up @@ -225,6 +231,7 @@ def create(
seed: int | NotGiven = NOT_GIVEN,
stop: Union[str, List[str]] | NotGiven = NOT_GIVEN,
stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | NotGiven = NOT_GIVEN,
suffix: str | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN,
top_p: float | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -269,6 +276,8 @@ def create(

stream_options: (Optional) The stream options to use.

suffix: (Optional) The suffix that should be appended to the completion.

temperature: (Optional) The temperature to use.

top_p: (Optional) The top p to use.
Expand Down Expand Up @@ -305,6 +314,7 @@ def create(
stop: Union[str, List[str]] | NotGiven = NOT_GIVEN,
stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | NotGiven = NOT_GIVEN,
suffix: str | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN,
top_p: float | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -335,6 +345,7 @@ def create(
"stop": stop,
"stream": stream,
"stream_options": stream_options,
"suffix": suffix,
"temperature": temperature,
"top_p": top_p,
"user": user,
Expand Down Expand Up @@ -392,6 +403,7 @@ async def create(
stop: Union[str, List[str]] | NotGiven = NOT_GIVEN,
stream: Literal[False] | NotGiven = NOT_GIVEN,
stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | NotGiven = NOT_GIVEN,
suffix: str | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN,
top_p: float | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -436,6 +448,8 @@ async def create(

stream_options: (Optional) The stream options to use.

suffix: (Optional) The suffix that should be appended to the completion.

temperature: (Optional) The temperature to use.

top_p: (Optional) The top p to use.
Expand Down Expand Up @@ -472,6 +486,7 @@ async def create(
seed: int | NotGiven = NOT_GIVEN,
stop: Union[str, List[str]] | NotGiven = NOT_GIVEN,
stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | NotGiven = NOT_GIVEN,
suffix: str | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN,
top_p: float | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -516,6 +531,8 @@ async def create(

stream_options: (Optional) The stream options to use.

suffix: (Optional) The suffix that should be appended to the completion.

temperature: (Optional) The temperature to use.

top_p: (Optional) The top p to use.
Expand Down Expand Up @@ -552,6 +569,7 @@ async def create(
seed: int | NotGiven = NOT_GIVEN,
stop: Union[str, List[str]] | NotGiven = NOT_GIVEN,
stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | NotGiven = NOT_GIVEN,
suffix: str | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN,
top_p: float | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -596,6 +614,8 @@ async def create(

stream_options: (Optional) The stream options to use.

suffix: (Optional) The suffix that should be appended to the completion.

temperature: (Optional) The temperature to use.

top_p: (Optional) The top p to use.
Expand Down Expand Up @@ -632,6 +652,7 @@ async def create(
stop: Union[str, List[str]] | NotGiven = NOT_GIVEN,
stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN,
stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | NotGiven = NOT_GIVEN,
suffix: str | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN,
top_p: float | NotGiven = NOT_GIVEN,
user: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -662,6 +683,7 @@ async def create(
"stop": stop,
"stream": stream,
"stream_options": stream_options,
"suffix": suffix,
"temperature": temperature,
"top_p": top_p,
"user": user,
Expand Down
33 changes: 33 additions & 0 deletions src/llama_stack_client/resources/vector_stores/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from .files import (
FilesResource,
AsyncFilesResource,
FilesResourceWithRawResponse,
AsyncFilesResourceWithRawResponse,
FilesResourceWithStreamingResponse,
AsyncFilesResourceWithStreamingResponse,
)
from .vector_stores import (
VectorStoresResource,
AsyncVectorStoresResource,
VectorStoresResourceWithRawResponse,
AsyncVectorStoresResourceWithRawResponse,
VectorStoresResourceWithStreamingResponse,
AsyncVectorStoresResourceWithStreamingResponse,
)

__all__ = [
"FilesResource",
"AsyncFilesResource",
"FilesResourceWithRawResponse",
"AsyncFilesResourceWithRawResponse",
"FilesResourceWithStreamingResponse",
"AsyncFilesResourceWithStreamingResponse",
"VectorStoresResource",
"AsyncVectorStoresResource",
"VectorStoresResourceWithRawResponse",
"AsyncVectorStoresResourceWithRawResponse",
"VectorStoresResourceWithStreamingResponse",
"AsyncVectorStoresResourceWithStreamingResponse",
]
Loading
Loading