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
16 changes: 8 additions & 8 deletions src/llama_stack_client/resources/post_training/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Type, Optional, cast
from typing import List, Type, Optional, cast

import httpx

Expand All @@ -22,7 +22,7 @@
from ..._wrappers import DataWrapper
from ..._base_client import make_request_options
from ...types.post_training import job_cancel_params, job_status_params, job_artifacts_params
from ...types.post_training.job_list_response import JobListResponse
from ...types.list_post_training_jobs_response import Data
from ...types.post_training.job_status_response import JobStatusResponse
from ...types.post_training.job_artifacts_response import JobArtifactsResponse

Expand Down Expand Up @@ -58,17 +58,17 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> JobListResponse:
) -> List[Data]:
return self._get(
"/v1/post-training/jobs",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=DataWrapper[JobListResponse]._unwrapper,
post_parser=DataWrapper[List[Data]]._unwrapper,
),
cast_to=cast(Type[JobListResponse], DataWrapper[JobListResponse]),
cast_to=cast(Type[List[Data]], DataWrapper[Data]),
)

def artifacts(
Expand Down Expand Up @@ -198,17 +198,17 @@ async def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> JobListResponse:
) -> List[Data]:
return await self._get(
"/v1/post-training/jobs",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=DataWrapper[JobListResponse]._unwrapper,
post_parser=DataWrapper[List[Data]]._unwrapper,
),
cast_to=cast(Type[JobListResponse], DataWrapper[JobListResponse]),
cast_to=cast(Type[List[Data]], DataWrapper[Data]),
)

async def artifacts(
Expand Down
2 changes: 1 addition & 1 deletion src/llama_stack_client/types/inference_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class InferenceStep(BaseModel):
inference_model_response: CompletionMessage = FieldInfo(alias="model_response")
api_model_response: CompletionMessage = FieldInfo(alias="model_response")

step_id: str

Expand Down
25 changes: 3 additions & 22 deletions src/llama_stack_client/types/list_datasets_response.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Dict, List, Union
from typing_extensions import Literal

from .._models import BaseModel
from .shared.url import URL
from .shared.param_type import ParamType
from .dataset_list_response import DatasetListResponse

__all__ = ["ListDatasetsResponse", "Data"]


class Data(BaseModel):
dataset_schema: Dict[str, ParamType]

identifier: str

metadata: Dict[str, Union[bool, float, str, List[object], object, None]]

provider_id: str

provider_resource_id: str

type: Literal["dataset"]

url: URL
__all__ = ["ListDatasetsResponse"]


class ListDatasetsResponse(BaseModel):
data: List[Data]
data: DatasetListResponse
5 changes: 2 additions & 3 deletions src/llama_stack_client/types/list_eval_tasks_response.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List

from .._models import BaseModel
from .eval_task import EvalTask
from .eval_task_list_response import EvalTaskListResponse

__all__ = ["ListEvalTasksResponse"]


class ListEvalTasksResponse(BaseModel):
data: List[EvalTask]
data: EvalTaskListResponse
5 changes: 2 additions & 3 deletions src/llama_stack_client/types/list_models_response.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List

from .model import Model
from .._models import BaseModel
from .model_list_response import ModelListResponse

__all__ = ["ListModelsResponse"]


class ListModelsResponse(BaseModel):
data: List[Model]
data: ModelListResponse
5 changes: 2 additions & 3 deletions src/llama_stack_client/types/list_providers_response.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List

from .._models import BaseModel
from .provider_info import ProviderInfo
from .provider_list_response import ProviderListResponse

__all__ = ["ListProvidersResponse"]


class ListProvidersResponse(BaseModel):
data: List[ProviderInfo]
data: ProviderListResponse
5 changes: 2 additions & 3 deletions src/llama_stack_client/types/list_routes_response.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List

from .._models import BaseModel
from .route_info import RouteInfo
from .route_list_response import RouteListResponse

__all__ = ["ListRoutesResponse"]


class ListRoutesResponse(BaseModel):
data: List[RouteInfo]
data: RouteListResponse
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List

from .._models import BaseModel
from .scoring_fn import ScoringFn
from .scoring_function_list_response import ScoringFunctionListResponse

__all__ = ["ListScoringFunctionsResponse"]


class ListScoringFunctionsResponse(BaseModel):
data: List[ScoringFn]
data: ScoringFunctionListResponse
5 changes: 2 additions & 3 deletions src/llama_stack_client/types/list_shields_response.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List

from .shield import Shield
from .._models import BaseModel
from .shield_list_response import ShieldListResponse

__all__ = ["ListShieldsResponse"]


class ListShieldsResponse(BaseModel):
data: List[Shield]
data: ShieldListResponse
5 changes: 2 additions & 3 deletions src/llama_stack_client/types/list_tool_groups_response.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List

from .._models import BaseModel
from .tool_group import ToolGroup
from .toolgroup_list_response import ToolgroupListResponse

__all__ = ["ListToolGroupsResponse"]


class ListToolGroupsResponse(BaseModel):
data: List[ToolGroup]
data: ToolgroupListResponse
5 changes: 2 additions & 3 deletions src/llama_stack_client/types/list_tools_response.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List

from .tool import Tool
from .._models import BaseModel
from .tool_list_response import ToolListResponse

__all__ = ["ListToolsResponse"]


class ListToolsResponse(BaseModel):
data: List[Tool]
data: ToolListResponse
21 changes: 3 additions & 18 deletions src/llama_stack_client/types/list_vector_dbs_response.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List
from typing_extensions import Literal

from .._models import BaseModel
from .vector_db_list_response import VectorDBListResponse

__all__ = ["ListVectorDBsResponse", "Data"]


class Data(BaseModel):
embedding_dimension: int

embedding_model: str

identifier: str

provider_id: str

provider_resource_id: str

type: Literal["vector_db"]
__all__ = ["ListVectorDBsResponse"]


class ListVectorDBsResponse(BaseModel):
data: List[Data]
data: VectorDBListResponse
23 changes: 3 additions & 20 deletions src/llama_stack_client/types/query_spans_response.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,11 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Dict, List, Union, Optional
from datetime import datetime

from .._models import BaseModel
from .telemetry_query_spans_response import TelemetryQuerySpansResponse

__all__ = ["QuerySpansResponse", "Data"]


class Data(BaseModel):
name: str

span_id: str

start_time: datetime

trace_id: str

attributes: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None

end_time: Optional[datetime] = None

parent_span_id: Optional[str] = None
__all__ = ["QuerySpansResponse"]


class QuerySpansResponse(BaseModel):
data: List[Data]
data: TelemetryQuerySpansResponse
16 changes: 8 additions & 8 deletions tests/api_resources/post_training/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
from __future__ import annotations

import os
from typing import Any, Optional, cast
from typing import Any, List, Optional, cast

import pytest

from tests.utils import assert_matches_type
from llama_stack_client import LlamaStackClient, AsyncLlamaStackClient
from llama_stack_client.types.post_training import (
JobListResponse,
JobStatusResponse,
JobArtifactsResponse,
)
from llama_stack_client.types.list_post_training_jobs_response import Data

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")

Expand All @@ -24,7 +24,7 @@ class TestJob:
@parametrize
def test_method_list(self, client: LlamaStackClient) -> None:
job = client.post_training.job.list()
assert_matches_type(JobListResponse, job, path=["response"])
assert_matches_type(List[Data], job, path=["response"])

@parametrize
def test_raw_response_list(self, client: LlamaStackClient) -> None:
Expand All @@ -33,7 +33,7 @@ def test_raw_response_list(self, client: LlamaStackClient) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
job = response.parse()
assert_matches_type(JobListResponse, job, path=["response"])
assert_matches_type(List[Data], job, path=["response"])

@parametrize
def test_streaming_response_list(self, client: LlamaStackClient) -> None:
Expand All @@ -42,7 +42,7 @@ def test_streaming_response_list(self, client: LlamaStackClient) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

job = response.parse()
assert_matches_type(JobListResponse, job, path=["response"])
assert_matches_type(List[Data], job, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down Expand Up @@ -146,7 +146,7 @@ class TestAsyncJob:
@parametrize
async def test_method_list(self, async_client: AsyncLlamaStackClient) -> None:
job = await async_client.post_training.job.list()
assert_matches_type(JobListResponse, job, path=["response"])
assert_matches_type(List[Data], job, path=["response"])

@parametrize
async def test_raw_response_list(self, async_client: AsyncLlamaStackClient) -> None:
Expand All @@ -155,7 +155,7 @@ async def test_raw_response_list(self, async_client: AsyncLlamaStackClient) -> N
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
job = await response.parse()
assert_matches_type(JobListResponse, job, path=["response"])
assert_matches_type(List[Data], job, path=["response"])

@parametrize
async def test_streaming_response_list(self, async_client: AsyncLlamaStackClient) -> None:
Expand All @@ -164,7 +164,7 @@ async def test_streaming_response_list(self, async_client: AsyncLlamaStackClient
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

job = await response.parse()
assert_matches_type(JobListResponse, job, path=["response"])
assert_matches_type(List[Data], job, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down