Skip to content
Closed
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
5 changes: 5 additions & 0 deletions src/llama_stack_client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import typing as _t

from . import types
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
from ._utils import file_from_path
Expand Down Expand Up @@ -84,6 +86,9 @@
"DefaultAsyncHttpxClient",
]

if not _t.TYPE_CHECKING:
from ._utils._resources_proxy import resources as resources

_setup_logging()

# Update the __module__ attribute for exported symbols so that
Expand Down
5 changes: 4 additions & 1 deletion src/llama_stack_client/_utils/_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def __dir__(self) -> Iterable[str]:
@property # type: ignore
@override
def __class__(self) -> type: # pyright: ignore
proxied = self.__get_proxied__()
try:
proxied = self.__get_proxied__()
except Exception:
return type(self)
if issubclass(type(proxied), LazyProxy):
return type(proxied)
return proxied.__class__
Expand Down
24 changes: 24 additions & 0 deletions src/llama_stack_client/_utils/_resources_proxy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from __future__ import annotations

from typing import Any
from typing_extensions import override

from ._proxy import LazyProxy


class ResourcesProxy(LazyProxy[Any]):
"""A proxy for the `llama_stack_client.resources` module.

This is used so that we can lazily import `llama_stack_client.resources` only when
needed *and* so that users can just import `llama_stack_client` and reference `llama_stack_client.resources`
"""

@override
def __load__(self) -> Any:
import importlib

mod = importlib.import_module("llama_stack_client.resources")
return mod


resources = ResourcesProxy().__as_proxied__()
4 changes: 2 additions & 2 deletions src/llama_stack_client/resources/agents/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def delete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Delete an agent by its ID.
Delete an agent by its ID and its associated sessions and turns.

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -225,7 +225,7 @@ async def delete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Delete an agent by its ID.
Delete an agent by its ID and its associated sessions and turns.

Args:
extra_headers: Send extra headers
Expand Down
4 changes: 2 additions & 2 deletions src/llama_stack_client/resources/agents/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def delete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Delete an agent session by its ID.
Delete an agent session by its ID and its associated turns.

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -277,7 +277,7 @@ async def delete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Delete an agent session by its ID.
Delete an agent session by its ID and its associated turns.

Args:
extra_headers: Send extra headers
Expand Down
34 changes: 34 additions & 0 deletions src/llama_stack_client/resources/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Benchmark:
"""
Get a benchmark by its ID.

Args:
extra_headers: Send extra headers

Expand Down Expand Up @@ -86,6 +88,7 @@ def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BenchmarkListResponse:
"""List all benchmarks."""
return self._get(
"/v1/eval/benchmarks",
options=make_request_options(
Expand Down Expand Up @@ -115,7 +118,21 @@ def register(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Register a benchmark.

Args:
benchmark_id: The ID of the benchmark to register.

dataset_id: The ID of the dataset to use for the benchmark.

scoring_functions: The scoring functions to use for the benchmark.

metadata: The metadata to use for the benchmark.

provider_benchmark_id: The ID of the provider benchmark to use for the benchmark.

provider_id: The ID of the provider to use for the benchmark.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand Down Expand Up @@ -177,6 +194,8 @@ async def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Benchmark:
"""
Get a benchmark by its ID.

Args:
extra_headers: Send extra headers

Expand Down Expand Up @@ -206,6 +225,7 @@ async def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BenchmarkListResponse:
"""List all benchmarks."""
return await self._get(
"/v1/eval/benchmarks",
options=make_request_options(
Expand Down Expand Up @@ -235,7 +255,21 @@ async def register(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Register a benchmark.

Args:
benchmark_id: The ID of the benchmark to register.

dataset_id: The ID of the dataset to use for the benchmark.

scoring_functions: The scoring functions to use for the benchmark.

metadata: The metadata to use for the benchmark.

provider_benchmark_id: The ID of the provider benchmark to use for the benchmark.

provider_id: The ID of the provider to use for the benchmark.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand Down
Loading
Loading