diff --git a/src/llama_stack_client/resources/datasets.py b/src/llama_stack_client/resources/datasets.py index 721d2f6..6e9a630 100644 --- a/src/llama_stack_client/resources/datasets.py +++ b/src/llama_stack_client/resources/datasets.py @@ -22,6 +22,7 @@ async_to_streamed_response_wrapper, ) from .._base_client import make_request_options +from ..types.shared_params.url import URL from ..types.dataset_list_response import DatasetListResponse from ..types.shared_params.param_type import ParamType from ..types.dataset_retrieve_response import DatasetRetrieveResponse @@ -126,7 +127,7 @@ def register( *, dataset_id: str, dataset_schema: Dict[str, ParamType], - url: str, + url: URL, metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | NotGiven = NOT_GIVEN, provider_dataset_id: str | NotGiven = NOT_GIVEN, provider_id: str | NotGiven = NOT_GIVEN, @@ -308,7 +309,7 @@ async def register( *, dataset_id: str, dataset_schema: Dict[str, ParamType], - url: str, + url: URL, metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | NotGiven = NOT_GIVEN, provider_dataset_id: str | NotGiven = NOT_GIVEN, provider_id: str | NotGiven = NOT_GIVEN, diff --git a/src/llama_stack_client/types/__init__.py b/src/llama_stack_client/types/__init__.py index 1572ac7..b66182f 100644 --- a/src/llama_stack_client/types/__init__.py +++ b/src/llama_stack_client/types/__init__.py @@ -6,6 +6,7 @@ from .model import Model as Model from .trace import Trace as Trace from .shared import ( + URL as URL, ToolCall as ToolCall, ParamType as ParamType, Attachment as Attachment, diff --git a/src/llama_stack_client/types/dataset_list_response.py b/src/llama_stack_client/types/dataset_list_response.py index 738573b..2306f8e 100644 --- a/src/llama_stack_client/types/dataset_list_response.py +++ b/src/llama_stack_client/types/dataset_list_response.py @@ -4,6 +4,7 @@ from typing_extensions import Literal from .._models import BaseModel +from .shared.url import URL from .shared.param_type import ParamType __all__ = ["DatasetListResponse"] @@ -22,4 +23,4 @@ class DatasetListResponse(BaseModel): type: Literal["dataset"] - url: str + url: URL diff --git a/src/llama_stack_client/types/dataset_register_params.py b/src/llama_stack_client/types/dataset_register_params.py index 785874f..367f115 100644 --- a/src/llama_stack_client/types/dataset_register_params.py +++ b/src/llama_stack_client/types/dataset_register_params.py @@ -6,6 +6,7 @@ from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo +from .shared_params.url import URL from .shared_params.param_type import ParamType __all__ = ["DatasetRegisterParams"] @@ -16,7 +17,7 @@ class DatasetRegisterParams(TypedDict, total=False): dataset_schema: Required[Dict[str, ParamType]] - url: Required[str] + url: Required[URL] metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] diff --git a/src/llama_stack_client/types/dataset_retrieve_response.py b/src/llama_stack_client/types/dataset_retrieve_response.py index 61504c0..31d7ab3 100644 --- a/src/llama_stack_client/types/dataset_retrieve_response.py +++ b/src/llama_stack_client/types/dataset_retrieve_response.py @@ -4,6 +4,7 @@ from typing_extensions import Literal from .._models import BaseModel +from .shared.url import URL from .shared.param_type import ParamType __all__ = ["DatasetRetrieveResponse"] @@ -22,4 +23,4 @@ class DatasetRetrieveResponse(BaseModel): type: Literal["dataset"] - url: str + url: URL diff --git a/src/llama_stack_client/types/memory_insert_params.py b/src/llama_stack_client/types/memory_insert_params.py index ae580ad..096b3aa 100644 --- a/src/llama_stack_client/types/memory_insert_params.py +++ b/src/llama_stack_client/types/memory_insert_params.py @@ -6,6 +6,7 @@ from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict from .._utils import PropertyInfo +from .shared_params.url import URL from .shared_params.interleaved_content_item import InterleavedContentItem __all__ = [ @@ -32,7 +33,7 @@ class DocumentContentImageContentItem(TypedDict, total=False): data: str - url: str + url: URL class DocumentContentTextContentItem(TypedDict, total=False): @@ -42,7 +43,7 @@ class DocumentContentTextContentItem(TypedDict, total=False): DocumentContent: TypeAlias = Union[ - str, DocumentContentImageContentItem, DocumentContentTextContentItem, Iterable[InterleavedContentItem] + str, DocumentContentImageContentItem, DocumentContentTextContentItem, Iterable[InterleavedContentItem], URL ] diff --git a/src/llama_stack_client/types/shared/__init__.py b/src/llama_stack_client/types/shared/__init__.py index 1140444..4ef0a9a 100644 --- a/src/llama_stack_client/types/shared/__init__.py +++ b/src/llama_stack_client/types/shared/__init__.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .url import URL as URL from .tool_call import ToolCall as ToolCall from .attachment import Attachment as Attachment from .param_type import ParamType as ParamType diff --git a/src/llama_stack_client/types/shared/attachment.py b/src/llama_stack_client/types/shared/attachment.py index 1be0130..df185a2 100644 --- a/src/llama_stack_client/types/shared/attachment.py +++ b/src/llama_stack_client/types/shared/attachment.py @@ -3,6 +3,7 @@ from typing import List, Union, Optional from typing_extensions import Literal, TypeAlias +from .url import URL from ..._models import BaseModel from .interleaved_content_item import InterleavedContentItem @@ -14,7 +15,7 @@ class ContentImageContentItem(BaseModel): data: Optional[str] = None - url: Optional[str] = None + url: Optional[URL] = None class ContentTextContentItem(BaseModel): @@ -23,7 +24,7 @@ class ContentTextContentItem(BaseModel): type: Literal["text"] -Content: TypeAlias = Union[str, ContentImageContentItem, ContentTextContentItem, List[InterleavedContentItem]] +Content: TypeAlias = Union[str, ContentImageContentItem, ContentTextContentItem, List[InterleavedContentItem], URL] class Attachment(BaseModel): diff --git a/src/llama_stack_client/types/shared/interleaved_content.py b/src/llama_stack_client/types/shared/interleaved_content.py index 0598749..58fd17c 100644 --- a/src/llama_stack_client/types/shared/interleaved_content.py +++ b/src/llama_stack_client/types/shared/interleaved_content.py @@ -3,6 +3,7 @@ from typing import List, Union, Optional from typing_extensions import Literal, TypeAlias +from .url import URL from ..._models import BaseModel from .interleaved_content_item import InterleavedContentItem @@ -14,7 +15,7 @@ class ImageContentItem(BaseModel): data: Optional[str] = None - url: Optional[str] = None + url: Optional[URL] = None class TextContentItem(BaseModel): diff --git a/src/llama_stack_client/types/shared/interleaved_content_item.py b/src/llama_stack_client/types/shared/interleaved_content_item.py index d9fb7ae..e90127b 100644 --- a/src/llama_stack_client/types/shared/interleaved_content_item.py +++ b/src/llama_stack_client/types/shared/interleaved_content_item.py @@ -3,6 +3,7 @@ from typing import Union, Optional from typing_extensions import Literal, TypeAlias +from .url import URL from ..._models import BaseModel __all__ = ["InterleavedContentItem", "ImageContentItem", "TextContentItem"] @@ -13,7 +14,7 @@ class ImageContentItem(BaseModel): data: Optional[str] = None - url: Optional[str] = None + url: Optional[URL] = None class TextContentItem(BaseModel): diff --git a/src/llama_stack_client/types/shared/rest_api_execution_config.py b/src/llama_stack_client/types/shared/rest_api_execution_config.py index 2f50cf9..f08b2a5 100644 --- a/src/llama_stack_client/types/shared/rest_api_execution_config.py +++ b/src/llama_stack_client/types/shared/rest_api_execution_config.py @@ -3,6 +3,7 @@ from typing import Dict, List, Union, Optional from typing_extensions import Literal +from .url import URL from ..._models import BaseModel __all__ = ["RestAPIExecutionConfig"] @@ -11,7 +12,7 @@ class RestAPIExecutionConfig(BaseModel): method: Literal["GET", "POST", "PUT", "DELETE"] - url: str + url: URL body: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None diff --git a/src/llama_stack_client/types/shared/url.py b/src/llama_stack_client/types/shared/url.py new file mode 100644 index 0000000..a333bf7 --- /dev/null +++ b/src/llama_stack_client/types/shared/url.py @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel + +__all__ = ["URL"] + + +class URL(BaseModel): + uri: str diff --git a/src/llama_stack_client/types/shared_params/__init__.py b/src/llama_stack_client/types/shared_params/__init__.py index 087e5b5..3d44177 100644 --- a/src/llama_stack_client/types/shared_params/__init__.py +++ b/src/llama_stack_client/types/shared_params/__init__.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from .url import URL as URL from .tool_call import ToolCall as ToolCall from .attachment import Attachment as Attachment from .param_type import ParamType as ParamType diff --git a/src/llama_stack_client/types/shared_params/attachment.py b/src/llama_stack_client/types/shared_params/attachment.py index 2fe4c7b..170acff 100644 --- a/src/llama_stack_client/types/shared_params/attachment.py +++ b/src/llama_stack_client/types/shared_params/attachment.py @@ -5,6 +5,7 @@ from typing import Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict +from .url import URL from .interleaved_content_item import InterleavedContentItem __all__ = ["Attachment", "Content", "ContentImageContentItem", "ContentTextContentItem"] @@ -15,7 +16,7 @@ class ContentImageContentItem(TypedDict, total=False): data: str - url: str + url: URL class ContentTextContentItem(TypedDict, total=False): @@ -24,7 +25,7 @@ class ContentTextContentItem(TypedDict, total=False): type: Required[Literal["text"]] -Content: TypeAlias = Union[str, ContentImageContentItem, ContentTextContentItem, Iterable[InterleavedContentItem]] +Content: TypeAlias = Union[str, ContentImageContentItem, ContentTextContentItem, Iterable[InterleavedContentItem], URL] class Attachment(TypedDict, total=False): diff --git a/src/llama_stack_client/types/shared_params/interleaved_content.py b/src/llama_stack_client/types/shared_params/interleaved_content.py index ea4e175..d638059 100644 --- a/src/llama_stack_client/types/shared_params/interleaved_content.py +++ b/src/llama_stack_client/types/shared_params/interleaved_content.py @@ -5,6 +5,7 @@ from typing import Union, Iterable from typing_extensions import Literal, Required, TypeAlias, TypedDict +from .url import URL from .interleaved_content_item import InterleavedContentItem __all__ = ["InterleavedContent", "ImageContentItem", "TextContentItem"] @@ -15,7 +16,7 @@ class ImageContentItem(TypedDict, total=False): data: str - url: str + url: URL class TextContentItem(TypedDict, total=False): diff --git a/src/llama_stack_client/types/shared_params/interleaved_content_item.py b/src/llama_stack_client/types/shared_params/interleaved_content_item.py index 2bf804d..32e1779 100644 --- a/src/llama_stack_client/types/shared_params/interleaved_content_item.py +++ b/src/llama_stack_client/types/shared_params/interleaved_content_item.py @@ -5,6 +5,8 @@ from typing import Union from typing_extensions import Literal, Required, TypeAlias, TypedDict +from .url import URL + __all__ = ["InterleavedContentItem", "ImageContentItem", "TextContentItem"] @@ -13,7 +15,7 @@ class ImageContentItem(TypedDict, total=False): data: str - url: str + url: URL class TextContentItem(TypedDict, total=False): diff --git a/src/llama_stack_client/types/shared_params/rest_api_execution_config.py b/src/llama_stack_client/types/shared_params/rest_api_execution_config.py index 3e3bca9..3d07e53 100644 --- a/src/llama_stack_client/types/shared_params/rest_api_execution_config.py +++ b/src/llama_stack_client/types/shared_params/rest_api_execution_config.py @@ -5,13 +5,15 @@ from typing import Dict, Union, Iterable from typing_extensions import Literal, Required, TypedDict +from .url import URL + __all__ = ["RestAPIExecutionConfig"] class RestAPIExecutionConfig(TypedDict, total=False): method: Required[Literal["GET", "POST", "PUT", "DELETE"]] - url: Required[str] + url: Required[URL] body: Dict[str, Union[bool, float, str, Iterable[object], object, None]] diff --git a/src/llama_stack_client/types/shared_params/url.py b/src/llama_stack_client/types/shared_params/url.py new file mode 100644 index 0000000..8b4418a --- /dev/null +++ b/src/llama_stack_client/types/shared_params/url.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["URL"] + + +class URL(TypedDict, total=False): + uri: Required[str] diff --git a/tests/api_resources/test_agents.py b/tests/api_resources/test_agents.py index 835b61d..92db1ff 100644 --- a/tests/api_resources/test_agents.py +++ b/tests/api_resources/test_agents.py @@ -58,7 +58,7 @@ def test_method_create_with_all_params(self, client: LlamaStackClient) -> None: "output_shields": ["string"], "remote_execution": { "method": "GET", - "url": "https://example.com", + "url": {"uri": "uri"}, "body": {"foo": True}, "headers": {"foo": True}, "params": {"foo": True}, @@ -188,7 +188,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncLlamaStack "output_shields": ["string"], "remote_execution": { "method": "GET", - "url": "https://example.com", + "url": {"uri": "uri"}, "body": {"foo": True}, "headers": {"foo": True}, "params": {"foo": True}, diff --git a/tests/api_resources/test_datasets.py b/tests/api_resources/test_datasets.py index b16fd47..3a17607 100644 --- a/tests/api_resources/test_datasets.py +++ b/tests/api_resources/test_datasets.py @@ -108,7 +108,7 @@ def test_method_register(self, client: LlamaStackClient) -> None: dataset = client.datasets.register( dataset_id="dataset_id", dataset_schema={"foo": {"type": "string"}}, - url="https://example.com", + url={"uri": "uri"}, ) assert dataset is None @@ -117,7 +117,7 @@ def test_method_register_with_all_params(self, client: LlamaStackClient) -> None dataset = client.datasets.register( dataset_id="dataset_id", dataset_schema={"foo": {"type": "string"}}, - url="https://example.com", + url={"uri": "uri"}, metadata={"foo": True}, provider_dataset_id="provider_dataset_id", provider_id="provider_id", @@ -130,7 +130,7 @@ def test_raw_response_register(self, client: LlamaStackClient) -> None: response = client.datasets.with_raw_response.register( dataset_id="dataset_id", dataset_schema={"foo": {"type": "string"}}, - url="https://example.com", + url={"uri": "uri"}, ) assert response.is_closed is True @@ -143,7 +143,7 @@ def test_streaming_response_register(self, client: LlamaStackClient) -> None: with client.datasets.with_streaming_response.register( dataset_id="dataset_id", dataset_schema={"foo": {"type": "string"}}, - url="https://example.com", + url={"uri": "uri"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -284,7 +284,7 @@ async def test_method_register(self, async_client: AsyncLlamaStackClient) -> Non dataset = await async_client.datasets.register( dataset_id="dataset_id", dataset_schema={"foo": {"type": "string"}}, - url="https://example.com", + url={"uri": "uri"}, ) assert dataset is None @@ -293,7 +293,7 @@ async def test_method_register_with_all_params(self, async_client: AsyncLlamaSta dataset = await async_client.datasets.register( dataset_id="dataset_id", dataset_schema={"foo": {"type": "string"}}, - url="https://example.com", + url={"uri": "uri"}, metadata={"foo": True}, provider_dataset_id="provider_dataset_id", provider_id="provider_id", @@ -306,7 +306,7 @@ async def test_raw_response_register(self, async_client: AsyncLlamaStackClient) response = await async_client.datasets.with_raw_response.register( dataset_id="dataset_id", dataset_schema={"foo": {"type": "string"}}, - url="https://example.com", + url={"uri": "uri"}, ) assert response.is_closed is True @@ -319,7 +319,7 @@ async def test_streaming_response_register(self, async_client: AsyncLlamaStackCl async with async_client.datasets.with_streaming_response.register( dataset_id="dataset_id", dataset_schema={"foo": {"type": "string"}}, - url="https://example.com", + url={"uri": "uri"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/test_client.py b/tests/test_client.py index 6d92271..921151e 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -322,11 +322,11 @@ def test_default_query_option(self) -> None: FinalRequestOptions( method="get", url="/foo", - params={"foo": "baz", "query_param": "overriden"}, + params={"foo": "baz", "query_param": "overridden"}, ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overriden"} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1105,11 +1105,11 @@ def test_default_query_option(self) -> None: FinalRequestOptions( method="get", url="/foo", - params={"foo": "baz", "query_param": "overriden"}, + params={"foo": "baz", "query_param": "overridden"}, ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overriden"} + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} def test_request_extra_json(self) -> None: request = self.client._build_request( @@ -1631,7 +1631,7 @@ def test_get_platform(self) -> None: import threading from llama_stack_client._utils import asyncify - from llama_stack_client._base_client import get_platform + from llama_stack_client._base_client import get_platform async def test_main() -> None: result = await asyncify(get_platform)()