From 2c3291c59b92baa4666483c93eaf98e80de169ea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 03:42:12 +0000 Subject: [PATCH 1/4] chore(internal): grammar fix (it's -> its) --- src/llama_stack_client/_utils/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/llama_stack_client/_utils/_utils.py b/src/llama_stack_client/_utils/_utils.py index 90d1439c..b2dcaab2 100644 --- a/src/llama_stack_client/_utils/_utils.py +++ b/src/llama_stack_client/_utils/_utils.py @@ -139,7 +139,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: # Type safe methods for narrowing types with TypeVars. # The default narrowing for isinstance(obj, dict) is dict[unknown, unknown], # however this cause Pyright to rightfully report errors. As we know we don't -# care about the contained types we can safely use `object` in it's place. +# care about the contained types we can safely use `object` in its place. # # There are two separate functions defined, `is_*` and `is_*_t` for different use cases. # `is_*` is for when you're dealing with an unknown input From ae9e51bbf79cff7ddc3e1c2e0edeec77891e2374 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 04:52:44 +0000 Subject: [PATCH 2/4] feat(api): remove agents types --- .stats.yml | 8 +- api.md | 79 -- .../resources/alpha/__init__.py | 14 - .../resources/alpha/agents/__init__.py | 67 -- .../resources/alpha/agents/agents.py | 534 --------- .../resources/alpha/agents/session.py | 477 -------- .../resources/alpha/agents/steps.py | 187 --- .../resources/alpha/agents/turn.py | 881 -------------- .../resources/alpha/alpha.py | 32 - src/llama_stack_client/types/__init__.py | 7 - .../types/alpha/__init__.py | 11 - .../types/alpha/agent_create_params.py | 20 - .../types/alpha/agent_create_response.py | 16 - .../types/alpha/agent_list_params.py | 21 - .../types/alpha/agent_list_response.py | 24 - .../types/alpha/agent_retrieve_response.py | 25 - .../types/alpha/agents/__init__.py | 22 - .../agent_turn_response_stream_chunk.py | 17 - .../types/alpha/agents/session.py | 29 - .../alpha/agents/session_create_params.py | 18 - .../alpha/agents/session_create_response.py | 16 - .../types/alpha/agents/session_list_params.py | 21 - .../alpha/agents/session_list_response.py | 24 - .../alpha/agents/session_retrieve_params.py | 22 - .../alpha/agents/step_retrieve_response.py | 29 - .../types/alpha/agents/turn.py | 122 -- .../types/alpha/agents/turn_create_params.py | 170 --- .../types/alpha/agents/turn_response_event.py | 166 --- .../types/alpha/agents/turn_resume_params.py | 38 - .../types/alpha/benchmark_config_param.py | 19 +- .../types/alpha/inference_step.py | 38 - .../types/alpha/memory_retrieval_step.py | 39 - .../types/alpha/shield_call_step.py | 36 - .../types/alpha/tool_execution_step.py | 40 - .../types/alpha/tool_response.py | 29 - .../types/alpha/tool_response_param.py | 30 - .../types/shared/__init__.py | 6 - .../types/shared/agent_config.py | 98 -- .../types/shared/completion_message.py | 37 - .../types/shared/param_type.py | 7 - .../types/shared/response_format.py | 39 - .../types/shared/tool_call.py | 22 - .../types/shared/tool_response_message.py | 25 - .../types/shared/user_message.py | 29 - .../types/shared_params/__init__.py | 4 - .../types/shared_params/agent_config.py | 100 -- .../types/shared_params/response_format.py | 36 - .../shared_params/tool_response_message.py | 26 - .../types/shared_params/user_message.py | 29 - .../types/tool_def_param.py | 34 - tests/api_resources/alpha/agents/__init__.py | 7 - .../alpha/agents/test_session.py | 422 ------- .../api_resources/alpha/agents/test_steps.py | 178 --- tests/api_resources/alpha/agents/test_turn.py | 1036 ----------------- tests/api_resources/alpha/test_agents.py | 418 ------- 55 files changed, 8 insertions(+), 5873 deletions(-) delete mode 100644 src/llama_stack_client/resources/alpha/agents/__init__.py delete mode 100644 src/llama_stack_client/resources/alpha/agents/agents.py delete mode 100644 src/llama_stack_client/resources/alpha/agents/session.py delete mode 100644 src/llama_stack_client/resources/alpha/agents/steps.py delete mode 100644 src/llama_stack_client/resources/alpha/agents/turn.py delete mode 100644 src/llama_stack_client/types/alpha/agent_create_params.py delete mode 100644 src/llama_stack_client/types/alpha/agent_create_response.py delete mode 100644 src/llama_stack_client/types/alpha/agent_list_params.py delete mode 100644 src/llama_stack_client/types/alpha/agent_list_response.py delete mode 100644 src/llama_stack_client/types/alpha/agent_retrieve_response.py delete mode 100644 src/llama_stack_client/types/alpha/agents/__init__.py delete mode 100644 src/llama_stack_client/types/alpha/agents/agent_turn_response_stream_chunk.py delete mode 100644 src/llama_stack_client/types/alpha/agents/session.py delete mode 100644 src/llama_stack_client/types/alpha/agents/session_create_params.py delete mode 100644 src/llama_stack_client/types/alpha/agents/session_create_response.py delete mode 100644 src/llama_stack_client/types/alpha/agents/session_list_params.py delete mode 100644 src/llama_stack_client/types/alpha/agents/session_list_response.py delete mode 100644 src/llama_stack_client/types/alpha/agents/session_retrieve_params.py delete mode 100644 src/llama_stack_client/types/alpha/agents/step_retrieve_response.py delete mode 100644 src/llama_stack_client/types/alpha/agents/turn.py delete mode 100644 src/llama_stack_client/types/alpha/agents/turn_create_params.py delete mode 100644 src/llama_stack_client/types/alpha/agents/turn_response_event.py delete mode 100644 src/llama_stack_client/types/alpha/agents/turn_resume_params.py delete mode 100644 src/llama_stack_client/types/alpha/inference_step.py delete mode 100644 src/llama_stack_client/types/alpha/memory_retrieval_step.py delete mode 100644 src/llama_stack_client/types/alpha/shield_call_step.py delete mode 100644 src/llama_stack_client/types/alpha/tool_execution_step.py delete mode 100644 src/llama_stack_client/types/alpha/tool_response.py delete mode 100644 src/llama_stack_client/types/alpha/tool_response_param.py delete mode 100644 src/llama_stack_client/types/shared/agent_config.py delete mode 100644 src/llama_stack_client/types/shared/completion_message.py delete mode 100644 src/llama_stack_client/types/shared/response_format.py delete mode 100644 src/llama_stack_client/types/shared/tool_call.py delete mode 100644 src/llama_stack_client/types/shared/tool_response_message.py delete mode 100644 src/llama_stack_client/types/shared/user_message.py delete mode 100644 src/llama_stack_client/types/shared_params/agent_config.py delete mode 100644 src/llama_stack_client/types/shared_params/response_format.py delete mode 100644 src/llama_stack_client/types/shared_params/tool_response_message.py delete mode 100644 src/llama_stack_client/types/shared_params/user_message.py delete mode 100644 src/llama_stack_client/types/tool_def_param.py delete mode 100644 tests/api_resources/alpha/agents/__init__.py delete mode 100644 tests/api_resources/alpha/agents/test_session.py delete mode 100644 tests/api_resources/alpha/agents/test_steps.py delete mode 100644 tests/api_resources/alpha/agents/test_turn.py delete mode 100644 tests/api_resources/alpha/test_agents.py diff --git a/.stats.yml b/.stats.yml index 8df73aad..1ea29b6e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 110 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-d95665c12a4155ef6ae80f76545152ac241d3ccab18148e4add99c0f528b9634.yml -openapi_spec_hash: b6073c3436942c3ea6cd6c23f71a1cc4 -config_hash: 597b56196f814dd58c2cb2465aab9c9e +configured_endpoints: 98 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-8ca5cbc3919d101274c4f94c6046257b410584281f4e05ee4dc0ebacd7adb355.yml +openapi_spec_hash: ee5e6406a8e0bfb84f810c2123e86ea5 +config_hash: 319472b9562b59beb08b5c9f73238806 diff --git a/api.md b/api.md index f57f325f..ddc0455b 100644 --- a/api.md +++ b/api.md @@ -2,22 +2,16 @@ ```python from llama_stack_client.types import ( - AgentConfig, - CompletionMessage, Document, InterleavedContent, InterleavedContentItem, ParamType, QueryConfig, QueryResult, - ResponseFormat, SafetyViolation, SamplingParams, ScoringResult, SystemMessage, - ToolCall, - ToolResponseMessage, - UserMessage, ) ``` @@ -520,79 +514,6 @@ Methods: - client.alpha.eval.jobs.cancel(job_id, \*, benchmark_id) -> None - client.alpha.eval.jobs.status(job_id, \*, benchmark_id) -> Job -## Agents - -Types: - -```python -from llama_stack_client.types.alpha import ( - InferenceStep, - MemoryRetrievalStep, - ShieldCallStep, - ToolExecutionStep, - ToolResponse, - AgentCreateResponse, - AgentRetrieveResponse, - AgentListResponse, -) -``` - -Methods: - -- client.alpha.agents.create(\*\*params) -> AgentCreateResponse -- client.alpha.agents.retrieve(agent_id) -> AgentRetrieveResponse -- client.alpha.agents.list(\*\*params) -> AgentListResponse -- client.alpha.agents.delete(agent_id) -> None - -### Session - -Types: - -```python -from llama_stack_client.types.alpha.agents import ( - Session, - SessionCreateResponse, - SessionListResponse, -) -``` - -Methods: - -- client.alpha.agents.session.create(agent_id, \*\*params) -> SessionCreateResponse -- client.alpha.agents.session.retrieve(session_id, \*, agent_id, \*\*params) -> Session -- client.alpha.agents.session.list(agent_id, \*\*params) -> SessionListResponse -- client.alpha.agents.session.delete(session_id, \*, agent_id) -> None - -### Steps - -Types: - -```python -from llama_stack_client.types.alpha.agents import StepRetrieveResponse -``` - -Methods: - -- client.alpha.agents.steps.retrieve(step_id, \*, agent_id, session_id, turn_id) -> StepRetrieveResponse - -### Turn - -Types: - -```python -from llama_stack_client.types.alpha.agents import ( - AgentTurnResponseStreamChunk, - Turn, - TurnResponseEvent, -) -``` - -Methods: - -- client.alpha.agents.turn.create(session_id, \*, agent_id, \*\*params) -> Turn -- client.alpha.agents.turn.retrieve(turn_id, \*, agent_id, session_id) -> Turn -- client.alpha.agents.turn.resume(turn_id, \*, agent_id, session_id, \*\*params) -> Turn - # Beta ## Datasets diff --git a/src/llama_stack_client/resources/alpha/__init__.py b/src/llama_stack_client/resources/alpha/__init__.py index ae13bed1..8f9653d5 100644 --- a/src/llama_stack_client/resources/alpha/__init__.py +++ b/src/llama_stack_client/resources/alpha/__init__.py @@ -22,14 +22,6 @@ AlphaResourceWithStreamingResponse, AsyncAlphaResourceWithStreamingResponse, ) -from .agents import ( - AgentsResource, - AsyncAgentsResource, - AgentsResourceWithRawResponse, - AsyncAgentsResourceWithRawResponse, - AgentsResourceWithStreamingResponse, - AsyncAgentsResourceWithStreamingResponse, -) from .inference import ( InferenceResource, AsyncInferenceResource, @@ -80,12 +72,6 @@ "AsyncEvalResourceWithRawResponse", "EvalResourceWithStreamingResponse", "AsyncEvalResourceWithStreamingResponse", - "AgentsResource", - "AsyncAgentsResource", - "AgentsResourceWithRawResponse", - "AsyncAgentsResourceWithRawResponse", - "AgentsResourceWithStreamingResponse", - "AsyncAgentsResourceWithStreamingResponse", "AlphaResource", "AsyncAlphaResource", "AlphaResourceWithRawResponse", diff --git a/src/llama_stack_client/resources/alpha/agents/__init__.py b/src/llama_stack_client/resources/alpha/agents/__init__.py deleted file mode 100644 index 6502dfa1..00000000 --- a/src/llama_stack_client/resources/alpha/agents/__init__.py +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .turn import ( - TurnResource, - AsyncTurnResource, - TurnResourceWithRawResponse, - AsyncTurnResourceWithRawResponse, - TurnResourceWithStreamingResponse, - AsyncTurnResourceWithStreamingResponse, -) -from .steps import ( - StepsResource, - AsyncStepsResource, - StepsResourceWithRawResponse, - AsyncStepsResourceWithRawResponse, - StepsResourceWithStreamingResponse, - AsyncStepsResourceWithStreamingResponse, -) -from .agents import ( - AgentsResource, - AsyncAgentsResource, - AgentsResourceWithRawResponse, - AsyncAgentsResourceWithRawResponse, - AgentsResourceWithStreamingResponse, - AsyncAgentsResourceWithStreamingResponse, -) -from .session import ( - SessionResource, - AsyncSessionResource, - SessionResourceWithRawResponse, - AsyncSessionResourceWithRawResponse, - SessionResourceWithStreamingResponse, - AsyncSessionResourceWithStreamingResponse, -) - -__all__ = [ - "SessionResource", - "AsyncSessionResource", - "SessionResourceWithRawResponse", - "AsyncSessionResourceWithRawResponse", - "SessionResourceWithStreamingResponse", - "AsyncSessionResourceWithStreamingResponse", - "StepsResource", - "AsyncStepsResource", - "StepsResourceWithRawResponse", - "AsyncStepsResourceWithRawResponse", - "StepsResourceWithStreamingResponse", - "AsyncStepsResourceWithStreamingResponse", - "TurnResource", - "AsyncTurnResource", - "TurnResourceWithRawResponse", - "AsyncTurnResourceWithRawResponse", - "TurnResourceWithStreamingResponse", - "AsyncTurnResourceWithStreamingResponse", - "AgentsResource", - "AsyncAgentsResource", - "AgentsResourceWithRawResponse", - "AsyncAgentsResourceWithRawResponse", - "AgentsResourceWithStreamingResponse", - "AsyncAgentsResourceWithStreamingResponse", -] diff --git a/src/llama_stack_client/resources/alpha/agents/agents.py b/src/llama_stack_client/resources/alpha/agents/agents.py deleted file mode 100644 index ac5f58e4..00000000 --- a/src/llama_stack_client/resources/alpha/agents/agents.py +++ /dev/null @@ -1,534 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .turn import ( - TurnResource, - AsyncTurnResource, - TurnResourceWithRawResponse, - AsyncTurnResourceWithRawResponse, - TurnResourceWithStreamingResponse, - AsyncTurnResourceWithStreamingResponse, -) -from .steps import ( - StepsResource, - AsyncStepsResource, - StepsResourceWithRawResponse, - AsyncStepsResourceWithRawResponse, - StepsResourceWithStreamingResponse, - AsyncStepsResourceWithStreamingResponse, -) -from .session import ( - SessionResource, - AsyncSessionResource, - SessionResourceWithRawResponse, - AsyncSessionResourceWithRawResponse, - SessionResourceWithStreamingResponse, - AsyncSessionResourceWithStreamingResponse, -) -from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ....types.alpha import agent_list_params, agent_create_params -from ...._base_client import make_request_options -from ....types.alpha.agent_list_response import AgentListResponse -from ....types.shared_params.agent_config import AgentConfig -from ....types.alpha.agent_create_response import AgentCreateResponse -from ....types.alpha.agent_retrieve_response import AgentRetrieveResponse - -__all__ = ["AgentsResource", "AsyncAgentsResource"] - - -class AgentsResource(SyncAPIResource): - @cached_property - def session(self) -> SessionResource: - return SessionResource(self._client) - - @cached_property - def steps(self) -> StepsResource: - return StepsResource(self._client) - - @cached_property - def turn(self) -> TurnResource: - return TurnResource(self._client) - - @cached_property - def with_raw_response(self) -> AgentsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers - """ - return AgentsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AgentsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response - """ - return AgentsResourceWithStreamingResponse(self) - - def create( - self, - *, - agent_config: AgentConfig, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AgentCreateResponse: - """ - Create an agent with the given configuration. - - Args: - agent_config: The configuration for the agent. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._post( - "/v1alpha/agents", - body=maybe_transform({"agent_config": agent_config}, agent_create_params.AgentCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AgentCreateResponse, - ) - - def retrieve( - self, - agent_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AgentRetrieveResponse: - """ - Describe an agent by its ID. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - return self._get( - f"/v1alpha/agents/{agent_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AgentRetrieveResponse, - ) - - def list( - self, - *, - limit: int | Omit = omit, - start_index: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AgentListResponse: - """ - List all agents. - - Args: - limit: The number of agents to return. - - start_index: The index to start the pagination from. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get( - "/v1alpha/agents", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "limit": limit, - "start_index": start_index, - }, - agent_list_params.AgentListParams, - ), - ), - cast_to=AgentListResponse, - ) - - def delete( - self, - agent_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Delete an agent by its ID and its associated sessions and turns. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._delete( - f"/v1alpha/agents/{agent_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AsyncAgentsResource(AsyncAPIResource): - @cached_property - def session(self) -> AsyncSessionResource: - return AsyncSessionResource(self._client) - - @cached_property - def steps(self) -> AsyncStepsResource: - return AsyncStepsResource(self._client) - - @cached_property - def turn(self) -> AsyncTurnResource: - return AsyncTurnResource(self._client) - - @cached_property - def with_raw_response(self) -> AsyncAgentsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers - """ - return AsyncAgentsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncAgentsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response - """ - return AsyncAgentsResourceWithStreamingResponse(self) - - async def create( - self, - *, - agent_config: AgentConfig, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AgentCreateResponse: - """ - Create an agent with the given configuration. - - Args: - agent_config: The configuration for the agent. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._post( - "/v1alpha/agents", - body=await async_maybe_transform({"agent_config": agent_config}, agent_create_params.AgentCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AgentCreateResponse, - ) - - async def retrieve( - self, - agent_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AgentRetrieveResponse: - """ - Describe an agent by its ID. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - return await self._get( - f"/v1alpha/agents/{agent_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=AgentRetrieveResponse, - ) - - async def list( - self, - *, - limit: int | Omit = omit, - start_index: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AgentListResponse: - """ - List all agents. - - Args: - limit: The number of agents to return. - - start_index: The index to start the pagination from. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - return await self._get( - "/v1alpha/agents", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "limit": limit, - "start_index": start_index, - }, - agent_list_params.AgentListParams, - ), - ), - cast_to=AgentListResponse, - ) - - async def delete( - self, - agent_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Delete an agent by its ID and its associated sessions and turns. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._delete( - f"/v1alpha/agents/{agent_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AgentsResourceWithRawResponse: - def __init__(self, agents: AgentsResource) -> None: - self._agents = agents - - self.create = to_raw_response_wrapper( - agents.create, - ) - self.retrieve = to_raw_response_wrapper( - agents.retrieve, - ) - self.list = to_raw_response_wrapper( - agents.list, - ) - self.delete = to_raw_response_wrapper( - agents.delete, - ) - - @cached_property - def session(self) -> SessionResourceWithRawResponse: - return SessionResourceWithRawResponse(self._agents.session) - - @cached_property - def steps(self) -> StepsResourceWithRawResponse: - return StepsResourceWithRawResponse(self._agents.steps) - - @cached_property - def turn(self) -> TurnResourceWithRawResponse: - return TurnResourceWithRawResponse(self._agents.turn) - - -class AsyncAgentsResourceWithRawResponse: - def __init__(self, agents: AsyncAgentsResource) -> None: - self._agents = agents - - self.create = async_to_raw_response_wrapper( - agents.create, - ) - self.retrieve = async_to_raw_response_wrapper( - agents.retrieve, - ) - self.list = async_to_raw_response_wrapper( - agents.list, - ) - self.delete = async_to_raw_response_wrapper( - agents.delete, - ) - - @cached_property - def session(self) -> AsyncSessionResourceWithRawResponse: - return AsyncSessionResourceWithRawResponse(self._agents.session) - - @cached_property - def steps(self) -> AsyncStepsResourceWithRawResponse: - return AsyncStepsResourceWithRawResponse(self._agents.steps) - - @cached_property - def turn(self) -> AsyncTurnResourceWithRawResponse: - return AsyncTurnResourceWithRawResponse(self._agents.turn) - - -class AgentsResourceWithStreamingResponse: - def __init__(self, agents: AgentsResource) -> None: - self._agents = agents - - self.create = to_streamed_response_wrapper( - agents.create, - ) - self.retrieve = to_streamed_response_wrapper( - agents.retrieve, - ) - self.list = to_streamed_response_wrapper( - agents.list, - ) - self.delete = to_streamed_response_wrapper( - agents.delete, - ) - - @cached_property - def session(self) -> SessionResourceWithStreamingResponse: - return SessionResourceWithStreamingResponse(self._agents.session) - - @cached_property - def steps(self) -> StepsResourceWithStreamingResponse: - return StepsResourceWithStreamingResponse(self._agents.steps) - - @cached_property - def turn(self) -> TurnResourceWithStreamingResponse: - return TurnResourceWithStreamingResponse(self._agents.turn) - - -class AsyncAgentsResourceWithStreamingResponse: - def __init__(self, agents: AsyncAgentsResource) -> None: - self._agents = agents - - self.create = async_to_streamed_response_wrapper( - agents.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - agents.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - agents.list, - ) - self.delete = async_to_streamed_response_wrapper( - agents.delete, - ) - - @cached_property - def session(self) -> AsyncSessionResourceWithStreamingResponse: - return AsyncSessionResourceWithStreamingResponse(self._agents.session) - - @cached_property - def steps(self) -> AsyncStepsResourceWithStreamingResponse: - return AsyncStepsResourceWithStreamingResponse(self._agents.steps) - - @cached_property - def turn(self) -> AsyncTurnResourceWithStreamingResponse: - return AsyncTurnResourceWithStreamingResponse(self._agents.turn) diff --git a/src/llama_stack_client/resources/alpha/agents/session.py b/src/llama_stack_client/resources/alpha/agents/session.py deleted file mode 100644 index ae2b5af6..00000000 --- a/src/llama_stack_client/resources/alpha/agents/session.py +++ /dev/null @@ -1,477 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.alpha.agents import session_list_params, session_create_params, session_retrieve_params -from ....types.alpha.agents.session import Session -from ....types.alpha.agents.session_list_response import SessionListResponse -from ....types.alpha.agents.session_create_response import SessionCreateResponse - -__all__ = ["SessionResource", "AsyncSessionResource"] - - -class SessionResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> SessionResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers - """ - return SessionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> SessionResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response - """ - return SessionResourceWithStreamingResponse(self) - - def create( - self, - agent_id: str, - *, - session_name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SessionCreateResponse: - """ - Create a new session for an agent. - - Args: - session_name: The name of the session to create. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - return self._post( - f"/v1alpha/agents/{agent_id}/session", - body=maybe_transform({"session_name": session_name}, session_create_params.SessionCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=SessionCreateResponse, - ) - - def retrieve( - self, - session_id: str, - *, - agent_id: str, - turn_ids: SequenceNotStr[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Session: - """ - Retrieve an agent session by its ID. - - Args: - turn_ids: (Optional) List of turn IDs to filter the session by. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - return self._get( - f"/v1alpha/agents/{agent_id}/session/{session_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform({"turn_ids": turn_ids}, session_retrieve_params.SessionRetrieveParams), - ), - cast_to=Session, - ) - - def list( - self, - agent_id: str, - *, - limit: int | Omit = omit, - start_index: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SessionListResponse: - """ - List all session(s) of a given agent. - - Args: - limit: The number of sessions to return. - - start_index: The index to start the pagination from. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - return self._get( - f"/v1alpha/agents/{agent_id}/sessions", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "limit": limit, - "start_index": start_index, - }, - session_list_params.SessionListParams, - ), - ), - cast_to=SessionListResponse, - ) - - def delete( - self, - session_id: str, - *, - agent_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Delete an agent session by its ID and its associated turns. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._delete( - f"/v1alpha/agents/{agent_id}/session/{session_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class AsyncSessionResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncSessionResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers - """ - return AsyncSessionResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncSessionResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response - """ - return AsyncSessionResourceWithStreamingResponse(self) - - async def create( - self, - agent_id: str, - *, - session_name: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SessionCreateResponse: - """ - Create a new session for an agent. - - Args: - session_name: The name of the session to create. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - return await self._post( - f"/v1alpha/agents/{agent_id}/session", - body=await async_maybe_transform({"session_name": session_name}, session_create_params.SessionCreateParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=SessionCreateResponse, - ) - - async def retrieve( - self, - session_id: str, - *, - agent_id: str, - turn_ids: SequenceNotStr[str] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Session: - """ - Retrieve an agent session by its ID. - - Args: - turn_ids: (Optional) List of turn IDs to filter the session by. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - return await self._get( - f"/v1alpha/agents/{agent_id}/session/{session_id}", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - {"turn_ids": turn_ids}, session_retrieve_params.SessionRetrieveParams - ), - ), - cast_to=Session, - ) - - async def list( - self, - agent_id: str, - *, - limit: int | Omit = omit, - start_index: int | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> SessionListResponse: - """ - List all session(s) of a given agent. - - Args: - limit: The number of sessions to return. - - start_index: The index to start the pagination from. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - return await self._get( - f"/v1alpha/agents/{agent_id}/sessions", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=await async_maybe_transform( - { - "limit": limit, - "start_index": start_index, - }, - session_list_params.SessionListParams, - ), - ), - cast_to=SessionListResponse, - ) - - async def delete( - self, - session_id: str, - *, - agent_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> None: - """ - Delete an agent session by its ID and its associated turns. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._delete( - f"/v1alpha/agents/{agent_id}/session/{session_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - - -class SessionResourceWithRawResponse: - def __init__(self, session: SessionResource) -> None: - self._session = session - - self.create = to_raw_response_wrapper( - session.create, - ) - self.retrieve = to_raw_response_wrapper( - session.retrieve, - ) - self.list = to_raw_response_wrapper( - session.list, - ) - self.delete = to_raw_response_wrapper( - session.delete, - ) - - -class AsyncSessionResourceWithRawResponse: - def __init__(self, session: AsyncSessionResource) -> None: - self._session = session - - self.create = async_to_raw_response_wrapper( - session.create, - ) - self.retrieve = async_to_raw_response_wrapper( - session.retrieve, - ) - self.list = async_to_raw_response_wrapper( - session.list, - ) - self.delete = async_to_raw_response_wrapper( - session.delete, - ) - - -class SessionResourceWithStreamingResponse: - def __init__(self, session: SessionResource) -> None: - self._session = session - - self.create = to_streamed_response_wrapper( - session.create, - ) - self.retrieve = to_streamed_response_wrapper( - session.retrieve, - ) - self.list = to_streamed_response_wrapper( - session.list, - ) - self.delete = to_streamed_response_wrapper( - session.delete, - ) - - -class AsyncSessionResourceWithStreamingResponse: - def __init__(self, session: AsyncSessionResource) -> None: - self._session = session - - self.create = async_to_streamed_response_wrapper( - session.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - session.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - session.list, - ) - self.delete = async_to_streamed_response_wrapper( - session.delete, - ) diff --git a/src/llama_stack_client/resources/alpha/agents/steps.py b/src/llama_stack_client/resources/alpha/agents/steps.py deleted file mode 100644 index 83624bef..00000000 --- a/src/llama_stack_client/resources/alpha/agents/steps.py +++ /dev/null @@ -1,187 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ...._types import Body, Query, Headers, NotGiven, not_given -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._base_client import make_request_options -from ....types.alpha.agents.step_retrieve_response import StepRetrieveResponse - -__all__ = ["StepsResource", "AsyncStepsResource"] - - -class StepsResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> StepsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers - """ - return StepsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> StepsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response - """ - return StepsResourceWithStreamingResponse(self) - - def retrieve( - self, - step_id: str, - *, - agent_id: str, - session_id: str, - turn_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StepRetrieveResponse: - """ - Retrieve an agent step by its ID. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - if not turn_id: - raise ValueError(f"Expected a non-empty value for `turn_id` but received {turn_id!r}") - if not step_id: - raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") - return self._get( - f"/v1alpha/agents/{agent_id}/session/{session_id}/turn/{turn_id}/step/{step_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=StepRetrieveResponse, - ) - - -class AsyncStepsResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncStepsResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers - """ - return AsyncStepsResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncStepsResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response - """ - return AsyncStepsResourceWithStreamingResponse(self) - - async def retrieve( - self, - step_id: str, - *, - agent_id: str, - session_id: str, - turn_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> StepRetrieveResponse: - """ - Retrieve an agent step by its ID. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - if not turn_id: - raise ValueError(f"Expected a non-empty value for `turn_id` but received {turn_id!r}") - if not step_id: - raise ValueError(f"Expected a non-empty value for `step_id` but received {step_id!r}") - return await self._get( - f"/v1alpha/agents/{agent_id}/session/{session_id}/turn/{turn_id}/step/{step_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=StepRetrieveResponse, - ) - - -class StepsResourceWithRawResponse: - def __init__(self, steps: StepsResource) -> None: - self._steps = steps - - self.retrieve = to_raw_response_wrapper( - steps.retrieve, - ) - - -class AsyncStepsResourceWithRawResponse: - def __init__(self, steps: AsyncStepsResource) -> None: - self._steps = steps - - self.retrieve = async_to_raw_response_wrapper( - steps.retrieve, - ) - - -class StepsResourceWithStreamingResponse: - def __init__(self, steps: StepsResource) -> None: - self._steps = steps - - self.retrieve = to_streamed_response_wrapper( - steps.retrieve, - ) - - -class AsyncStepsResourceWithStreamingResponse: - def __init__(self, steps: AsyncStepsResource) -> None: - self._steps = steps - - self.retrieve = async_to_streamed_response_wrapper( - steps.retrieve, - ) diff --git a/src/llama_stack_client/resources/alpha/agents/turn.py b/src/llama_stack_client/resources/alpha/agents/turn.py deleted file mode 100644 index 85e3d1e5..00000000 --- a/src/llama_stack_client/resources/alpha/agents/turn.py +++ /dev/null @@ -1,881 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Iterable -from typing_extensions import Literal, overload - -import httpx - -from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given -from ...._utils import required_args, maybe_transform, async_maybe_transform -from ...._compat import cached_property -from ...._resource import SyncAPIResource, AsyncAPIResource -from ...._response import ( - to_raw_response_wrapper, - to_streamed_response_wrapper, - async_to_raw_response_wrapper, - async_to_streamed_response_wrapper, -) -from ...._streaming import Stream, AsyncStream -from ...._base_client import make_request_options -from ....types.alpha.agents import turn_create_params, turn_resume_params -from ....types.alpha.agents.turn import Turn -from ....types.alpha.tool_response_param import ToolResponseParam -from ....types.alpha.agents.agent_turn_response_stream_chunk import AgentTurnResponseStreamChunk - -__all__ = ["TurnResource", "AsyncTurnResource"] - - -class TurnResource(SyncAPIResource): - @cached_property - def with_raw_response(self) -> TurnResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers - """ - return TurnResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> TurnResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response - """ - return TurnResourceWithStreamingResponse(self) - - @overload - def create( - self, - session_id: str, - *, - agent_id: str, - messages: Iterable[turn_create_params.Message], - documents: Iterable[turn_create_params.Document] | Omit = omit, - stream: Literal[False] | Omit = omit, - tool_config: turn_create_params.ToolConfig | Omit = omit, - toolgroups: SequenceNotStr[turn_create_params.Toolgroup] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn: - """ - Create a new turn for an agent. - - Args: - messages: List of messages to start the turn with. - - documents: (Optional) List of documents to create the turn with. - - stream: (Optional) If True, generate an SSE event stream of the response. Defaults to - False. - - tool_config: (Optional) The tool configuration to create the turn with, will be used to - override the agent's tool_config. - - toolgroups: (Optional) List of toolgroups to create the turn with, will be used in addition - to the agent's config toolgroups for the request. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def create( - self, - session_id: str, - *, - agent_id: str, - messages: Iterable[turn_create_params.Message], - stream: Literal[True], - documents: Iterable[turn_create_params.Document] | Omit = omit, - tool_config: turn_create_params.ToolConfig | Omit = omit, - toolgroups: SequenceNotStr[turn_create_params.Toolgroup] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Stream[AgentTurnResponseStreamChunk]: - """ - Create a new turn for an agent. - - Args: - messages: List of messages to start the turn with. - - stream: (Optional) If True, generate an SSE event stream of the response. Defaults to - False. - - documents: (Optional) List of documents to create the turn with. - - tool_config: (Optional) The tool configuration to create the turn with, will be used to - override the agent's tool_config. - - toolgroups: (Optional) List of toolgroups to create the turn with, will be used in addition - to the agent's config toolgroups for the request. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def create( - self, - session_id: str, - *, - agent_id: str, - messages: Iterable[turn_create_params.Message], - stream: bool, - documents: Iterable[turn_create_params.Document] | Omit = omit, - tool_config: turn_create_params.ToolConfig | Omit = omit, - toolgroups: SequenceNotStr[turn_create_params.Toolgroup] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn | Stream[AgentTurnResponseStreamChunk]: - """ - Create a new turn for an agent. - - Args: - messages: List of messages to start the turn with. - - stream: (Optional) If True, generate an SSE event stream of the response. Defaults to - False. - - documents: (Optional) List of documents to create the turn with. - - tool_config: (Optional) The tool configuration to create the turn with, will be used to - override the agent's tool_config. - - toolgroups: (Optional) List of toolgroups to create the turn with, will be used in addition - to the agent's config toolgroups for the request. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @required_args(["agent_id", "messages"], ["agent_id", "messages", "stream"]) - def create( - self, - session_id: str, - *, - agent_id: str, - messages: Iterable[turn_create_params.Message], - documents: Iterable[turn_create_params.Document] | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - tool_config: turn_create_params.ToolConfig | Omit = omit, - toolgroups: SequenceNotStr[turn_create_params.Toolgroup] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn | Stream[AgentTurnResponseStreamChunk]: - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - return self._post( - f"/v1alpha/agents/{agent_id}/session/{session_id}/turn", - body=maybe_transform( - { - "messages": messages, - "documents": documents, - "stream": stream, - "tool_config": tool_config, - "toolgroups": toolgroups, - }, - turn_create_params.TurnCreateParamsStreaming - if stream - else turn_create_params.TurnCreateParamsNonStreaming, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Turn, - stream=stream or False, - stream_cls=Stream[AgentTurnResponseStreamChunk], - ) - - def retrieve( - self, - turn_id: str, - *, - agent_id: str, - session_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn: - """ - Retrieve an agent turn by its ID. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - if not turn_id: - raise ValueError(f"Expected a non-empty value for `turn_id` but received {turn_id!r}") - return self._get( - f"/v1alpha/agents/{agent_id}/session/{session_id}/turn/{turn_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Turn, - ) - - @overload - def resume( - self, - turn_id: str, - *, - agent_id: str, - session_id: str, - tool_responses: Iterable[ToolResponseParam], - stream: Literal[False] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn: - """Resume an agent turn with executed tool call responses. - - When a Turn has the - status `awaiting_input` due to pending input from client side tool calls, this - endpoint can be used to submit the outputs from the tool calls once they are - ready. - - Args: - tool_responses: The tool call responses to resume the turn with. - - stream: Whether to stream the response. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def resume( - self, - turn_id: str, - *, - agent_id: str, - session_id: str, - stream: Literal[True], - tool_responses: Iterable[ToolResponseParam], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Stream[AgentTurnResponseStreamChunk]: - """Resume an agent turn with executed tool call responses. - - When a Turn has the - status `awaiting_input` due to pending input from client side tool calls, this - endpoint can be used to submit the outputs from the tool calls once they are - ready. - - Args: - stream: Whether to stream the response. - - tool_responses: The tool call responses to resume the turn with. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - def resume( - self, - turn_id: str, - *, - agent_id: str, - session_id: str, - stream: bool, - tool_responses: Iterable[ToolResponseParam], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn | Stream[AgentTurnResponseStreamChunk]: - """Resume an agent turn with executed tool call responses. - - When a Turn has the - status `awaiting_input` due to pending input from client side tool calls, this - endpoint can be used to submit the outputs from the tool calls once they are - ready. - - Args: - stream: Whether to stream the response. - - tool_responses: The tool call responses to resume the turn with. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @required_args(["agent_id", "session_id", "tool_responses"], ["agent_id", "session_id", "stream", "tool_responses"]) - def resume( - self, - turn_id: str, - *, - agent_id: str, - session_id: str, - tool_responses: Iterable[ToolResponseParam], - stream: Literal[False] | Literal[True] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn | Stream[AgentTurnResponseStreamChunk]: - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - if not turn_id: - raise ValueError(f"Expected a non-empty value for `turn_id` but received {turn_id!r}") - return self._post( - f"/v1alpha/agents/{agent_id}/session/{session_id}/turn/{turn_id}/resume", - body=maybe_transform( - { - "tool_responses": tool_responses, - "stream": stream, - }, - turn_resume_params.TurnResumeParamsStreaming - if stream - else turn_resume_params.TurnResumeParamsNonStreaming, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Turn, - stream=stream or False, - stream_cls=Stream[AgentTurnResponseStreamChunk], - ) - - -class AsyncTurnResource(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncTurnResourceWithRawResponse: - """ - This property can be used as a prefix for any HTTP method call to return - the raw response object instead of the parsed content. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#accessing-raw-response-data-eg-headers - """ - return AsyncTurnResourceWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncTurnResourceWithStreamingResponse: - """ - An alternative to `.with_raw_response` that doesn't eagerly read the response body. - - For more information, see https://www.github.com/llamastack/llama-stack-client-python#with_streaming_response - """ - return AsyncTurnResourceWithStreamingResponse(self) - - @overload - async def create( - self, - session_id: str, - *, - agent_id: str, - messages: Iterable[turn_create_params.Message], - documents: Iterable[turn_create_params.Document] | Omit = omit, - stream: Literal[False] | Omit = omit, - tool_config: turn_create_params.ToolConfig | Omit = omit, - toolgroups: SequenceNotStr[turn_create_params.Toolgroup] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn: - """ - Create a new turn for an agent. - - Args: - messages: List of messages to start the turn with. - - documents: (Optional) List of documents to create the turn with. - - stream: (Optional) If True, generate an SSE event stream of the response. Defaults to - False. - - tool_config: (Optional) The tool configuration to create the turn with, will be used to - override the agent's tool_config. - - toolgroups: (Optional) List of toolgroups to create the turn with, will be used in addition - to the agent's config toolgroups for the request. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - session_id: str, - *, - agent_id: str, - messages: Iterable[turn_create_params.Message], - stream: Literal[True], - documents: Iterable[turn_create_params.Document] | Omit = omit, - tool_config: turn_create_params.ToolConfig | Omit = omit, - toolgroups: SequenceNotStr[turn_create_params.Toolgroup] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncStream[AgentTurnResponseStreamChunk]: - """ - Create a new turn for an agent. - - Args: - messages: List of messages to start the turn with. - - stream: (Optional) If True, generate an SSE event stream of the response. Defaults to - False. - - documents: (Optional) List of documents to create the turn with. - - tool_config: (Optional) The tool configuration to create the turn with, will be used to - override the agent's tool_config. - - toolgroups: (Optional) List of toolgroups to create the turn with, will be used in addition - to the agent's config toolgroups for the request. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def create( - self, - session_id: str, - *, - agent_id: str, - messages: Iterable[turn_create_params.Message], - stream: bool, - documents: Iterable[turn_create_params.Document] | Omit = omit, - tool_config: turn_create_params.ToolConfig | Omit = omit, - toolgroups: SequenceNotStr[turn_create_params.Toolgroup] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn | AsyncStream[AgentTurnResponseStreamChunk]: - """ - Create a new turn for an agent. - - Args: - messages: List of messages to start the turn with. - - stream: (Optional) If True, generate an SSE event stream of the response. Defaults to - False. - - documents: (Optional) List of documents to create the turn with. - - tool_config: (Optional) The tool configuration to create the turn with, will be used to - override the agent's tool_config. - - toolgroups: (Optional) List of toolgroups to create the turn with, will be used in addition - to the agent's config toolgroups for the request. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @required_args(["agent_id", "messages"], ["agent_id", "messages", "stream"]) - async def create( - self, - session_id: str, - *, - agent_id: str, - messages: Iterable[turn_create_params.Message], - documents: Iterable[turn_create_params.Document] | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - tool_config: turn_create_params.ToolConfig | Omit = omit, - toolgroups: SequenceNotStr[turn_create_params.Toolgroup] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn | AsyncStream[AgentTurnResponseStreamChunk]: - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - return await self._post( - f"/v1alpha/agents/{agent_id}/session/{session_id}/turn", - body=await async_maybe_transform( - { - "messages": messages, - "documents": documents, - "stream": stream, - "tool_config": tool_config, - "toolgroups": toolgroups, - }, - turn_create_params.TurnCreateParamsStreaming - if stream - else turn_create_params.TurnCreateParamsNonStreaming, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Turn, - stream=stream or False, - stream_cls=AsyncStream[AgentTurnResponseStreamChunk], - ) - - async def retrieve( - self, - turn_id: str, - *, - agent_id: str, - session_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn: - """ - Retrieve an agent turn by its ID. - - Args: - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - if not turn_id: - raise ValueError(f"Expected a non-empty value for `turn_id` but received {turn_id!r}") - return await self._get( - f"/v1alpha/agents/{agent_id}/session/{session_id}/turn/{turn_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Turn, - ) - - @overload - async def resume( - self, - turn_id: str, - *, - agent_id: str, - session_id: str, - tool_responses: Iterable[ToolResponseParam], - stream: Literal[False] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn: - """Resume an agent turn with executed tool call responses. - - When a Turn has the - status `awaiting_input` due to pending input from client side tool calls, this - endpoint can be used to submit the outputs from the tool calls once they are - ready. - - Args: - tool_responses: The tool call responses to resume the turn with. - - stream: Whether to stream the response. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def resume( - self, - turn_id: str, - *, - agent_id: str, - session_id: str, - stream: Literal[True], - tool_responses: Iterable[ToolResponseParam], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> AsyncStream[AgentTurnResponseStreamChunk]: - """Resume an agent turn with executed tool call responses. - - When a Turn has the - status `awaiting_input` due to pending input from client side tool calls, this - endpoint can be used to submit the outputs from the tool calls once they are - ready. - - Args: - stream: Whether to stream the response. - - tool_responses: The tool call responses to resume the turn with. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @overload - async def resume( - self, - turn_id: str, - *, - agent_id: str, - session_id: str, - stream: bool, - tool_responses: Iterable[ToolResponseParam], - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn | AsyncStream[AgentTurnResponseStreamChunk]: - """Resume an agent turn with executed tool call responses. - - When a Turn has the - status `awaiting_input` due to pending input from client side tool calls, this - endpoint can be used to submit the outputs from the tool calls once they are - ready. - - Args: - stream: Whether to stream the response. - - tool_responses: The tool call responses to resume the turn with. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request - - timeout: Override the client-level default timeout for this request, in seconds - """ - ... - - @required_args(["agent_id", "session_id", "tool_responses"], ["agent_id", "session_id", "stream", "tool_responses"]) - async def resume( - self, - turn_id: str, - *, - agent_id: str, - session_id: str, - tool_responses: Iterable[ToolResponseParam], - stream: Literal[False] | Literal[True] | Omit = omit, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> Turn | AsyncStream[AgentTurnResponseStreamChunk]: - if not agent_id: - raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") - if not session_id: - raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}") - if not turn_id: - raise ValueError(f"Expected a non-empty value for `turn_id` but received {turn_id!r}") - return await self._post( - f"/v1alpha/agents/{agent_id}/session/{session_id}/turn/{turn_id}/resume", - body=await async_maybe_transform( - { - "tool_responses": tool_responses, - "stream": stream, - }, - turn_resume_params.TurnResumeParamsStreaming - if stream - else turn_resume_params.TurnResumeParamsNonStreaming, - ), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Turn, - stream=stream or False, - stream_cls=AsyncStream[AgentTurnResponseStreamChunk], - ) - - -class TurnResourceWithRawResponse: - def __init__(self, turn: TurnResource) -> None: - self._turn = turn - - self.create = to_raw_response_wrapper( - turn.create, - ) - self.retrieve = to_raw_response_wrapper( - turn.retrieve, - ) - self.resume = to_raw_response_wrapper( - turn.resume, - ) - - -class AsyncTurnResourceWithRawResponse: - def __init__(self, turn: AsyncTurnResource) -> None: - self._turn = turn - - self.create = async_to_raw_response_wrapper( - turn.create, - ) - self.retrieve = async_to_raw_response_wrapper( - turn.retrieve, - ) - self.resume = async_to_raw_response_wrapper( - turn.resume, - ) - - -class TurnResourceWithStreamingResponse: - def __init__(self, turn: TurnResource) -> None: - self._turn = turn - - self.create = to_streamed_response_wrapper( - turn.create, - ) - self.retrieve = to_streamed_response_wrapper( - turn.retrieve, - ) - self.resume = to_streamed_response_wrapper( - turn.resume, - ) - - -class AsyncTurnResourceWithStreamingResponse: - def __init__(self, turn: AsyncTurnResource) -> None: - self._turn = turn - - self.create = async_to_streamed_response_wrapper( - turn.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - turn.retrieve, - ) - self.resume = async_to_streamed_response_wrapper( - turn.resume, - ) diff --git a/src/llama_stack_client/resources/alpha/alpha.py b/src/llama_stack_client/resources/alpha/alpha.py index 9ba65570..52560942 100644 --- a/src/llama_stack_client/resources/alpha/alpha.py +++ b/src/llama_stack_client/resources/alpha/alpha.py @@ -34,14 +34,6 @@ AsyncBenchmarksResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource -from .agents.agents import ( - AgentsResource, - AsyncAgentsResource, - AgentsResourceWithRawResponse, - AsyncAgentsResourceWithRawResponse, - AgentsResourceWithStreamingResponse, - AsyncAgentsResourceWithStreamingResponse, -) from .post_training.post_training import ( PostTrainingResource, AsyncPostTrainingResource, @@ -71,10 +63,6 @@ def benchmarks(self) -> BenchmarksResource: def eval(self) -> EvalResource: return EvalResource(self._client) - @cached_property - def agents(self) -> AgentsResource: - return AgentsResource(self._client) - @cached_property def with_raw_response(self) -> AlphaResourceWithRawResponse: """ @@ -112,10 +100,6 @@ def benchmarks(self) -> AsyncBenchmarksResource: def eval(self) -> AsyncEvalResource: return AsyncEvalResource(self._client) - @cached_property - def agents(self) -> AsyncAgentsResource: - return AsyncAgentsResource(self._client) - @cached_property def with_raw_response(self) -> AsyncAlphaResourceWithRawResponse: """ @@ -156,10 +140,6 @@ def benchmarks(self) -> BenchmarksResourceWithRawResponse: def eval(self) -> EvalResourceWithRawResponse: return EvalResourceWithRawResponse(self._alpha.eval) - @cached_property - def agents(self) -> AgentsResourceWithRawResponse: - return AgentsResourceWithRawResponse(self._alpha.agents) - class AsyncAlphaResourceWithRawResponse: def __init__(self, alpha: AsyncAlphaResource) -> None: @@ -181,10 +161,6 @@ def benchmarks(self) -> AsyncBenchmarksResourceWithRawResponse: def eval(self) -> AsyncEvalResourceWithRawResponse: return AsyncEvalResourceWithRawResponse(self._alpha.eval) - @cached_property - def agents(self) -> AsyncAgentsResourceWithRawResponse: - return AsyncAgentsResourceWithRawResponse(self._alpha.agents) - class AlphaResourceWithStreamingResponse: def __init__(self, alpha: AlphaResource) -> None: @@ -206,10 +182,6 @@ def benchmarks(self) -> BenchmarksResourceWithStreamingResponse: def eval(self) -> EvalResourceWithStreamingResponse: return EvalResourceWithStreamingResponse(self._alpha.eval) - @cached_property - def agents(self) -> AgentsResourceWithStreamingResponse: - return AgentsResourceWithStreamingResponse(self._alpha.agents) - class AsyncAlphaResourceWithStreamingResponse: def __init__(self, alpha: AsyncAlphaResource) -> None: @@ -230,7 +202,3 @@ def benchmarks(self) -> AsyncBenchmarksResourceWithStreamingResponse: @cached_property def eval(self) -> AsyncEvalResourceWithStreamingResponse: return AsyncEvalResourceWithStreamingResponse(self._alpha.eval) - - @cached_property - def agents(self) -> AsyncAgentsResourceWithStreamingResponse: - return AsyncAgentsResourceWithStreamingResponse(self._alpha.agents) diff --git a/src/llama_stack_client/types/__init__.py b/src/llama_stack_client/types/__init__.py index 03e243a5..665bb2f4 100644 --- a/src/llama_stack_client/types/__init__.py +++ b/src/llama_stack_client/types/__init__.py @@ -13,20 +13,14 @@ from .prompt import Prompt as Prompt from .shared import ( Document as Document, - ToolCall as ToolCall, ParamType as ParamType, - AgentConfig as AgentConfig, QueryConfig as QueryConfig, QueryResult as QueryResult, - UserMessage as UserMessage, ScoringResult as ScoringResult, SystemMessage as SystemMessage, - ResponseFormat as ResponseFormat, SamplingParams as SamplingParams, SafetyViolation as SafetyViolation, - CompletionMessage as CompletionMessage, InterleavedContent as InterleavedContent, - ToolResponseMessage as ToolResponseMessage, InterleavedContentItem as InterleavedContentItem, ) from .shield import Shield as Shield @@ -38,7 +32,6 @@ from .vector_store import VectorStore as VectorStore from .version_info import VersionInfo as VersionInfo from .provider_info import ProviderInfo as ProviderInfo -from .tool_def_param import ToolDefParam as ToolDefParam from .create_response import CreateResponse as CreateResponse from .response_object import ResponseObject as ResponseObject from .file_list_params import FileListParams as FileListParams diff --git a/src/llama_stack_client/types/alpha/__init__.py b/src/llama_stack_client/types/alpha/__init__.py index 61e02a4e..74487539 100644 --- a/src/llama_stack_client/types/alpha/__init__.py +++ b/src/llama_stack_client/types/alpha/__init__.py @@ -10,22 +10,11 @@ from .job import Job as Job from .benchmark import Benchmark as Benchmark -from .tool_response import ToolResponse as ToolResponse -from .inference_step import InferenceStep as InferenceStep -from .shield_call_step import ShieldCallStep as ShieldCallStep -from .agent_list_params import AgentListParams as AgentListParams from .evaluate_response import EvaluateResponse as EvaluateResponse from .post_training_job import PostTrainingJob as PostTrainingJob -from .agent_create_params import AgentCreateParams as AgentCreateParams -from .agent_list_response import AgentListResponse as AgentListResponse -from .tool_execution_step import ToolExecutionStep as ToolExecutionStep -from .tool_response_param import ToolResponseParam as ToolResponseParam from .eval_run_eval_params import EvalRunEvalParams as EvalRunEvalParams -from .agent_create_response import AgentCreateResponse as AgentCreateResponse -from .memory_retrieval_step import MemoryRetrievalStep as MemoryRetrievalStep from .algorithm_config_param import AlgorithmConfigParam as AlgorithmConfigParam from .benchmark_config_param import BenchmarkConfigParam as BenchmarkConfigParam -from .agent_retrieve_response import AgentRetrieveResponse as AgentRetrieveResponse from .benchmark_list_response import BenchmarkListResponse as BenchmarkListResponse from .inference_rerank_params import InferenceRerankParams as InferenceRerankParams from .list_benchmarks_response import ListBenchmarksResponse as ListBenchmarksResponse diff --git a/src/llama_stack_client/types/alpha/agent_create_params.py b/src/llama_stack_client/types/alpha/agent_create_params.py deleted file mode 100644 index 9c420379..00000000 --- a/src/llama_stack_client/types/alpha/agent_create_params.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from ..shared_params.agent_config import AgentConfig - -__all__ = ["AgentCreateParams"] - - -class AgentCreateParams(TypedDict, total=False): - agent_config: Required[AgentConfig] - """The configuration for the agent.""" diff --git a/src/llama_stack_client/types/alpha/agent_create_response.py b/src/llama_stack_client/types/alpha/agent_create_response.py deleted file mode 100644 index 70e7d98b..00000000 --- a/src/llama_stack_client/types/alpha/agent_create_response.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ..._models import BaseModel - -__all__ = ["AgentCreateResponse"] - - -class AgentCreateResponse(BaseModel): - agent_id: str - """Unique identifier for the created agent""" diff --git a/src/llama_stack_client/types/alpha/agent_list_params.py b/src/llama_stack_client/types/alpha/agent_list_params.py deleted file mode 100644 index 0b50ef24..00000000 --- a/src/llama_stack_client/types/alpha/agent_list_params.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["AgentListParams"] - - -class AgentListParams(TypedDict, total=False): - limit: int - """The number of agents to return.""" - - start_index: int - """The index to start the pagination from.""" diff --git a/src/llama_stack_client/types/alpha/agent_list_response.py b/src/llama_stack_client/types/alpha/agent_list_response.py deleted file mode 100644 index 212a4a9f..00000000 --- a/src/llama_stack_client/types/alpha/agent_list_response.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Union, Optional - -from ..._models import BaseModel - -__all__ = ["AgentListResponse"] - - -class AgentListResponse(BaseModel): - data: List[Dict[str, Union[bool, float, str, List[object], object, None]]] - """The list of items for the current page""" - - has_more: bool - """Whether there are more items available after this set""" - - url: Optional[str] = None - """The URL for accessing this list""" diff --git a/src/llama_stack_client/types/alpha/agent_retrieve_response.py b/src/llama_stack_client/types/alpha/agent_retrieve_response.py deleted file mode 100644 index bcf40e21..00000000 --- a/src/llama_stack_client/types/alpha/agent_retrieve_response.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from datetime import datetime - -from ..._models import BaseModel -from ..shared.agent_config import AgentConfig - -__all__ = ["AgentRetrieveResponse"] - - -class AgentRetrieveResponse(BaseModel): - agent_config: AgentConfig - """Configuration settings for the agent""" - - agent_id: str - """Unique identifier for the agent""" - - created_at: datetime - """Timestamp when the agent was created""" diff --git a/src/llama_stack_client/types/alpha/agents/__init__.py b/src/llama_stack_client/types/alpha/agents/__init__.py deleted file mode 100644 index f28e38e4..00000000 --- a/src/llama_stack_client/types/alpha/agents/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .turn import Turn as Turn -from .session import Session as Session -from .turn_create_params import TurnCreateParams as TurnCreateParams -from .turn_resume_params import TurnResumeParams as TurnResumeParams -from .session_list_params import SessionListParams as SessionListParams -from .turn_response_event import TurnResponseEvent as TurnResponseEvent -from .session_create_params import SessionCreateParams as SessionCreateParams -from .session_list_response import SessionListResponse as SessionListResponse -from .step_retrieve_response import StepRetrieveResponse as StepRetrieveResponse -from .session_create_response import SessionCreateResponse as SessionCreateResponse -from .session_retrieve_params import SessionRetrieveParams as SessionRetrieveParams -from .agent_turn_response_stream_chunk import AgentTurnResponseStreamChunk as AgentTurnResponseStreamChunk diff --git a/src/llama_stack_client/types/alpha/agents/agent_turn_response_stream_chunk.py b/src/llama_stack_client/types/alpha/agents/agent_turn_response_stream_chunk.py deleted file mode 100644 index 5a518938..00000000 --- a/src/llama_stack_client/types/alpha/agents/agent_turn_response_stream_chunk.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ...._models import BaseModel -from .turn_response_event import TurnResponseEvent - -__all__ = ["AgentTurnResponseStreamChunk"] - - -class AgentTurnResponseStreamChunk(BaseModel): - event: TurnResponseEvent - """Individual event in the agent turn response stream""" diff --git a/src/llama_stack_client/types/alpha/agents/session.py b/src/llama_stack_client/types/alpha/agents/session.py deleted file mode 100644 index c2b3571d..00000000 --- a/src/llama_stack_client/types/alpha/agents/session.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from datetime import datetime - -from .turn import Turn -from ...._models import BaseModel - -__all__ = ["Session"] - - -class Session(BaseModel): - session_id: str - """Unique identifier for the conversation session""" - - session_name: str - """Human-readable name for the session""" - - started_at: datetime - """Timestamp when the session was created""" - - turns: List[Turn] - """List of all turns that have occurred in this session""" diff --git a/src/llama_stack_client/types/alpha/agents/session_create_params.py b/src/llama_stack_client/types/alpha/agents/session_create_params.py deleted file mode 100644 index e8fb03fa..00000000 --- a/src/llama_stack_client/types/alpha/agents/session_create_params.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["SessionCreateParams"] - - -class SessionCreateParams(TypedDict, total=False): - session_name: Required[str] - """The name of the session to create.""" diff --git a/src/llama_stack_client/types/alpha/agents/session_create_response.py b/src/llama_stack_client/types/alpha/agents/session_create_response.py deleted file mode 100644 index dd8b1eba..00000000 --- a/src/llama_stack_client/types/alpha/agents/session_create_response.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from ...._models import BaseModel - -__all__ = ["SessionCreateResponse"] - - -class SessionCreateResponse(BaseModel): - session_id: str - """Unique identifier for the created session""" diff --git a/src/llama_stack_client/types/alpha/agents/session_list_params.py b/src/llama_stack_client/types/alpha/agents/session_list_params.py deleted file mode 100644 index 0ff7609b..00000000 --- a/src/llama_stack_client/types/alpha/agents/session_list_params.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import TypedDict - -__all__ = ["SessionListParams"] - - -class SessionListParams(TypedDict, total=False): - limit: int - """The number of sessions to return.""" - - start_index: int - """The index to start the pagination from.""" diff --git a/src/llama_stack_client/types/alpha/agents/session_list_response.py b/src/llama_stack_client/types/alpha/agents/session_list_response.py deleted file mode 100644 index ad686bd3..00000000 --- a/src/llama_stack_client/types/alpha/agents/session_list_response.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Union, Optional - -from ...._models import BaseModel - -__all__ = ["SessionListResponse"] - - -class SessionListResponse(BaseModel): - data: List[Dict[str, Union[bool, float, str, List[object], object, None]]] - """The list of items for the current page""" - - has_more: bool - """Whether there are more items available after this set""" - - url: Optional[str] = None - """The URL for accessing this list""" diff --git a/src/llama_stack_client/types/alpha/agents/session_retrieve_params.py b/src/llama_stack_client/types/alpha/agents/session_retrieve_params.py deleted file mode 100644 index 27bc0761..00000000 --- a/src/llama_stack_client/types/alpha/agents/session_retrieve_params.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -from ...._types import SequenceNotStr - -__all__ = ["SessionRetrieveParams"] - - -class SessionRetrieveParams(TypedDict, total=False): - agent_id: Required[str] - - turn_ids: SequenceNotStr[str] - """(Optional) List of turn IDs to filter the session by.""" diff --git a/src/llama_stack_client/types/alpha/agents/step_retrieve_response.py b/src/llama_stack_client/types/alpha/agents/step_retrieve_response.py deleted file mode 100644 index 300c6ffb..00000000 --- a/src/llama_stack_client/types/alpha/agents/step_retrieve_response.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union -from typing_extensions import Annotated, TypeAlias - -from ...._utils import PropertyInfo -from ...._models import BaseModel -from ..inference_step import InferenceStep -from ..shield_call_step import ShieldCallStep -from ..tool_execution_step import ToolExecutionStep -from ..memory_retrieval_step import MemoryRetrievalStep - -__all__ = ["StepRetrieveResponse", "Step"] - -Step: TypeAlias = Annotated[ - Union[InferenceStep, ToolExecutionStep, ShieldCallStep, MemoryRetrievalStep], - PropertyInfo(discriminator="step_type"), -] - - -class StepRetrieveResponse(BaseModel): - step: Step - """The complete step data and execution details""" diff --git a/src/llama_stack_client/types/alpha/agents/turn.py b/src/llama_stack_client/types/alpha/agents/turn.py deleted file mode 100644 index 51ec9ddf..00000000 --- a/src/llama_stack_client/types/alpha/agents/turn.py +++ /dev/null @@ -1,122 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Union, Optional -from datetime import datetime -from typing_extensions import Literal, Annotated, TypeAlias - -from ...._utils import PropertyInfo -from ...._models import BaseModel -from ..inference_step import InferenceStep -from ..shield_call_step import ShieldCallStep -from ..tool_execution_step import ToolExecutionStep -from ...shared.user_message import UserMessage -from ..memory_retrieval_step import MemoryRetrievalStep -from ...shared.completion_message import CompletionMessage -from ...shared.tool_response_message import ToolResponseMessage -from ...shared.interleaved_content_item import InterleavedContentItem - -__all__ = [ - "Turn", - "InputMessage", - "Step", - "OutputAttachment", - "OutputAttachmentContent", - "OutputAttachmentContentImageContentItem", - "OutputAttachmentContentImageContentItemImage", - "OutputAttachmentContentImageContentItemImageURL", - "OutputAttachmentContentTextContentItem", - "OutputAttachmentContentURL", -] - -InputMessage: TypeAlias = Union[UserMessage, ToolResponseMessage] - -Step: TypeAlias = Annotated[ - Union[InferenceStep, ToolExecutionStep, ShieldCallStep, MemoryRetrievalStep], - PropertyInfo(discriminator="step_type"), -] - - -class OutputAttachmentContentImageContentItemImageURL(BaseModel): - uri: str - """The URL string pointing to the resource""" - - -class OutputAttachmentContentImageContentItemImage(BaseModel): - data: Optional[str] = None - """base64 encoded image data as string""" - - url: Optional[OutputAttachmentContentImageContentItemImageURL] = None - """A URL of the image or data URL in the format of data:image/{type};base64,{data}. - - Note that URL could have length limits. - """ - - -class OutputAttachmentContentImageContentItem(BaseModel): - image: OutputAttachmentContentImageContentItemImage - """Image as a base64 encoded string or an URL""" - - type: Literal["image"] - """Discriminator type of the content item. Always "image" """ - - -class OutputAttachmentContentTextContentItem(BaseModel): - text: str - """Text content""" - - type: Literal["text"] - """Discriminator type of the content item. Always "text" """ - - -class OutputAttachmentContentURL(BaseModel): - uri: str - """The URL string pointing to the resource""" - - -OutputAttachmentContent: TypeAlias = Union[ - str, - OutputAttachmentContentImageContentItem, - OutputAttachmentContentTextContentItem, - List[InterleavedContentItem], - OutputAttachmentContentURL, -] - - -class OutputAttachment(BaseModel): - content: OutputAttachmentContent - """The content of the attachment.""" - - mime_type: str - """The MIME type of the attachment.""" - - -class Turn(BaseModel): - input_messages: List[InputMessage] - """List of messages that initiated this turn""" - - output_message: CompletionMessage - """The model's generated response containing content and metadata""" - - session_id: str - """Unique identifier for the conversation session""" - - started_at: datetime - """Timestamp when the turn began""" - - steps: List[Step] - """Ordered list of processing steps executed during this turn""" - - turn_id: str - """Unique identifier for the turn within a session""" - - completed_at: Optional[datetime] = None - """(Optional) Timestamp when the turn finished, if completed""" - - output_attachments: Optional[List[OutputAttachment]] = None - """(Optional) Files or media attached to the agent's response""" diff --git a/src/llama_stack_client/types/alpha/agents/turn_create_params.py b/src/llama_stack_client/types/alpha/agents/turn_create_params.py deleted file mode 100644 index 79ee42be..00000000 --- a/src/llama_stack_client/types/alpha/agents/turn_create_params.py +++ /dev/null @@ -1,170 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -from ...._types import SequenceNotStr -from ...shared_params.user_message import UserMessage -from ...shared_params.tool_response_message import ToolResponseMessage -from ...shared_params.interleaved_content_item import InterleavedContentItem - -__all__ = [ - "TurnCreateParamsBase", - "Message", - "Document", - "DocumentContent", - "DocumentContentImageContentItem", - "DocumentContentImageContentItemImage", - "DocumentContentImageContentItemImageURL", - "DocumentContentTextContentItem", - "DocumentContentURL", - "ToolConfig", - "Toolgroup", - "ToolgroupAgentToolGroupWithArgs", - "TurnCreateParamsNonStreaming", - "TurnCreateParamsStreaming", -] - - -class TurnCreateParamsBase(TypedDict, total=False): - agent_id: Required[str] - - messages: Required[Iterable[Message]] - """List of messages to start the turn with.""" - - documents: Iterable[Document] - """(Optional) List of documents to create the turn with.""" - - tool_config: ToolConfig - """ - (Optional) The tool configuration to create the turn with, will be used to - override the agent's tool_config. - """ - - toolgroups: SequenceNotStr[Toolgroup] - """ - (Optional) List of toolgroups to create the turn with, will be used in addition - to the agent's config toolgroups for the request. - """ - - -Message: TypeAlias = Union[UserMessage, ToolResponseMessage] - - -class DocumentContentImageContentItemImageURL(TypedDict, total=False): - uri: Required[str] - """The URL string pointing to the resource""" - - -class DocumentContentImageContentItemImage(TypedDict, total=False): - data: str - """base64 encoded image data as string""" - - url: DocumentContentImageContentItemImageURL - """A URL of the image or data URL in the format of data:image/{type};base64,{data}. - - Note that URL could have length limits. - """ - - -class DocumentContentImageContentItem(TypedDict, total=False): - image: Required[DocumentContentImageContentItemImage] - """Image as a base64 encoded string or an URL""" - - type: Required[Literal["image"]] - """Discriminator type of the content item. Always "image" """ - - -class DocumentContentTextContentItem(TypedDict, total=False): - text: Required[str] - """Text content""" - - type: Required[Literal["text"]] - """Discriminator type of the content item. Always "text" """ - - -class DocumentContentURL(TypedDict, total=False): - uri: Required[str] - """The URL string pointing to the resource""" - - -DocumentContent: TypeAlias = Union[ - str, - DocumentContentImageContentItem, - DocumentContentTextContentItem, - Iterable[InterleavedContentItem], - DocumentContentURL, -] - - -class Document(TypedDict, total=False): - content: Required[DocumentContent] - """The content of the document.""" - - mime_type: Required[str] - """The MIME type of the document.""" - - -class ToolConfig(TypedDict, total=False): - system_message_behavior: Literal["append", "replace"] - """(Optional) Config for how to override the default system prompt. - - - `SystemMessageBehavior.append`: Appends the provided system message to the - default system prompt. - `SystemMessageBehavior.replace`: Replaces the default - system prompt with the provided system message. The system message can include - the string '{{function_definitions}}' to indicate where the function - definitions should be inserted. - """ - - tool_choice: Union[Literal["auto", "required", "none"], str] - """(Optional) Whether tool use is automatic, required, or none. - - Can also specify a tool name to use a specific tool. Defaults to - ToolChoice.auto. - """ - - tool_prompt_format: Literal["json", "function_tag", "python_list"] - """(Optional) Instructs the model how to format tool calls. - - By default, Llama Stack will attempt to use a format that is best adapted to the - model. - `ToolPromptFormat.json`: The tool calls are formatted as a JSON - object. - `ToolPromptFormat.function_tag`: The tool calls are enclosed in a - tag. - `ToolPromptFormat.python_list`: The tool calls - are output as Python syntax -- a list of function calls. - """ - - -class ToolgroupAgentToolGroupWithArgs(TypedDict, total=False): - args: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - - name: Required[str] - - -Toolgroup: TypeAlias = Union[str, ToolgroupAgentToolGroupWithArgs] - - -class TurnCreateParamsNonStreaming(TurnCreateParamsBase, total=False): - stream: Literal[False] - """(Optional) If True, generate an SSE event stream of the response. - - Defaults to False. - """ - - -class TurnCreateParamsStreaming(TurnCreateParamsBase): - stream: Required[Literal[True]] - """(Optional) If True, generate an SSE event stream of the response. - - Defaults to False. - """ - - -TurnCreateParams = Union[TurnCreateParamsNonStreaming, TurnCreateParamsStreaming] diff --git a/src/llama_stack_client/types/alpha/agents/turn_response_event.py b/src/llama_stack_client/types/alpha/agents/turn_response_event.py deleted file mode 100644 index 3088e623..00000000 --- a/src/llama_stack_client/types/alpha/agents/turn_response_event.py +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Union, Optional -from typing_extensions import Literal, Annotated, TypeAlias - -from .turn import Turn -from ...._utils import PropertyInfo -from ...._models import BaseModel -from ..inference_step import InferenceStep -from ..shield_call_step import ShieldCallStep -from ...shared.tool_call import ToolCall -from ..tool_execution_step import ToolExecutionStep -from ..memory_retrieval_step import MemoryRetrievalStep - -__all__ = [ - "TurnResponseEvent", - "Payload", - "PayloadAgentTurnResponseStepStartPayload", - "PayloadAgentTurnResponseStepProgressPayload", - "PayloadAgentTurnResponseStepProgressPayloadDelta", - "PayloadAgentTurnResponseStepProgressPayloadDeltaTextDelta", - "PayloadAgentTurnResponseStepProgressPayloadDeltaImageDelta", - "PayloadAgentTurnResponseStepProgressPayloadDeltaToolCallDelta", - "PayloadAgentTurnResponseStepProgressPayloadDeltaToolCallDeltaToolCall", - "PayloadAgentTurnResponseStepCompletePayload", - "PayloadAgentTurnResponseStepCompletePayloadStepDetails", - "PayloadAgentTurnResponseTurnStartPayload", - "PayloadAgentTurnResponseTurnCompletePayload", - "PayloadAgentTurnResponseTurnAwaitingInputPayload", -] - - -class PayloadAgentTurnResponseStepStartPayload(BaseModel): - event_type: Literal["step_start"] - """Type of event being reported""" - - step_id: str - """Unique identifier for the step within a turn""" - - step_type: Literal["inference", "tool_execution", "shield_call", "memory_retrieval"] - """Type of step being executed""" - - metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) Additional metadata for the step""" - - -class PayloadAgentTurnResponseStepProgressPayloadDeltaTextDelta(BaseModel): - text: str - """The incremental text content""" - - type: Literal["text"] - """Discriminator type of the delta. Always "text" """ - - -class PayloadAgentTurnResponseStepProgressPayloadDeltaImageDelta(BaseModel): - image: str - """The incremental image data as bytes""" - - type: Literal["image"] - """Discriminator type of the delta. Always "image" """ - - -PayloadAgentTurnResponseStepProgressPayloadDeltaToolCallDeltaToolCall: TypeAlias = Union[str, ToolCall] - - -class PayloadAgentTurnResponseStepProgressPayloadDeltaToolCallDelta(BaseModel): - parse_status: Literal["started", "in_progress", "failed", "succeeded"] - """Current parsing status of the tool call""" - - tool_call: PayloadAgentTurnResponseStepProgressPayloadDeltaToolCallDeltaToolCall - """Either an in-progress tool call string or the final parsed tool call""" - - type: Literal["tool_call"] - """Discriminator type of the delta. Always "tool_call" """ - - -PayloadAgentTurnResponseStepProgressPayloadDelta: TypeAlias = Annotated[ - Union[ - PayloadAgentTurnResponseStepProgressPayloadDeltaTextDelta, - PayloadAgentTurnResponseStepProgressPayloadDeltaImageDelta, - PayloadAgentTurnResponseStepProgressPayloadDeltaToolCallDelta, - ], - PropertyInfo(discriminator="type"), -] - - -class PayloadAgentTurnResponseStepProgressPayload(BaseModel): - delta: PayloadAgentTurnResponseStepProgressPayloadDelta - """Incremental content changes during step execution""" - - event_type: Literal["step_progress"] - """Type of event being reported""" - - step_id: str - """Unique identifier for the step within a turn""" - - step_type: Literal["inference", "tool_execution", "shield_call", "memory_retrieval"] - """Type of step being executed""" - - -PayloadAgentTurnResponseStepCompletePayloadStepDetails: TypeAlias = Annotated[ - Union[InferenceStep, ToolExecutionStep, ShieldCallStep, MemoryRetrievalStep], - PropertyInfo(discriminator="step_type"), -] - - -class PayloadAgentTurnResponseStepCompletePayload(BaseModel): - event_type: Literal["step_complete"] - """Type of event being reported""" - - step_details: PayloadAgentTurnResponseStepCompletePayloadStepDetails - """Complete details of the executed step""" - - step_id: str - """Unique identifier for the step within a turn""" - - step_type: Literal["inference", "tool_execution", "shield_call", "memory_retrieval"] - """Type of step being executed""" - - -class PayloadAgentTurnResponseTurnStartPayload(BaseModel): - event_type: Literal["turn_start"] - """Type of event being reported""" - - turn_id: str - """Unique identifier for the turn within a session""" - - -class PayloadAgentTurnResponseTurnCompletePayload(BaseModel): - event_type: Literal["turn_complete"] - """Type of event being reported""" - - turn: Turn - """Complete turn data including all steps and results""" - - -class PayloadAgentTurnResponseTurnAwaitingInputPayload(BaseModel): - event_type: Literal["turn_awaiting_input"] - """Type of event being reported""" - - turn: Turn - """Turn data when waiting for external tool responses""" - - -Payload: TypeAlias = Annotated[ - Union[ - PayloadAgentTurnResponseStepStartPayload, - PayloadAgentTurnResponseStepProgressPayload, - PayloadAgentTurnResponseStepCompletePayload, - PayloadAgentTurnResponseTurnStartPayload, - PayloadAgentTurnResponseTurnCompletePayload, - PayloadAgentTurnResponseTurnAwaitingInputPayload, - ], - PropertyInfo(discriminator="event_type"), -] - - -class TurnResponseEvent(BaseModel): - payload: Payload - """Event-specific payload containing event data""" diff --git a/src/llama_stack_client/types/alpha/agents/turn_resume_params.py b/src/llama_stack_client/types/alpha/agents/turn_resume_params.py deleted file mode 100644 index 23fda973..00000000 --- a/src/llama_stack_client/types/alpha/agents/turn_resume_params.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union, Iterable -from typing_extensions import Literal, Required, TypedDict - -from ..tool_response_param import ToolResponseParam - -__all__ = ["TurnResumeParamsBase", "TurnResumeParamsNonStreaming", "TurnResumeParamsStreaming"] - - -class TurnResumeParamsBase(TypedDict, total=False): - agent_id: Required[str] - - session_id: Required[str] - - tool_responses: Required[Iterable[ToolResponseParam]] - """The tool call responses to resume the turn with.""" - - -class TurnResumeParamsNonStreaming(TurnResumeParamsBase, total=False): - stream: Literal[False] - """Whether to stream the response.""" - - -class TurnResumeParamsStreaming(TurnResumeParamsBase): - stream: Required[Literal[True]] - """Whether to stream the response.""" - - -TurnResumeParams = Union[TurnResumeParamsNonStreaming, TurnResumeParamsStreaming] diff --git a/src/llama_stack_client/types/alpha/benchmark_config_param.py b/src/llama_stack_client/types/alpha/benchmark_config_param.py index e32cd187..5927c248 100644 --- a/src/llama_stack_client/types/alpha/benchmark_config_param.py +++ b/src/llama_stack_client/types/alpha/benchmark_config_param.py @@ -8,18 +8,17 @@ from __future__ import annotations -from typing import Dict, Union -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing import Dict +from typing_extensions import Literal, Required, TypedDict from ..scoring_fn_params_param import ScoringFnParamsParam -from ..shared_params.agent_config import AgentConfig from ..shared_params.system_message import SystemMessage from ..shared_params.sampling_params import SamplingParams -__all__ = ["BenchmarkConfigParam", "EvalCandidate", "EvalCandidateModelCandidate", "EvalCandidateAgentCandidate"] +__all__ = ["BenchmarkConfigParam", "EvalCandidate"] -class EvalCandidateModelCandidate(TypedDict, total=False): +class EvalCandidate(TypedDict, total=False): model: Required[str] """The model ID to evaluate.""" @@ -32,16 +31,6 @@ class EvalCandidateModelCandidate(TypedDict, total=False): """(Optional) The system message providing instructions or context to the model.""" -class EvalCandidateAgentCandidate(TypedDict, total=False): - config: Required[AgentConfig] - """The configuration for the agent candidate.""" - - type: Required[Literal["agent"]] - - -EvalCandidate: TypeAlias = Union[EvalCandidateModelCandidate, EvalCandidateAgentCandidate] - - class BenchmarkConfigParam(TypedDict, total=False): eval_candidate: Required[EvalCandidate] """The candidate to evaluate.""" diff --git a/src/llama_stack_client/types/alpha/inference_step.py b/src/llama_stack_client/types/alpha/inference_step.py deleted file mode 100644 index a4dfa054..00000000 --- a/src/llama_stack_client/types/alpha/inference_step.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from pydantic import Field as FieldInfo - -from ..._models import BaseModel -from ..shared.completion_message import CompletionMessage - -__all__ = ["InferenceStep"] - - -class InferenceStep(BaseModel): - api_model_response: CompletionMessage = FieldInfo(alias="model_response") - """The response from the LLM.""" - - step_id: str - """The ID of the step.""" - - step_type: Literal["inference"] - """Type of the step in an agent turn.""" - - turn_id: str - """The ID of the turn.""" - - completed_at: Optional[datetime] = None - """The time the step completed.""" - - started_at: Optional[datetime] = None - """The time the step started.""" diff --git a/src/llama_stack_client/types/alpha/memory_retrieval_step.py b/src/llama_stack_client/types/alpha/memory_retrieval_step.py deleted file mode 100644 index 1b5708ce..00000000 --- a/src/llama_stack_client/types/alpha/memory_retrieval_step.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel -from ..shared.interleaved_content import InterleavedContent - -__all__ = ["MemoryRetrievalStep"] - - -class MemoryRetrievalStep(BaseModel): - inserted_context: InterleavedContent - """The context retrieved from the vector databases.""" - - step_id: str - """The ID of the step.""" - - step_type: Literal["memory_retrieval"] - """Type of the step in an agent turn.""" - - turn_id: str - """The ID of the turn.""" - - vector_store_ids: str - """The IDs of the vector databases to retrieve context from.""" - - completed_at: Optional[datetime] = None - """The time the step completed.""" - - started_at: Optional[datetime] = None - """The time the step started.""" diff --git a/src/llama_stack_client/types/alpha/shield_call_step.py b/src/llama_stack_client/types/alpha/shield_call_step.py deleted file mode 100644 index f332a4d5..00000000 --- a/src/llama_stack_client/types/alpha/shield_call_step.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel -from ..shared.safety_violation import SafetyViolation - -__all__ = ["ShieldCallStep"] - - -class ShieldCallStep(BaseModel): - step_id: str - """The ID of the step.""" - - step_type: Literal["shield_call"] - """Type of the step in an agent turn.""" - - turn_id: str - """The ID of the turn.""" - - completed_at: Optional[datetime] = None - """The time the step completed.""" - - started_at: Optional[datetime] = None - """The time the step started.""" - - violation: Optional[SafetyViolation] = None - """The violation from the shield call.""" diff --git a/src/llama_stack_client/types/alpha/tool_execution_step.py b/src/llama_stack_client/types/alpha/tool_execution_step.py deleted file mode 100644 index 04259318..00000000 --- a/src/llama_stack_client/types/alpha/tool_execution_step.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel -from .tool_response import ToolResponse -from ..shared.tool_call import ToolCall - -__all__ = ["ToolExecutionStep"] - - -class ToolExecutionStep(BaseModel): - step_id: str - """The ID of the step.""" - - step_type: Literal["tool_execution"] - """Type of the step in an agent turn.""" - - tool_calls: List[ToolCall] - """The tool calls to execute.""" - - tool_responses: List[ToolResponse] - """The tool responses from the tool calls.""" - - turn_id: str - """The ID of the turn.""" - - completed_at: Optional[datetime] = None - """The time the step completed.""" - - started_at: Optional[datetime] = None - """The time the step started.""" diff --git a/src/llama_stack_client/types/alpha/tool_response.py b/src/llama_stack_client/types/alpha/tool_response.py deleted file mode 100644 index 250ae9de..00000000 --- a/src/llama_stack_client/types/alpha/tool_response.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Union, Optional -from typing_extensions import Literal - -from ..._models import BaseModel -from ..shared.interleaved_content import InterleavedContent - -__all__ = ["ToolResponse"] - - -class ToolResponse(BaseModel): - call_id: str - """Unique identifier for the tool call this response is for""" - - content: InterleavedContent - """The response content from the tool""" - - tool_name: Union[Literal["brave_search", "wolfram_alpha", "photogen", "code_interpreter"], str] - """Name of the tool that was invoked""" - - metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) Additional metadata about the tool response""" diff --git a/src/llama_stack_client/types/alpha/tool_response_param.py b/src/llama_stack_client/types/alpha/tool_response_param.py deleted file mode 100644 index 9d745da5..00000000 --- a/src/llama_stack_client/types/alpha/tool_response_param.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Union, Iterable -from typing_extensions import Literal, Required, TypedDict - -from ..shared_params.interleaved_content import InterleavedContent - -__all__ = ["ToolResponseParam"] - - -class ToolResponseParam(TypedDict, total=False): - call_id: Required[str] - """Unique identifier for the tool call this response is for""" - - content: Required[InterleavedContent] - """The response content from the tool""" - - tool_name: Required[Union[Literal["brave_search", "wolfram_alpha", "photogen", "code_interpreter"], str]] - """Name of the tool that was invoked""" - - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) Additional metadata about the tool response""" diff --git a/src/llama_stack_client/types/shared/__init__.py b/src/llama_stack_client/types/shared/__init__.py index 6ba732f0..7a605e8e 100644 --- a/src/llama_stack_client/types/shared/__init__.py +++ b/src/llama_stack_client/types/shared/__init__.py @@ -7,18 +7,12 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .document import Document as Document -from .tool_call import ToolCall as ToolCall from .param_type import ParamType as ParamType -from .agent_config import AgentConfig as AgentConfig from .query_config import QueryConfig as QueryConfig from .query_result import QueryResult as QueryResult -from .user_message import UserMessage as UserMessage from .scoring_result import ScoringResult as ScoringResult from .system_message import SystemMessage as SystemMessage -from .response_format import ResponseFormat as ResponseFormat from .sampling_params import SamplingParams as SamplingParams from .safety_violation import SafetyViolation as SafetyViolation -from .completion_message import CompletionMessage as CompletionMessage from .interleaved_content import InterleavedContent as InterleavedContent -from .tool_response_message import ToolResponseMessage as ToolResponseMessage from .interleaved_content_item import InterleavedContentItem as InterleavedContentItem diff --git a/src/llama_stack_client/types/shared/agent_config.py b/src/llama_stack_client/types/shared/agent_config.py deleted file mode 100644 index 71d53ca5..00000000 --- a/src/llama_stack_client/types/shared/agent_config.py +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Union, Optional -from typing_extensions import Literal, TypeAlias - -from ..._models import BaseModel -from ..tool_def import ToolDef -from .response_format import ResponseFormat -from .sampling_params import SamplingParams - -__all__ = ["AgentConfig", "ToolConfig", "Toolgroup", "ToolgroupAgentToolGroupWithArgs"] - - -class ToolConfig(BaseModel): - system_message_behavior: Optional[Literal["append", "replace"]] = None - """(Optional) Config for how to override the default system prompt. - - - `SystemMessageBehavior.append`: Appends the provided system message to the - default system prompt. - `SystemMessageBehavior.replace`: Replaces the default - system prompt with the provided system message. The system message can include - the string '{{function_definitions}}' to indicate where the function - definitions should be inserted. - """ - - tool_choice: Union[Literal["auto", "required", "none"], str, None] = None - """(Optional) Whether tool use is automatic, required, or none. - - Can also specify a tool name to use a specific tool. Defaults to - ToolChoice.auto. - """ - - tool_prompt_format: Optional[Literal["json", "function_tag", "python_list"]] = None - """(Optional) Instructs the model how to format tool calls. - - By default, Llama Stack will attempt to use a format that is best adapted to the - model. - `ToolPromptFormat.json`: The tool calls are formatted as a JSON - object. - `ToolPromptFormat.function_tag`: The tool calls are enclosed in a - tag. - `ToolPromptFormat.python_list`: The tool calls - are output as Python syntax -- a list of function calls. - """ - - -class ToolgroupAgentToolGroupWithArgs(BaseModel): - args: Dict[str, Union[bool, float, str, List[object], object, None]] - - name: str - - -Toolgroup: TypeAlias = Union[str, ToolgroupAgentToolGroupWithArgs] - - -class AgentConfig(BaseModel): - instructions: str - """The system instructions for the agent""" - - model: str - """The model identifier to use for the agent""" - - client_tools: Optional[List[ToolDef]] = None - - enable_session_persistence: Optional[bool] = None - """Optional flag indicating whether session data has to be persisted""" - - input_shields: Optional[List[str]] = None - - max_infer_iters: Optional[int] = None - - name: Optional[str] = None - """Optional name for the agent, used in telemetry and identification""" - - output_shields: Optional[List[str]] = None - - response_format: Optional[ResponseFormat] = None - """Optional response format configuration""" - - sampling_params: Optional[SamplingParams] = None - """Sampling parameters.""" - - tool_choice: Optional[Literal["auto", "required", "none"]] = None - """Whether tool use is required or automatic. - - This is a hint to the model which may not be followed. It depends on the - Instruction Following capabilities of the model. - """ - - tool_config: Optional[ToolConfig] = None - """Configuration for tool use.""" - - tool_prompt_format: Optional[Literal["json", "function_tag", "python_list"]] = None - """Prompt format for calling custom / zero shot tools.""" - - toolgroups: Optional[List[Toolgroup]] = None diff --git a/src/llama_stack_client/types/shared/completion_message.py b/src/llama_stack_client/types/shared/completion_message.py deleted file mode 100644 index bed73ea4..00000000 --- a/src/llama_stack_client/types/shared/completion_message.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from typing_extensions import Literal - -from ..._models import BaseModel -from .tool_call import ToolCall -from .interleaved_content import InterleavedContent - -__all__ = ["CompletionMessage"] - - -class CompletionMessage(BaseModel): - content: InterleavedContent - """The content of the model's response""" - - role: Literal["assistant"] - """Must be "assistant" to identify this as the model's response""" - - stop_reason: Literal["end_of_turn", "end_of_message", "out_of_tokens"] - """Reason why the model stopped generating. - - Options are: - `StopReason.end_of_turn`: The model finished generating the - entire response. - `StopReason.end_of_message`: The model finished generating - but generated a partial response -- usually, a tool call. The user may call the - tool and continue the conversation with the tool's response. - - `StopReason.out_of_tokens`: The model ran out of token budget. - """ - - tool_calls: Optional[List[ToolCall]] = None - """List of tool calls. Each tool call is a ToolCall object.""" diff --git a/src/llama_stack_client/types/shared/param_type.py b/src/llama_stack_client/types/shared/param_type.py index e3341da0..5dc621fa 100644 --- a/src/llama_stack_client/types/shared/param_type.py +++ b/src/llama_stack_client/types/shared/param_type.py @@ -23,7 +23,6 @@ "UnionType", "ChatCompletionInputType", "CompletionInputType", - "AgentTurnInputType", ] @@ -72,11 +71,6 @@ class CompletionInputType(BaseModel): """Discriminator type. Always "completion_input" """ -class AgentTurnInputType(BaseModel): - type: Literal["agent_turn_input"] - """Discriminator type. Always "agent_turn_input" """ - - ParamType: TypeAlias = Annotated[ Union[ StringType, @@ -88,7 +82,6 @@ class AgentTurnInputType(BaseModel): UnionType, ChatCompletionInputType, CompletionInputType, - AgentTurnInputType, ], PropertyInfo(discriminator="type"), ] diff --git a/src/llama_stack_client/types/shared/response_format.py b/src/llama_stack_client/types/shared/response_format.py deleted file mode 100644 index 0d601a23..00000000 --- a/src/llama_stack_client/types/shared/response_format.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Dict, List, Union -from typing_extensions import Literal, Annotated, TypeAlias - -from ..._utils import PropertyInfo -from ..._models import BaseModel - -__all__ = ["ResponseFormat", "JsonSchemaResponseFormat", "GrammarResponseFormat"] - - -class JsonSchemaResponseFormat(BaseModel): - json_schema: Dict[str, Union[bool, float, str, List[object], object, None]] - """The JSON schema the response should conform to. - - In a Python SDK, this is often a `pydantic` model. - """ - - type: Literal["json_schema"] - """Must be "json_schema" to identify this format type""" - - -class GrammarResponseFormat(BaseModel): - bnf: Dict[str, Union[bool, float, str, List[object], object, None]] - """The BNF grammar specification the response should conform to""" - - type: Literal["grammar"] - """Must be "grammar" to identify this format type""" - - -ResponseFormat: TypeAlias = Annotated[ - Union[JsonSchemaResponseFormat, GrammarResponseFormat], PropertyInfo(discriminator="type") -] diff --git a/src/llama_stack_client/types/shared/tool_call.py b/src/llama_stack_client/types/shared/tool_call.py deleted file mode 100644 index a0944a0d..00000000 --- a/src/llama_stack_client/types/shared/tool_call.py +++ /dev/null @@ -1,22 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Union -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["ToolCall"] - - -class ToolCall(BaseModel): - arguments: str - - call_id: str - - tool_name: Union[Literal["brave_search", "wolfram_alpha", "photogen", "code_interpreter"], str] diff --git a/src/llama_stack_client/types/shared/tool_response_message.py b/src/llama_stack_client/types/shared/tool_response_message.py deleted file mode 100644 index 265c9f00..00000000 --- a/src/llama_stack_client/types/shared/tool_response_message.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing_extensions import Literal - -from ..._models import BaseModel -from .interleaved_content import InterleavedContent - -__all__ = ["ToolResponseMessage"] - - -class ToolResponseMessage(BaseModel): - call_id: str - """Unique identifier for the tool call this response is for""" - - content: InterleavedContent - """The response content from the tool""" - - role: Literal["tool"] - """Must be "tool" to identify this as a tool response""" diff --git a/src/llama_stack_client/types/shared/user_message.py b/src/llama_stack_client/types/shared/user_message.py deleted file mode 100644 index 7afc3970..00000000 --- a/src/llama_stack_client/types/shared/user_message.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from typing_extensions import Literal - -from ..._models import BaseModel -from .interleaved_content import InterleavedContent - -__all__ = ["UserMessage"] - - -class UserMessage(BaseModel): - content: InterleavedContent - """The content of the message, which can include text and other media""" - - role: Literal["user"] - """Must be "user" to identify this as a user message""" - - context: Optional[InterleavedContent] = None - """(Optional) This field is used internally by Llama Stack to pass RAG context. - - This field may be removed in the API in the future. - """ diff --git a/src/llama_stack_client/types/shared_params/__init__.py b/src/llama_stack_client/types/shared_params/__init__.py index f25d2430..154cc9d4 100644 --- a/src/llama_stack_client/types/shared_params/__init__.py +++ b/src/llama_stack_client/types/shared_params/__init__.py @@ -7,12 +7,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .document import Document as Document -from .agent_config import AgentConfig as AgentConfig from .query_config import QueryConfig as QueryConfig -from .user_message import UserMessage as UserMessage from .system_message import SystemMessage as SystemMessage -from .response_format import ResponseFormat as ResponseFormat from .sampling_params import SamplingParams as SamplingParams from .interleaved_content import InterleavedContent as InterleavedContent -from .tool_response_message import ToolResponseMessage as ToolResponseMessage from .interleaved_content_item import InterleavedContentItem as InterleavedContentItem diff --git a/src/llama_stack_client/types/shared_params/agent_config.py b/src/llama_stack_client/types/shared_params/agent_config.py deleted file mode 100644 index d444e5da..00000000 --- a/src/llama_stack_client/types/shared_params/agent_config.py +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -from ..._types import SequenceNotStr -from ..tool_def_param import ToolDefParam -from .response_format import ResponseFormat -from .sampling_params import SamplingParams - -__all__ = ["AgentConfig", "ToolConfig", "Toolgroup", "ToolgroupAgentToolGroupWithArgs"] - - -class ToolConfig(TypedDict, total=False): - system_message_behavior: Literal["append", "replace"] - """(Optional) Config for how to override the default system prompt. - - - `SystemMessageBehavior.append`: Appends the provided system message to the - default system prompt. - `SystemMessageBehavior.replace`: Replaces the default - system prompt with the provided system message. The system message can include - the string '{{function_definitions}}' to indicate where the function - definitions should be inserted. - """ - - tool_choice: Union[Literal["auto", "required", "none"], str] - """(Optional) Whether tool use is automatic, required, or none. - - Can also specify a tool name to use a specific tool. Defaults to - ToolChoice.auto. - """ - - tool_prompt_format: Literal["json", "function_tag", "python_list"] - """(Optional) Instructs the model how to format tool calls. - - By default, Llama Stack will attempt to use a format that is best adapted to the - model. - `ToolPromptFormat.json`: The tool calls are formatted as a JSON - object. - `ToolPromptFormat.function_tag`: The tool calls are enclosed in a - tag. - `ToolPromptFormat.python_list`: The tool calls - are output as Python syntax -- a list of function calls. - """ - - -class ToolgroupAgentToolGroupWithArgs(TypedDict, total=False): - args: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - - name: Required[str] - - -Toolgroup: TypeAlias = Union[str, ToolgroupAgentToolGroupWithArgs] - - -class AgentConfig(TypedDict, total=False): - instructions: Required[str] - """The system instructions for the agent""" - - model: Required[str] - """The model identifier to use for the agent""" - - client_tools: Iterable[ToolDefParam] - - enable_session_persistence: bool - """Optional flag indicating whether session data has to be persisted""" - - input_shields: SequenceNotStr[str] - - max_infer_iters: int - - name: str - """Optional name for the agent, used in telemetry and identification""" - - output_shields: SequenceNotStr[str] - - response_format: ResponseFormat - """Optional response format configuration""" - - sampling_params: SamplingParams - """Sampling parameters.""" - - tool_choice: Literal["auto", "required", "none"] - """Whether tool use is required or automatic. - - This is a hint to the model which may not be followed. It depends on the - Instruction Following capabilities of the model. - """ - - tool_config: ToolConfig - """Configuration for tool use.""" - - tool_prompt_format: Literal["json", "function_tag", "python_list"] - """Prompt format for calling custom / zero shot tools.""" - - toolgroups: SequenceNotStr[Toolgroup] diff --git a/src/llama_stack_client/types/shared_params/response_format.py b/src/llama_stack_client/types/shared_params/response_format.py deleted file mode 100644 index c3146dfc..00000000 --- a/src/llama_stack_client/types/shared_params/response_format.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -__all__ = ["ResponseFormat", "JsonSchemaResponseFormat", "GrammarResponseFormat"] - - -class JsonSchemaResponseFormat(TypedDict, total=False): - json_schema: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """The JSON schema the response should conform to. - - In a Python SDK, this is often a `pydantic` model. - """ - - type: Required[Literal["json_schema"]] - """Must be "json_schema" to identify this format type""" - - -class GrammarResponseFormat(TypedDict, total=False): - bnf: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """The BNF grammar specification the response should conform to""" - - type: Required[Literal["grammar"]] - """Must be "grammar" to identify this format type""" - - -ResponseFormat: TypeAlias = Union[JsonSchemaResponseFormat, GrammarResponseFormat] diff --git a/src/llama_stack_client/types/shared_params/tool_response_message.py b/src/llama_stack_client/types/shared_params/tool_response_message.py deleted file mode 100644 index db66b8d5..00000000 --- a/src/llama_stack_client/types/shared_params/tool_response_message.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -from .interleaved_content import InterleavedContent - -__all__ = ["ToolResponseMessage"] - - -class ToolResponseMessage(TypedDict, total=False): - call_id: Required[str] - """Unique identifier for the tool call this response is for""" - - content: Required[InterleavedContent] - """The response content from the tool""" - - role: Required[Literal["tool"]] - """Must be "tool" to identify this as a tool response""" diff --git a/src/llama_stack_client/types/shared_params/user_message.py b/src/llama_stack_client/types/shared_params/user_message.py deleted file mode 100644 index 39170454..00000000 --- a/src/llama_stack_client/types/shared_params/user_message.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Literal, Required, TypedDict - -from .interleaved_content import InterleavedContent - -__all__ = ["UserMessage"] - - -class UserMessage(TypedDict, total=False): - content: Required[InterleavedContent] - """The content of the message, which can include text and other media""" - - role: Required[Literal["user"]] - """Must be "user" to identify this as a user message""" - - context: InterleavedContent - """(Optional) This field is used internally by Llama Stack to pass RAG context. - - This field may be removed in the API in the future. - """ diff --git a/src/llama_stack_client/types/tool_def_param.py b/src/llama_stack_client/types/tool_def_param.py deleted file mode 100644 index 99e7def1..00000000 --- a/src/llama_stack_client/types/tool_def_param.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Dict, Union, Iterable -from typing_extensions import Required, TypedDict - -__all__ = ["ToolDefParam"] - - -class ToolDefParam(TypedDict, total=False): - name: Required[str] - """Name of the tool""" - - description: str - """(Optional) Human-readable description of what the tool does""" - - input_schema: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) JSON Schema for tool inputs (MCP inputSchema)""" - - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) Additional metadata about the tool""" - - output_schema: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) JSON Schema for tool outputs (MCP outputSchema)""" - - toolgroup_id: str - """(Optional) ID of the tool group this tool belongs to""" diff --git a/tests/api_resources/alpha/agents/__init__.py b/tests/api_resources/alpha/agents/__init__.py deleted file mode 100644 index 6a8e62e9..00000000 --- a/tests/api_resources/alpha/agents/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/alpha/agents/test_session.py b/tests/api_resources/alpha/agents/test_session.py deleted file mode 100644 index 554c2d4e..00000000 --- a/tests/api_resources/alpha/agents/test_session.py +++ /dev/null @@ -1,422 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from llama_stack_client import LlamaStackClient, AsyncLlamaStackClient -from llama_stack_client.types.alpha.agents import ( - Session, - SessionListResponse, - SessionCreateResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSession: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: LlamaStackClient) -> None: - session = client.alpha.agents.session.create( - agent_id="agent_id", - session_name="session_name", - ) - assert_matches_type(SessionCreateResponse, session, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.session.with_raw_response.create( - agent_id="agent_id", - session_name="session_name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - session = response.parse() - assert_matches_type(SessionCreateResponse, session, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: LlamaStackClient) -> None: - with client.alpha.agents.session.with_streaming_response.create( - agent_id="agent_id", - session_name="session_name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - session = response.parse() - assert_matches_type(SessionCreateResponse, session, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.session.with_raw_response.create( - agent_id="", - session_name="session_name", - ) - - @parametrize - def test_method_retrieve(self, client: LlamaStackClient) -> None: - session = client.alpha.agents.session.retrieve( - session_id="session_id", - agent_id="agent_id", - ) - assert_matches_type(Session, session, path=["response"]) - - @parametrize - def test_method_retrieve_with_all_params(self, client: LlamaStackClient) -> None: - session = client.alpha.agents.session.retrieve( - session_id="session_id", - agent_id="agent_id", - turn_ids=["string"], - ) - assert_matches_type(Session, session, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.session.with_raw_response.retrieve( - session_id="session_id", - agent_id="agent_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - session = response.parse() - assert_matches_type(Session, session, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: LlamaStackClient) -> None: - with client.alpha.agents.session.with_streaming_response.retrieve( - session_id="session_id", - agent_id="agent_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - session = response.parse() - assert_matches_type(Session, session, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.session.with_raw_response.retrieve( - session_id="session_id", - agent_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - client.alpha.agents.session.with_raw_response.retrieve( - session_id="", - agent_id="agent_id", - ) - - @parametrize - def test_method_list(self, client: LlamaStackClient) -> None: - session = client.alpha.agents.session.list( - agent_id="agent_id", - ) - assert_matches_type(SessionListResponse, session, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: LlamaStackClient) -> None: - session = client.alpha.agents.session.list( - agent_id="agent_id", - limit=0, - start_index=0, - ) - assert_matches_type(SessionListResponse, session, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.session.with_raw_response.list( - agent_id="agent_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - session = response.parse() - assert_matches_type(SessionListResponse, session, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: LlamaStackClient) -> None: - with client.alpha.agents.session.with_streaming_response.list( - agent_id="agent_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - session = response.parse() - assert_matches_type(SessionListResponse, session, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_list(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.session.with_raw_response.list( - agent_id="", - ) - - @parametrize - def test_method_delete(self, client: LlamaStackClient) -> None: - session = client.alpha.agents.session.delete( - session_id="session_id", - agent_id="agent_id", - ) - assert session is None - - @parametrize - def test_raw_response_delete(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.session.with_raw_response.delete( - session_id="session_id", - agent_id="agent_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - session = response.parse() - assert session is None - - @parametrize - def test_streaming_response_delete(self, client: LlamaStackClient) -> None: - with client.alpha.agents.session.with_streaming_response.delete( - session_id="session_id", - agent_id="agent_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - session = response.parse() - assert session is None - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.session.with_raw_response.delete( - session_id="session_id", - agent_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - client.alpha.agents.session.with_raw_response.delete( - session_id="", - agent_id="agent_id", - ) - - -class TestAsyncSession: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_create(self, async_client: AsyncLlamaStackClient) -> None: - session = await async_client.alpha.agents.session.create( - agent_id="agent_id", - session_name="session_name", - ) - assert_matches_type(SessionCreateResponse, session, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.session.with_raw_response.create( - agent_id="agent_id", - session_name="session_name", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - session = await response.parse() - assert_matches_type(SessionCreateResponse, session, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.session.with_streaming_response.create( - agent_id="agent_id", - session_name="session_name", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - session = await response.parse() - assert_matches_type(SessionCreateResponse, session, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.session.with_raw_response.create( - agent_id="", - session_name="session_name", - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - session = await async_client.alpha.agents.session.retrieve( - session_id="session_id", - agent_id="agent_id", - ) - assert_matches_type(Session, session, path=["response"]) - - @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: - session = await async_client.alpha.agents.session.retrieve( - session_id="session_id", - agent_id="agent_id", - turn_ids=["string"], - ) - assert_matches_type(Session, session, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.session.with_raw_response.retrieve( - session_id="session_id", - agent_id="agent_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - session = await response.parse() - assert_matches_type(Session, session, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.session.with_streaming_response.retrieve( - session_id="session_id", - agent_id="agent_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - session = await response.parse() - assert_matches_type(Session, session, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.session.with_raw_response.retrieve( - session_id="session_id", - agent_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - await async_client.alpha.agents.session.with_raw_response.retrieve( - session_id="", - agent_id="agent_id", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncLlamaStackClient) -> None: - session = await async_client.alpha.agents.session.list( - agent_id="agent_id", - ) - assert_matches_type(SessionListResponse, session, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: - session = await async_client.alpha.agents.session.list( - agent_id="agent_id", - limit=0, - start_index=0, - ) - assert_matches_type(SessionListResponse, session, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.session.with_raw_response.list( - agent_id="agent_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - session = await response.parse() - assert_matches_type(SessionListResponse, session, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.session.with_streaming_response.list( - agent_id="agent_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - session = await response.parse() - assert_matches_type(SessionListResponse, session, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_list(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.session.with_raw_response.list( - agent_id="", - ) - - @parametrize - async def test_method_delete(self, async_client: AsyncLlamaStackClient) -> None: - session = await async_client.alpha.agents.session.delete( - session_id="session_id", - agent_id="agent_id", - ) - assert session is None - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.session.with_raw_response.delete( - session_id="session_id", - agent_id="agent_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - session = await response.parse() - assert session is None - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.session.with_streaming_response.delete( - session_id="session_id", - agent_id="agent_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - session = await response.parse() - assert session is None - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.session.with_raw_response.delete( - session_id="session_id", - agent_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - await async_client.alpha.agents.session.with_raw_response.delete( - session_id="", - agent_id="agent_id", - ) diff --git a/tests/api_resources/alpha/agents/test_steps.py b/tests/api_resources/alpha/agents/test_steps.py deleted file mode 100644 index c001dd23..00000000 --- a/tests/api_resources/alpha/agents/test_steps.py +++ /dev/null @@ -1,178 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from llama_stack_client import LlamaStackClient, AsyncLlamaStackClient -from llama_stack_client.types.alpha.agents import StepRetrieveResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSteps: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: LlamaStackClient) -> None: - step = client.alpha.agents.steps.retrieve( - step_id="step_id", - agent_id="agent_id", - session_id="session_id", - turn_id="turn_id", - ) - assert_matches_type(StepRetrieveResponse, step, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.steps.with_raw_response.retrieve( - step_id="step_id", - agent_id="agent_id", - session_id="session_id", - turn_id="turn_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - step = response.parse() - assert_matches_type(StepRetrieveResponse, step, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: LlamaStackClient) -> None: - with client.alpha.agents.steps.with_streaming_response.retrieve( - step_id="step_id", - agent_id="agent_id", - session_id="session_id", - turn_id="turn_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - step = response.parse() - assert_matches_type(StepRetrieveResponse, step, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.steps.with_raw_response.retrieve( - step_id="step_id", - agent_id="", - session_id="session_id", - turn_id="turn_id", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - client.alpha.agents.steps.with_raw_response.retrieve( - step_id="step_id", - agent_id="agent_id", - session_id="", - turn_id="turn_id", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `turn_id` but received ''"): - client.alpha.agents.steps.with_raw_response.retrieve( - step_id="step_id", - agent_id="agent_id", - session_id="session_id", - turn_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): - client.alpha.agents.steps.with_raw_response.retrieve( - step_id="", - agent_id="agent_id", - session_id="session_id", - turn_id="turn_id", - ) - - -class TestAsyncSteps: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - step = await async_client.alpha.agents.steps.retrieve( - step_id="step_id", - agent_id="agent_id", - session_id="session_id", - turn_id="turn_id", - ) - assert_matches_type(StepRetrieveResponse, step, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.steps.with_raw_response.retrieve( - step_id="step_id", - agent_id="agent_id", - session_id="session_id", - turn_id="turn_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - step = await response.parse() - assert_matches_type(StepRetrieveResponse, step, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.steps.with_streaming_response.retrieve( - step_id="step_id", - agent_id="agent_id", - session_id="session_id", - turn_id="turn_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - step = await response.parse() - assert_matches_type(StepRetrieveResponse, step, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.steps.with_raw_response.retrieve( - step_id="step_id", - agent_id="", - session_id="session_id", - turn_id="turn_id", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - await async_client.alpha.agents.steps.with_raw_response.retrieve( - step_id="step_id", - agent_id="agent_id", - session_id="", - turn_id="turn_id", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `turn_id` but received ''"): - await async_client.alpha.agents.steps.with_raw_response.retrieve( - step_id="step_id", - agent_id="agent_id", - session_id="session_id", - turn_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `step_id` but received ''"): - await async_client.alpha.agents.steps.with_raw_response.retrieve( - step_id="", - agent_id="agent_id", - session_id="session_id", - turn_id="turn_id", - ) diff --git a/tests/api_resources/alpha/agents/test_turn.py b/tests/api_resources/alpha/agents/test_turn.py deleted file mode 100644 index 26f4a7b7..00000000 --- a/tests/api_resources/alpha/agents/test_turn.py +++ /dev/null @@ -1,1036 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from llama_stack_client import LlamaStackClient, AsyncLlamaStackClient -from llama_stack_client.types.alpha.agents import Turn - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestTurn: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create_overload_1(self, client: LlamaStackClient) -> None: - turn = client.alpha.agents.turn.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - ) - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - def test_method_create_with_all_params_overload_1(self, client: LlamaStackClient) -> None: - turn = client.alpha.agents.turn.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - "context": "string", - } - ], - documents=[ - { - "content": "string", - "mime_type": "mime_type", - } - ], - stream=False, - tool_config={ - "system_message_behavior": "append", - "tool_choice": "auto", - "tool_prompt_format": "json", - }, - toolgroups=["string"], - ) - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - def test_raw_response_create_overload_1(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.turn.with_raw_response.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - turn = response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - def test_streaming_response_create_overload_1(self, client: LlamaStackClient) -> None: - with client.alpha.agents.turn.with_streaming_response.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - turn = response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create_overload_1(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.turn.with_raw_response.create( - session_id="session_id", - agent_id="", - messages=[ - { - "content": "string", - "role": "user", - } - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - client.alpha.agents.turn.with_raw_response.create( - session_id="", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - ) - - @parametrize - def test_method_create_overload_2(self, client: LlamaStackClient) -> None: - turn_stream = client.alpha.agents.turn.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - stream=True, - ) - turn_stream.response.close() - - @parametrize - def test_method_create_with_all_params_overload_2(self, client: LlamaStackClient) -> None: - turn_stream = client.alpha.agents.turn.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - "context": "string", - } - ], - stream=True, - documents=[ - { - "content": "string", - "mime_type": "mime_type", - } - ], - tool_config={ - "system_message_behavior": "append", - "tool_choice": "auto", - "tool_prompt_format": "json", - }, - toolgroups=["string"], - ) - turn_stream.response.close() - - @parametrize - def test_raw_response_create_overload_2(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.turn.with_raw_response.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - stream=True, - ) - - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - stream = response.parse() - stream.close() - - @parametrize - def test_streaming_response_create_overload_2(self, client: LlamaStackClient) -> None: - with client.alpha.agents.turn.with_streaming_response.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - stream=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - stream = response.parse() - stream.close() - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create_overload_2(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.turn.with_raw_response.create( - session_id="session_id", - agent_id="", - messages=[ - { - "content": "string", - "role": "user", - } - ], - stream=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - client.alpha.agents.turn.with_raw_response.create( - session_id="", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - stream=True, - ) - - @parametrize - def test_method_retrieve(self, client: LlamaStackClient) -> None: - turn = client.alpha.agents.turn.retrieve( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - ) - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.turn.with_raw_response.retrieve( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - turn = response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: LlamaStackClient) -> None: - with client.alpha.agents.turn.with_streaming_response.retrieve( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - turn = response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.turn.with_raw_response.retrieve( - turn_id="turn_id", - agent_id="", - session_id="session_id", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - client.alpha.agents.turn.with_raw_response.retrieve( - turn_id="turn_id", - agent_id="agent_id", - session_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `turn_id` but received ''"): - client.alpha.agents.turn.with_raw_response.retrieve( - turn_id="", - agent_id="agent_id", - session_id="session_id", - ) - - @parametrize - def test_method_resume_overload_1(self, client: LlamaStackClient) -> None: - turn = client.alpha.agents.turn.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - def test_method_resume_with_all_params_overload_1(self, client: LlamaStackClient) -> None: - turn = client.alpha.agents.turn.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - "metadata": {"foo": True}, - } - ], - stream=False, - ) - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - def test_raw_response_resume_overload_1(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - turn = response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - def test_streaming_response_resume_overload_1(self, client: LlamaStackClient) -> None: - with client.alpha.agents.turn.with_streaming_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - turn = response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_resume_overload_1(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `turn_id` but received ''"): - client.alpha.agents.turn.with_raw_response.resume( - turn_id="", - agent_id="agent_id", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - @parametrize - def test_method_resume_overload_2(self, client: LlamaStackClient) -> None: - turn_stream = client.alpha.agents.turn.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - turn_stream.response.close() - - @parametrize - def test_raw_response_resume_overload_2(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - stream = response.parse() - stream.close() - - @parametrize - def test_streaming_response_resume_overload_2(self, client: LlamaStackClient) -> None: - with client.alpha.agents.turn.with_streaming_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - stream = response.parse() - stream.close() - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_resume_overload_2(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="", - session_id="session_id", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `turn_id` but received ''"): - client.alpha.agents.turn.with_raw_response.resume( - turn_id="", - agent_id="agent_id", - session_id="session_id", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - -class TestAsyncTurn: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_create_overload_1(self, async_client: AsyncLlamaStackClient) -> None: - turn = await async_client.alpha.agents.turn.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - ) - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - async def test_method_create_with_all_params_overload_1(self, async_client: AsyncLlamaStackClient) -> None: - turn = await async_client.alpha.agents.turn.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - "context": "string", - } - ], - documents=[ - { - "content": "string", - "mime_type": "mime_type", - } - ], - stream=False, - tool_config={ - "system_message_behavior": "append", - "tool_choice": "auto", - "tool_prompt_format": "json", - }, - toolgroups=["string"], - ) - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - async def test_raw_response_create_overload_1(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.turn.with_raw_response.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - turn = await response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - async def test_streaming_response_create_overload_1(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.turn.with_streaming_response.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - turn = await response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create_overload_1(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.create( - session_id="session_id", - agent_id="", - messages=[ - { - "content": "string", - "role": "user", - } - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.create( - session_id="", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - ) - - @parametrize - async def test_method_create_overload_2(self, async_client: AsyncLlamaStackClient) -> None: - turn_stream = await async_client.alpha.agents.turn.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - stream=True, - ) - await turn_stream.response.aclose() - - @parametrize - async def test_method_create_with_all_params_overload_2(self, async_client: AsyncLlamaStackClient) -> None: - turn_stream = await async_client.alpha.agents.turn.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - "context": "string", - } - ], - stream=True, - documents=[ - { - "content": "string", - "mime_type": "mime_type", - } - ], - tool_config={ - "system_message_behavior": "append", - "tool_choice": "auto", - "tool_prompt_format": "json", - }, - toolgroups=["string"], - ) - await turn_stream.response.aclose() - - @parametrize - async def test_raw_response_create_overload_2(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.turn.with_raw_response.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - stream=True, - ) - - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - stream = await response.parse() - await stream.close() - - @parametrize - async def test_streaming_response_create_overload_2(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.turn.with_streaming_response.create( - session_id="session_id", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - stream=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - stream = await response.parse() - await stream.close() - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create_overload_2(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.create( - session_id="session_id", - agent_id="", - messages=[ - { - "content": "string", - "role": "user", - } - ], - stream=True, - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.create( - session_id="", - agent_id="agent_id", - messages=[ - { - "content": "string", - "role": "user", - } - ], - stream=True, - ) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - turn = await async_client.alpha.agents.turn.retrieve( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - ) - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.turn.with_raw_response.retrieve( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - turn = await response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.turn.with_streaming_response.retrieve( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - turn = await response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.retrieve( - turn_id="turn_id", - agent_id="", - session_id="session_id", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.retrieve( - turn_id="turn_id", - agent_id="agent_id", - session_id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `turn_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.retrieve( - turn_id="", - agent_id="agent_id", - session_id="session_id", - ) - - @parametrize - async def test_method_resume_overload_1(self, async_client: AsyncLlamaStackClient) -> None: - turn = await async_client.alpha.agents.turn.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - async def test_method_resume_with_all_params_overload_1(self, async_client: AsyncLlamaStackClient) -> None: - turn = await async_client.alpha.agents.turn.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - "metadata": {"foo": True}, - } - ], - stream=False, - ) - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - async def test_raw_response_resume_overload_1(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - turn = await response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - @parametrize - async def test_streaming_response_resume_overload_1(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.turn.with_streaming_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - turn = await response.parse() - assert_matches_type(Turn, turn, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_resume_overload_1(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `turn_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.resume( - turn_id="", - agent_id="agent_id", - session_id="session_id", - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - @parametrize - async def test_method_resume_overload_2(self, async_client: AsyncLlamaStackClient) -> None: - turn_stream = await async_client.alpha.agents.turn.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - await turn_stream.response.aclose() - - @parametrize - async def test_raw_response_resume_overload_2(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - stream = await response.parse() - await stream.close() - - @parametrize - async def test_streaming_response_resume_overload_2(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.turn.with_streaming_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="session_id", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - stream = await response.parse() - await stream.close() - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_resume_overload_2(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="", - session_id="session_id", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `session_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.resume( - turn_id="turn_id", - agent_id="agent_id", - session_id="", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `turn_id` but received ''"): - await async_client.alpha.agents.turn.with_raw_response.resume( - turn_id="", - agent_id="agent_id", - session_id="session_id", - stream=True, - tool_responses=[ - { - "call_id": "call_id", - "content": "string", - "tool_name": "brave_search", - } - ], - ) diff --git a/tests/api_resources/alpha/test_agents.py b/tests/api_resources/alpha/test_agents.py deleted file mode 100644 index 3324871c..00000000 --- a/tests/api_resources/alpha/test_agents.py +++ /dev/null @@ -1,418 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from tests.utils import assert_matches_type -from llama_stack_client import LlamaStackClient, AsyncLlamaStackClient -from llama_stack_client.types.alpha import ( - AgentListResponse, - AgentCreateResponse, - AgentRetrieveResponse, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestAgents: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: LlamaStackClient) -> None: - agent = client.alpha.agents.create( - agent_config={ - "instructions": "instructions", - "model": "model", - }, - ) - assert_matches_type(AgentCreateResponse, agent, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: LlamaStackClient) -> None: - agent = client.alpha.agents.create( - agent_config={ - "instructions": "instructions", - "model": "model", - "client_tools": [ - { - "name": "name", - "description": "description", - "input_schema": {"foo": True}, - "metadata": {"foo": True}, - "output_schema": {"foo": True}, - "toolgroup_id": "toolgroup_id", - } - ], - "enable_session_persistence": True, - "input_shields": ["string"], - "max_infer_iters": 0, - "name": "name", - "output_shields": ["string"], - "response_format": { - "json_schema": {"foo": True}, - "type": "json_schema", - }, - "sampling_params": { - "strategy": {"type": "greedy"}, - "max_tokens": 0, - "repetition_penalty": 0, - "stop": ["string"], - }, - "tool_choice": "auto", - "tool_config": { - "system_message_behavior": "append", - "tool_choice": "auto", - "tool_prompt_format": "json", - }, - "tool_prompt_format": "json", - "toolgroups": ["string"], - }, - ) - assert_matches_type(AgentCreateResponse, agent, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.with_raw_response.create( - agent_config={ - "instructions": "instructions", - "model": "model", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agent = response.parse() - assert_matches_type(AgentCreateResponse, agent, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: LlamaStackClient) -> None: - with client.alpha.agents.with_streaming_response.create( - agent_config={ - "instructions": "instructions", - "model": "model", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agent = response.parse() - assert_matches_type(AgentCreateResponse, agent, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: LlamaStackClient) -> None: - agent = client.alpha.agents.retrieve( - "agent_id", - ) - assert_matches_type(AgentRetrieveResponse, agent, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.with_raw_response.retrieve( - "agent_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agent = response.parse() - assert_matches_type(AgentRetrieveResponse, agent, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: LlamaStackClient) -> None: - with client.alpha.agents.with_streaming_response.retrieve( - "agent_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agent = response.parse() - assert_matches_type(AgentRetrieveResponse, agent, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: LlamaStackClient) -> None: - agent = client.alpha.agents.list() - assert_matches_type(AgentListResponse, agent, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: LlamaStackClient) -> None: - agent = client.alpha.agents.list( - limit=0, - start_index=0, - ) - assert_matches_type(AgentListResponse, agent, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agent = response.parse() - assert_matches_type(AgentListResponse, agent, path=["response"]) - - @parametrize - def test_streaming_response_list(self, client: LlamaStackClient) -> None: - with client.alpha.agents.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agent = response.parse() - assert_matches_type(AgentListResponse, agent, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_delete(self, client: LlamaStackClient) -> None: - agent = client.alpha.agents.delete( - "agent_id", - ) - assert agent is None - - @parametrize - def test_raw_response_delete(self, client: LlamaStackClient) -> None: - response = client.alpha.agents.with_raw_response.delete( - "agent_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agent = response.parse() - assert agent is None - - @parametrize - def test_streaming_response_delete(self, client: LlamaStackClient) -> None: - with client.alpha.agents.with_streaming_response.delete( - "agent_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agent = response.parse() - assert agent is None - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_delete(self, client: LlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - client.alpha.agents.with_raw_response.delete( - "", - ) - - -class TestAsyncAgents: - parametrize = pytest.mark.parametrize( - "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] - ) - - @parametrize - async def test_method_create(self, async_client: AsyncLlamaStackClient) -> None: - agent = await async_client.alpha.agents.create( - agent_config={ - "instructions": "instructions", - "model": "model", - }, - ) - assert_matches_type(AgentCreateResponse, agent, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: - agent = await async_client.alpha.agents.create( - agent_config={ - "instructions": "instructions", - "model": "model", - "client_tools": [ - { - "name": "name", - "description": "description", - "input_schema": {"foo": True}, - "metadata": {"foo": True}, - "output_schema": {"foo": True}, - "toolgroup_id": "toolgroup_id", - } - ], - "enable_session_persistence": True, - "input_shields": ["string"], - "max_infer_iters": 0, - "name": "name", - "output_shields": ["string"], - "response_format": { - "json_schema": {"foo": True}, - "type": "json_schema", - }, - "sampling_params": { - "strategy": {"type": "greedy"}, - "max_tokens": 0, - "repetition_penalty": 0, - "stop": ["string"], - }, - "tool_choice": "auto", - "tool_config": { - "system_message_behavior": "append", - "tool_choice": "auto", - "tool_prompt_format": "json", - }, - "tool_prompt_format": "json", - "toolgroups": ["string"], - }, - ) - assert_matches_type(AgentCreateResponse, agent, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.with_raw_response.create( - agent_config={ - "instructions": "instructions", - "model": "model", - }, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agent = await response.parse() - assert_matches_type(AgentCreateResponse, agent, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.with_streaming_response.create( - agent_config={ - "instructions": "instructions", - "model": "model", - }, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agent = await response.parse() - assert_matches_type(AgentCreateResponse, agent, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - agent = await async_client.alpha.agents.retrieve( - "agent_id", - ) - assert_matches_type(AgentRetrieveResponse, agent, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.with_raw_response.retrieve( - "agent_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agent = await response.parse() - assert_matches_type(AgentRetrieveResponse, agent, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.with_streaming_response.retrieve( - "agent_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agent = await response.parse() - assert_matches_type(AgentRetrieveResponse, agent, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncLlamaStackClient) -> None: - agent = await async_client.alpha.agents.list() - assert_matches_type(AgentListResponse, agent, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: - agent = await async_client.alpha.agents.list( - limit=0, - start_index=0, - ) - assert_matches_type(AgentListResponse, agent, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agent = await response.parse() - assert_matches_type(AgentListResponse, agent, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agent = await response.parse() - assert_matches_type(AgentListResponse, agent, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_delete(self, async_client: AsyncLlamaStackClient) -> None: - agent = await async_client.alpha.agents.delete( - "agent_id", - ) - assert agent is None - - @parametrize - async def test_raw_response_delete(self, async_client: AsyncLlamaStackClient) -> None: - response = await async_client.alpha.agents.with_raw_response.delete( - "agent_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - agent = await response.parse() - assert agent is None - - @parametrize - async def test_streaming_response_delete(self, async_client: AsyncLlamaStackClient) -> None: - async with async_client.alpha.agents.with_streaming_response.delete( - "agent_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - agent = await response.parse() - assert agent is None - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_delete(self, async_client: AsyncLlamaStackClient) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): - await async_client.alpha.agents.with_raw_response.delete( - "", - ) From 6c3d4c45a8450c9bc362d336191e9c4891deaec7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 04:54:04 +0000 Subject: [PATCH 3/4] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 1ea29b6e..eca127a5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 98 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-8ca5cbc3919d101274c4f94c6046257b410584281f4e05ee4dc0ebacd7adb355.yml openapi_spec_hash: ee5e6406a8e0bfb84f810c2123e86ea5 -config_hash: 319472b9562b59beb08b5c9f73238806 +config_hash: 99e1ad2a9fd4559a679d06f9115787a4 From 231936a5eb0b39a3ae6bdc6a4c6d8ed3d862bfec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 04:54:25 +0000 Subject: [PATCH 4/4] release: 0.4.0-alpha.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 13 +++++++++++++ pyproject.toml | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4c5c3821..9bd6b642 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.4.0-alpha.3" + ".": "0.4.0-alpha.4" } diff --git a/CHANGELOG.md b/CHANGELOG.md index b69b08da..8f5d1951 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## 0.4.0-alpha.4 (2025-11-04) + +Full Changelog: [v0.4.0-alpha.3...v0.4.0-alpha.4](https://github.com/llamastack/llama-stack-client-python/compare/v0.4.0-alpha.3...v0.4.0-alpha.4) + +### Features + +* **api:** remove agents types ([ae9e51b](https://github.com/llamastack/llama-stack-client-python/commit/ae9e51bbf79cff7ddc3e1c2e0edeec77891e2374)) + + +### Chores + +* **internal:** grammar fix (it's -> its) ([2c3291c](https://github.com/llamastack/llama-stack-client-python/commit/2c3291c59b92baa4666483c93eaf98e80de169ea)) + ## 0.4.0-alpha.3 (2025-11-04) Full Changelog: [v0.4.0-alpha.2...v0.4.0-alpha.3](https://github.com/llamastack/llama-stack-client-python/compare/v0.4.0-alpha.2...v0.4.0-alpha.3) diff --git a/pyproject.toml b/pyproject.toml index b85a739b..d15bf3f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "llama_stack_client" -version = "0.4.0-alpha.3" +version = "0.4.0-alpha.4" description = "The official Python library for the llama-stack-client API" dynamic = ["readme"] license = "MIT"