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
9 changes: 0 additions & 9 deletions src/llama_stack_client/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
scoring,
shields,
datasets,
datasetio,
inference,
providers,
telemetry,
Expand Down Expand Up @@ -90,7 +89,6 @@ class LlamaStackClient(SyncAPIClient):
shields: shields.ShieldsResource
synthetic_data_generation: synthetic_data_generation.SyntheticDataGenerationResource
telemetry: telemetry.TelemetryResource
datasetio: datasetio.DatasetioResource
scoring: scoring.ScoringResource
scoring_functions: scoring_functions.ScoringFunctionsResource
benchmarks: benchmarks.BenchmarksResource
Expand Down Expand Up @@ -172,7 +170,6 @@ def __init__(
self.shields = shields.ShieldsResource(self)
self.synthetic_data_generation = synthetic_data_generation.SyntheticDataGenerationResource(self)
self.telemetry = telemetry.TelemetryResource(self)
self.datasetio = datasetio.DatasetioResource(self)
self.scoring = scoring.ScoringResource(self)
self.scoring_functions = scoring_functions.ScoringFunctionsResource(self)
self.benchmarks = benchmarks.BenchmarksResource(self)
Expand Down Expand Up @@ -306,7 +303,6 @@ class AsyncLlamaStackClient(AsyncAPIClient):
shields: shields.AsyncShieldsResource
synthetic_data_generation: synthetic_data_generation.AsyncSyntheticDataGenerationResource
telemetry: telemetry.AsyncTelemetryResource
datasetio: datasetio.AsyncDatasetioResource
scoring: scoring.AsyncScoringResource
scoring_functions: scoring_functions.AsyncScoringFunctionsResource
benchmarks: benchmarks.AsyncBenchmarksResource
Expand Down Expand Up @@ -388,7 +384,6 @@ def __init__(
self.shields = shields.AsyncShieldsResource(self)
self.synthetic_data_generation = synthetic_data_generation.AsyncSyntheticDataGenerationResource(self)
self.telemetry = telemetry.AsyncTelemetryResource(self)
self.datasetio = datasetio.AsyncDatasetioResource(self)
self.scoring = scoring.AsyncScoringResource(self)
self.scoring_functions = scoring_functions.AsyncScoringFunctionsResource(self)
self.benchmarks = benchmarks.AsyncBenchmarksResource(self)
Expand Down Expand Up @@ -525,7 +520,6 @@ def __init__(self, client: LlamaStackClient) -> None:
client.synthetic_data_generation
)
self.telemetry = telemetry.TelemetryResourceWithRawResponse(client.telemetry)
self.datasetio = datasetio.DatasetioResourceWithRawResponse(client.datasetio)
self.scoring = scoring.ScoringResourceWithRawResponse(client.scoring)
self.scoring_functions = scoring_functions.ScoringFunctionsResourceWithRawResponse(client.scoring_functions)
self.benchmarks = benchmarks.BenchmarksResourceWithRawResponse(client.benchmarks)
Expand Down Expand Up @@ -554,7 +548,6 @@ def __init__(self, client: AsyncLlamaStackClient) -> None:
client.synthetic_data_generation
)
self.telemetry = telemetry.AsyncTelemetryResourceWithRawResponse(client.telemetry)
self.datasetio = datasetio.AsyncDatasetioResourceWithRawResponse(client.datasetio)
self.scoring = scoring.AsyncScoringResourceWithRawResponse(client.scoring)
self.scoring_functions = scoring_functions.AsyncScoringFunctionsResourceWithRawResponse(
client.scoring_functions
Expand Down Expand Up @@ -585,7 +578,6 @@ def __init__(self, client: LlamaStackClient) -> None:
client.synthetic_data_generation
)
self.telemetry = telemetry.TelemetryResourceWithStreamingResponse(client.telemetry)
self.datasetio = datasetio.DatasetioResourceWithStreamingResponse(client.datasetio)
self.scoring = scoring.ScoringResourceWithStreamingResponse(client.scoring)
self.scoring_functions = scoring_functions.ScoringFunctionsResourceWithStreamingResponse(
client.scoring_functions
Expand Down Expand Up @@ -618,7 +610,6 @@ def __init__(self, client: AsyncLlamaStackClient) -> None:
)
)
self.telemetry = telemetry.AsyncTelemetryResourceWithStreamingResponse(client.telemetry)
self.datasetio = datasetio.AsyncDatasetioResourceWithStreamingResponse(client.datasetio)
self.scoring = scoring.AsyncScoringResourceWithStreamingResponse(client.scoring)
self.scoring_functions = scoring_functions.AsyncScoringFunctionsResourceWithStreamingResponse(
client.scoring_functions
Expand Down
7 changes: 5 additions & 2 deletions src/llama_stack_client/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
from ._constants import RAW_RESPONSE_HEADER

if TYPE_CHECKING:
from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema

__all__ = ["BaseModel", "GenericModel"]

Expand Down Expand Up @@ -646,15 +646,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,

def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None:
schema = model.__pydantic_core_schema__
if schema["type"] == "definitions":
schema = schema["schema"]

if schema["type"] != "model":
return None

schema = cast("ModelSchema", schema)
fields_schema = schema["schema"]
if fields_schema["type"] != "model-fields":
return None

fields_schema = cast("ModelFieldsSchema", fields_schema)

field = fields_schema["fields"].get(field_name)
if not field:
return None
Expand Down
50 changes: 50 additions & 0 deletions src/llama_stack_client/pagination.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Generic, TypeVar, Optional
from typing_extensions import override

from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage

__all__ = ["SyncDatasetsIterrows", "AsyncDatasetsIterrows"]

_T = TypeVar("_T")


class SyncDatasetsIterrows(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
data: List[_T]
next_index: Optional[int] = None

@override
def _get_page_items(self) -> List[_T]:
data = self.data
if not data:
return []
return data

@override
def next_page_info(self) -> Optional[PageInfo]:
next_index = self.next_index
if not next_index:
return None

return PageInfo(params={"start_index": next_index})


class AsyncDatasetsIterrows(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
data: List[_T]
next_index: Optional[int] = None

@override
def _get_page_items(self) -> List[_T]:
data = self.data
if not data:
return []
return data

@override
def next_page_info(self) -> Optional[PageInfo]:
next_index = self.next_index
if not next_index:
return None

return PageInfo(params={"start_index": next_index})
14 changes: 0 additions & 14 deletions src/llama_stack_client/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,6 @@
DatasetsResourceWithStreamingResponse,
AsyncDatasetsResourceWithStreamingResponse,
)
from .datasetio import (
DatasetioResource,
AsyncDatasetioResource,
DatasetioResourceWithRawResponse,
AsyncDatasetioResourceWithRawResponse,
DatasetioResourceWithStreamingResponse,
AsyncDatasetioResourceWithStreamingResponse,
)
from .inference import (
InferenceResource,
AsyncInferenceResource,
Expand Down Expand Up @@ -300,12 +292,6 @@
"AsyncTelemetryResourceWithRawResponse",
"TelemetryResourceWithStreamingResponse",
"AsyncTelemetryResourceWithStreamingResponse",
"DatasetioResource",
"AsyncDatasetioResource",
"DatasetioResourceWithRawResponse",
"AsyncDatasetioResourceWithRawResponse",
"DatasetioResourceWithStreamingResponse",
"AsyncDatasetioResourceWithStreamingResponse",
"ScoringResource",
"AsyncScoringResource",
"ScoringResourceWithRawResponse",
Expand Down
Loading