Skip to content

Commit

Permalink
Update for the URL type changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwinb committed Dec 18, 2024
1 parent 453921d commit 4a13f5b
Show file tree
Hide file tree
Showing 21 changed files with 71 additions and 32 deletions.
5 changes: 3 additions & 2 deletions src/llama_stack_client/resources/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/llama_stack_client/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/llama_stack_client/types/dataset_list_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -22,4 +23,4 @@ class DatasetListResponse(BaseModel):

type: Literal["dataset"]

url: str
url: URL
3 changes: 2 additions & 1 deletion src/llama_stack_client/types/dataset_register_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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]]

Expand Down
3 changes: 2 additions & 1 deletion src/llama_stack_client/types/dataset_retrieve_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -22,4 +23,4 @@ class DatasetRetrieveResponse(BaseModel):

type: Literal["dataset"]

url: str
url: URL
5 changes: 3 additions & 2 deletions src/llama_stack_client/types/memory_insert_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = [
Expand All @@ -32,7 +33,7 @@ class DocumentContentImageContentItem(TypedDict, total=False):

data: str

url: str
url: URL


class DocumentContentTextContentItem(TypedDict, total=False):
Expand All @@ -42,7 +43,7 @@ class DocumentContentTextContentItem(TypedDict, total=False):


DocumentContent: TypeAlias = Union[
str, DocumentContentImageContentItem, DocumentContentTextContentItem, Iterable[InterleavedContentItem]
str, DocumentContentImageContentItem, DocumentContentTextContentItem, Iterable[InterleavedContentItem], URL
]


Expand Down
1 change: 1 addition & 0 deletions src/llama_stack_client/types/shared/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/llama_stack_client/types/shared/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -14,7 +15,7 @@ class ContentImageContentItem(BaseModel):

data: Optional[str] = None

url: Optional[str] = None
url: Optional[URL] = None


class ContentTextContentItem(BaseModel):
Expand All @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion src/llama_stack_client/types/shared/interleaved_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -14,7 +15,7 @@ class ImageContentItem(BaseModel):

data: Optional[str] = None

url: Optional[str] = None
url: Optional[URL] = None


class TextContentItem(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -13,7 +14,7 @@ class ImageContentItem(BaseModel):

data: Optional[str] = None

url: Optional[str] = None
url: Optional[URL] = None


class TextContentItem(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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

Expand Down
10 changes: 10 additions & 0 deletions src/llama_stack_client/types/shared/url.py
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/llama_stack_client/types/shared_params/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/llama_stack_client/types/shared_params/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -15,7 +16,7 @@ class ContentImageContentItem(TypedDict, total=False):

data: str

url: str
url: URL


class ContentTextContentItem(TypedDict, total=False):
Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -15,7 +16,7 @@ class ImageContentItem(TypedDict, total=False):

data: str

url: str
url: URL


class TextContentItem(TypedDict, total=False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from typing import Union
from typing_extensions import Literal, Required, TypeAlias, TypedDict

from .url import URL

__all__ = ["InterleavedContentItem", "ImageContentItem", "TextContentItem"]


Expand All @@ -13,7 +15,7 @@ class ImageContentItem(TypedDict, total=False):

data: str

url: str
url: URL


class TextContentItem(TypedDict, total=False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]]

Expand Down
11 changes: 11 additions & 0 deletions src/llama_stack_client/types/shared_params/url.py
Original file line number Diff line number Diff line change
@@ -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]
4 changes: 2 additions & 2 deletions tests/api_resources/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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},
Expand Down
16 changes: 8 additions & 8 deletions tests/api_resources/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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",
Expand All @@ -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
Expand All @@ -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"
Expand Down Expand Up @@ -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

Expand All @@ -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",
Expand All @@ -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
Expand All @@ -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"
Expand Down
Loading

0 comments on commit 4a13f5b

Please sign in to comment.