From 28e0dd842895cb9cb9268adbeb9af5c6d6d80061 Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Sun, 26 Jan 2025 13:30:33 -0800 Subject: [PATCH] Sync updates from stainless branch: ashwinb/dev --- src/llama_stack_client/resources/eval/eval.py | 9 +- src/llama_stack_client/resources/inference.py | 33 ++--- .../resources/post_training/post_training.py | 10 +- src/llama_stack_client/resources/scoring.py | 9 +- .../resources/scoring_functions.py | 5 +- src/llama_stack_client/resources/telemetry.py | 18 +-- src/llama_stack_client/types/__init__.py | 8 ++ .../types/agents/__init__.py | 2 + .../types/agents/turn_create_response.py | 90 +------------ .../types/agents/turn_response_event.py | 11 ++ .../agents/turn_response_event_payload.py | 83 ++++++++++++ .../types/algorithm_config_param.py | 37 ++++++ .../types/eval_candidate_param.py | 31 +++++ .../types/eval_evaluate_rows_params.py | 117 +---------------- .../types/eval_run_eval_params.py | 118 +----------------- .../types/eval_task_config_param.py | 32 +++++ src/llama_stack_client/types/event_param.py | 89 +++++++++++++ .../types/inference_chat_completion_params.py | 23 +--- .../types/inference_completion_params.py | 25 +--- ...st_training_supervised_fine_tune_params.py | 39 +----- .../types/query_condition_param.py | 16 +++ .../types/response_format_param.py | 23 ++++ src/llama_stack_client/types/scoring_fn.py | 39 +----- .../types/scoring_fn_params.py | 41 ++++++ .../types/scoring_fn_params_param.py | 37 ++++++ .../types/scoring_function_register_params.py | 37 +----- .../types/scoring_score_batch_params.py | 44 +------ .../types/scoring_score_params.py | 44 +------ .../types/shared/content_delta.py | 16 +-- .../types/shared/interleaved_content_item.py | 14 ++- .../types/shared/param_type.py | 55 ++++---- .../types/shared/query_config.py | 14 ++- .../types/shared/sampling_params.py | 19 ++- .../shared_params/interleaved_content_item.py | 12 +- .../types/shared_params/param_type.py | 55 ++++---- .../types/shared_params/query_config.py | 15 ++- .../types/shared_params/sampling_params.py | 16 ++- .../types/telemetry_log_event_params.py | 86 +------------ .../types/telemetry_query_spans_params.py | 17 +-- .../types/telemetry_query_traces_params.py | 17 +-- .../telemetry_save_spans_to_dataset_params.py | 17 +-- tests/api_resources/test_eval.py | 5 +- tests/api_resources/test_scoring_functions.py | 5 +- 43 files changed, 658 insertions(+), 775 deletions(-) create mode 100644 src/llama_stack_client/types/agents/turn_response_event.py create mode 100644 src/llama_stack_client/types/agents/turn_response_event_payload.py create mode 100644 src/llama_stack_client/types/algorithm_config_param.py create mode 100644 src/llama_stack_client/types/eval_candidate_param.py create mode 100644 src/llama_stack_client/types/eval_task_config_param.py create mode 100644 src/llama_stack_client/types/event_param.py create mode 100644 src/llama_stack_client/types/query_condition_param.py create mode 100644 src/llama_stack_client/types/response_format_param.py create mode 100644 src/llama_stack_client/types/scoring_fn_params.py create mode 100644 src/llama_stack_client/types/scoring_fn_params_param.py diff --git a/src/llama_stack_client/resources/eval/eval.py b/src/llama_stack_client/resources/eval/eval.py index 3d25204f..a3ebbdfe 100644 --- a/src/llama_stack_client/resources/eval/eval.py +++ b/src/llama_stack_client/resources/eval/eval.py @@ -32,6 +32,7 @@ from ...types.job import Job from ..._base_client import make_request_options from ...types.evaluate_response import EvaluateResponse +from ...types.eval_task_config_param import EvalTaskConfigParam __all__ = ["EvalResource", "AsyncEvalResource"] @@ -66,7 +67,7 @@ def evaluate_rows( *, input_rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], scoring_functions: List[str], - task_config: eval_evaluate_rows_params.TaskConfig, + task_config: EvalTaskConfigParam, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -117,7 +118,7 @@ def run_eval( self, task_id: str, *, - task_config: eval_run_eval_params.TaskConfig, + task_config: EvalTaskConfigParam, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -188,7 +189,7 @@ async def evaluate_rows( *, input_rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], scoring_functions: List[str], - task_config: eval_evaluate_rows_params.TaskConfig, + task_config: EvalTaskConfigParam, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -239,7 +240,7 @@ async def run_eval( self, task_id: str, *, - task_config: eval_run_eval_params.TaskConfig, + task_config: EvalTaskConfigParam, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/llama_stack_client/resources/inference.py b/src/llama_stack_client/resources/inference.py index 8e572c9d..74095670 100644 --- a/src/llama_stack_client/resources/inference.py +++ b/src/llama_stack_client/resources/inference.py @@ -30,6 +30,7 @@ from .._streaming import Stream, AsyncStream from .._base_client import make_request_options from ..types.embeddings_response import EmbeddingsResponse +from ..types.response_format_param import ResponseFormatParam from ..types.shared_params.message import Message from ..types.inference_completion_response import InferenceCompletionResponse from ..types.shared_params.sampling_params import SamplingParams @@ -66,7 +67,7 @@ def chat_completion( messages: Iterable[Message], model_id: str, logprobs: inference_chat_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_chat_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, stream: Literal[False] | NotGiven = NOT_GIVEN, tool_choice: Literal["auto", "required"] | NotGiven = NOT_GIVEN, @@ -111,7 +112,7 @@ def chat_completion( model_id: str, stream: Literal[True], logprobs: inference_chat_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_chat_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, tool_choice: Literal["auto", "required"] | NotGiven = NOT_GIVEN, tool_prompt_format: Literal["json", "function_tag", "python_list"] | NotGiven = NOT_GIVEN, @@ -155,7 +156,7 @@ def chat_completion( model_id: str, stream: bool, logprobs: inference_chat_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_chat_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, tool_choice: Literal["auto", "required"] | NotGiven = NOT_GIVEN, tool_prompt_format: Literal["json", "function_tag", "python_list"] | NotGiven = NOT_GIVEN, @@ -198,7 +199,7 @@ def chat_completion( messages: Iterable[Message], model_id: str, logprobs: inference_chat_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_chat_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN, tool_choice: Literal["auto", "required"] | NotGiven = NOT_GIVEN, @@ -259,7 +260,7 @@ def completion( content: InterleavedContent, model_id: str, logprobs: inference_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, stream: Literal[False] | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, @@ -291,7 +292,7 @@ def completion( model_id: str, stream: Literal[True], logprobs: inference_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, @@ -322,7 +323,7 @@ def completion( model_id: str, stream: bool, logprobs: inference_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, @@ -352,7 +353,7 @@ def completion( content: InterleavedContent, model_id: str, logprobs: inference_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, @@ -476,7 +477,7 @@ async def chat_completion( messages: Iterable[Message], model_id: str, logprobs: inference_chat_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_chat_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, stream: Literal[False] | NotGiven = NOT_GIVEN, tool_choice: Literal["auto", "required"] | NotGiven = NOT_GIVEN, @@ -521,7 +522,7 @@ async def chat_completion( model_id: str, stream: Literal[True], logprobs: inference_chat_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_chat_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, tool_choice: Literal["auto", "required"] | NotGiven = NOT_GIVEN, tool_prompt_format: Literal["json", "function_tag", "python_list"] | NotGiven = NOT_GIVEN, @@ -565,7 +566,7 @@ async def chat_completion( model_id: str, stream: bool, logprobs: inference_chat_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_chat_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, tool_choice: Literal["auto", "required"] | NotGiven = NOT_GIVEN, tool_prompt_format: Literal["json", "function_tag", "python_list"] | NotGiven = NOT_GIVEN, @@ -608,7 +609,7 @@ async def chat_completion( messages: Iterable[Message], model_id: str, logprobs: inference_chat_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_chat_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN, tool_choice: Literal["auto", "required"] | NotGiven = NOT_GIVEN, @@ -669,7 +670,7 @@ async def completion( content: InterleavedContent, model_id: str, logprobs: inference_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, stream: Literal[False] | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, @@ -701,7 +702,7 @@ async def completion( model_id: str, stream: Literal[True], logprobs: inference_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, @@ -732,7 +733,7 @@ async def completion( model_id: str, stream: bool, logprobs: inference_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, @@ -762,7 +763,7 @@ async def completion( content: InterleavedContent, model_id: str, logprobs: inference_completion_params.Logprobs | NotGiven = NOT_GIVEN, - response_format: inference_completion_params.ResponseFormat | NotGiven = NOT_GIVEN, + response_format: ResponseFormatParam | NotGiven = NOT_GIVEN, sampling_params: SamplingParams | NotGiven = NOT_GIVEN, stream: Literal[False] | Literal[True] | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, diff --git a/src/llama_stack_client/resources/post_training/post_training.py b/src/llama_stack_client/resources/post_training/post_training.py index 6b8f2682..888733ea 100644 --- a/src/llama_stack_client/resources/post_training/post_training.py +++ b/src/llama_stack_client/resources/post_training/post_training.py @@ -14,7 +14,10 @@ JobResourceWithStreamingResponse, AsyncJobResourceWithStreamingResponse, ) -from ...types import post_training_preference_optimize_params, post_training_supervised_fine_tune_params +from ...types import ( + post_training_preference_optimize_params, + post_training_supervised_fine_tune_params, +) from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, @@ -31,6 +34,7 @@ ) from ..._base_client import make_request_options from ...types.post_training_job import PostTrainingJob +from ...types.algorithm_config_param import AlgorithmConfigParam __all__ = ["PostTrainingResource", "AsyncPostTrainingResource"] @@ -123,7 +127,7 @@ def supervised_fine_tune( logger_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]], model: str, training_config: post_training_supervised_fine_tune_params.TrainingConfig, - algorithm_config: post_training_supervised_fine_tune_params.AlgorithmConfig | NotGiven = NOT_GIVEN, + algorithm_config: AlgorithmConfigParam | NotGiven = NOT_GIVEN, checkpoint_dir: str | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, @@ -262,7 +266,7 @@ async def supervised_fine_tune( logger_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]], model: str, training_config: post_training_supervised_fine_tune_params.TrainingConfig, - algorithm_config: post_training_supervised_fine_tune_params.AlgorithmConfig | NotGiven = NOT_GIVEN, + algorithm_config: AlgorithmConfigParam | NotGiven = NOT_GIVEN, checkpoint_dir: str | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, diff --git a/src/llama_stack_client/resources/scoring.py b/src/llama_stack_client/resources/scoring.py index 8290b3e0..80b2e79b 100644 --- a/src/llama_stack_client/resources/scoring.py +++ b/src/llama_stack_client/resources/scoring.py @@ -23,6 +23,7 @@ ) from .._base_client import make_request_options from ..types.scoring_score_response import ScoringScoreResponse +from ..types.scoring_fn_params_param import ScoringFnParamsParam from ..types.scoring_score_batch_response import ScoringScoreBatchResponse __all__ = ["ScoringResource", "AsyncScoringResource"] @@ -52,7 +53,7 @@ def score( self, *, input_rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], - scoring_functions: Dict[str, Optional[scoring_score_params.ScoringFunctions]], + scoring_functions: Dict[str, Optional[ScoringFnParamsParam]], x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -101,7 +102,7 @@ def score_batch( *, dataset_id: str, save_results_dataset: bool, - scoring_functions: Dict[str, Optional[scoring_score_batch_params.ScoringFunctions]], + scoring_functions: Dict[str, Optional[ScoringFnParamsParam]], x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -171,7 +172,7 @@ async def score( self, *, input_rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], - scoring_functions: Dict[str, Optional[scoring_score_params.ScoringFunctions]], + scoring_functions: Dict[str, Optional[ScoringFnParamsParam]], x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -220,7 +221,7 @@ async def score_batch( *, dataset_id: str, save_results_dataset: bool, - scoring_functions: Dict[str, Optional[scoring_score_batch_params.ScoringFunctions]], + scoring_functions: Dict[str, Optional[ScoringFnParamsParam]], x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. diff --git a/src/llama_stack_client/resources/scoring_functions.py b/src/llama_stack_client/resources/scoring_functions.py index 98e4c60d..858a8e8b 100644 --- a/src/llama_stack_client/resources/scoring_functions.py +++ b/src/llama_stack_client/resources/scoring_functions.py @@ -24,6 +24,7 @@ from .._wrappers import DataWrapper from .._base_client import make_request_options from ..types.scoring_fn import ScoringFn +from ..types.scoring_fn_params_param import ScoringFnParamsParam from ..types.shared_params.return_type import ReturnType from ..types.scoring_function_list_response import ScoringFunctionListResponse @@ -141,7 +142,7 @@ def register( description: str, return_type: ReturnType, scoring_fn_id: str, - params: scoring_function_register_params.Params | NotGiven = NOT_GIVEN, + params: ScoringFnParamsParam | NotGiven = NOT_GIVEN, provider_id: str | NotGiven = NOT_GIVEN, provider_scoring_fn_id: str | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, @@ -304,7 +305,7 @@ async def register( description: str, return_type: ReturnType, scoring_fn_id: str, - params: scoring_function_register_params.Params | NotGiven = NOT_GIVEN, + params: ScoringFnParamsParam | NotGiven = NOT_GIVEN, provider_id: str | NotGiven = NOT_GIVEN, provider_scoring_fn_id: str | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, diff --git a/src/llama_stack_client/resources/telemetry.py b/src/llama_stack_client/resources/telemetry.py index 3231f5c2..5b1707b9 100644 --- a/src/llama_stack_client/resources/telemetry.py +++ b/src/llama_stack_client/resources/telemetry.py @@ -30,6 +30,8 @@ from .._wrappers import DataWrapper from ..types.trace import Trace from .._base_client import make_request_options +from ..types.event_param import EventParam +from ..types.query_condition_param import QueryConditionParam from ..types.telemetry_get_span_response import TelemetryGetSpanResponse from ..types.telemetry_query_spans_response import TelemetryQuerySpansResponse from ..types.telemetry_query_traces_response import TelemetryQueryTracesResponse @@ -203,7 +205,7 @@ def get_trace( def log_event( self, *, - event: telemetry_log_event_params.Event, + event: EventParam, ttl_seconds: int, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, @@ -252,7 +254,7 @@ def log_event( def query_spans( self, *, - attribute_filters: Iterable[telemetry_query_spans_params.AttributeFilter], + attribute_filters: Iterable[QueryConditionParam], attributes_to_return: List[str], max_depth: int | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, @@ -306,7 +308,7 @@ def query_spans( def query_traces( self, *, - attribute_filters: Iterable[telemetry_query_traces_params.AttributeFilter] | NotGiven = NOT_GIVEN, + attribute_filters: Iterable[QueryConditionParam] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: List[str] | NotGiven = NOT_GIVEN, @@ -362,7 +364,7 @@ def query_traces( def save_spans_to_dataset( self, *, - attribute_filters: Iterable[telemetry_save_spans_to_dataset_params.AttributeFilter], + attribute_filters: Iterable[QueryConditionParam], attributes_to_save: List[str], dataset_id: str, max_depth: int | NotGiven = NOT_GIVEN, @@ -578,7 +580,7 @@ async def get_trace( async def log_event( self, *, - event: telemetry_log_event_params.Event, + event: EventParam, ttl_seconds: int, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, x_llama_stack_provider_data: str | NotGiven = NOT_GIVEN, @@ -627,7 +629,7 @@ async def log_event( async def query_spans( self, *, - attribute_filters: Iterable[telemetry_query_spans_params.AttributeFilter], + attribute_filters: Iterable[QueryConditionParam], attributes_to_return: List[str], max_depth: int | NotGiven = NOT_GIVEN, x_llama_stack_client_version: str | NotGiven = NOT_GIVEN, @@ -681,7 +683,7 @@ async def query_spans( async def query_traces( self, *, - attribute_filters: Iterable[telemetry_query_traces_params.AttributeFilter] | NotGiven = NOT_GIVEN, + attribute_filters: Iterable[QueryConditionParam] | NotGiven = NOT_GIVEN, limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order_by: List[str] | NotGiven = NOT_GIVEN, @@ -737,7 +739,7 @@ async def query_traces( async def save_spans_to_dataset( self, *, - attribute_filters: Iterable[telemetry_save_spans_to_dataset_params.AttributeFilter], + attribute_filters: Iterable[QueryConditionParam], attributes_to_save: List[str], dataset_id: str, max_depth: int | NotGiven = NOT_GIVEN, diff --git a/src/llama_stack_client/types/__init__.py b/src/llama_stack_client/types/__init__.py index 015843c5..58997fc4 100644 --- a/src/llama_stack_client/types/__init__.py +++ b/src/llama_stack_client/types/__init__.py @@ -35,6 +35,7 @@ from .route_info import RouteInfo as RouteInfo from .scoring_fn import ScoringFn as ScoringFn from .tool_group import ToolGroup as ToolGroup +from .event_param import EventParam as EventParam from .health_info import HealthInfo as HealthInfo from .version_info import VersionInfo as VersionInfo from .provider_info import ProviderInfo as ProviderInfo @@ -47,6 +48,7 @@ from .tool_list_params import ToolListParams as ToolListParams from .evaluate_response import EvaluateResponse as EvaluateResponse from .post_training_job import PostTrainingJob as PostTrainingJob +from .scoring_fn_params import ScoringFnParams as ScoringFnParams from .tool_list_response import ToolListResponse as ToolListResponse from .agent_create_params import AgentCreateParams as AgentCreateParams from .completion_response import CompletionResponse as CompletionResponse @@ -56,6 +58,7 @@ from .route_list_response import RouteListResponse as RouteListResponse from .run_shield_response import RunShieldResponse as RunShieldResponse from .tool_execution_step import ToolExecutionStep as ToolExecutionStep +from .eval_candidate_param import EvalCandidateParam as EvalCandidateParam from .eval_run_eval_params import EvalRunEvalParams as EvalRunEvalParams from .list_models_response import ListModelsResponse as ListModelsResponse from .list_routes_response import ListRoutesResponse as ListRoutesResponse @@ -69,6 +72,10 @@ from .model_register_params import ModelRegisterParams as ModelRegisterParams from .paginated_rows_result import PaginatedRowsResult as PaginatedRowsResult from .query_chunks_response import QueryChunksResponse as QueryChunksResponse +from .query_condition_param import QueryConditionParam as QueryConditionParam +from .response_format_param import ResponseFormatParam as ResponseFormatParam +from .algorithm_config_param import AlgorithmConfigParam as AlgorithmConfigParam +from .eval_task_config_param import EvalTaskConfigParam as EvalTaskConfigParam from .list_datasets_response import ListDatasetsResponse as ListDatasetsResponse from .provider_list_response import ProviderListResponse as ProviderListResponse from .scoring_score_response import ScoringScoreResponse as ScoringScoreResponse @@ -78,6 +85,7 @@ from .dataset_register_params import DatasetRegisterParams as DatasetRegisterParams from .eval_task_list_response import EvalTaskListResponse as EvalTaskListResponse from .list_providers_response import ListProvidersResponse as ListProvidersResponse +from .scoring_fn_params_param import ScoringFnParamsParam as ScoringFnParamsParam from .toolgroup_list_response import ToolgroupListResponse as ToolgroupListResponse from .vector_db_list_response import VectorDBListResponse as VectorDBListResponse from .vector_io_insert_params import VectorIoInsertParams as VectorIoInsertParams diff --git a/src/llama_stack_client/types/agents/__init__.py b/src/llama_stack_client/types/agents/__init__.py index 4c70d9a6..5ee899c2 100644 --- a/src/llama_stack_client/types/agents/__init__.py +++ b/src/llama_stack_client/types/agents/__init__.py @@ -5,8 +5,10 @@ from .turn import Turn as Turn from .session import Session as Session from .turn_create_params import TurnCreateParams as TurnCreateParams +from .turn_response_event import TurnResponseEvent as TurnResponseEvent from .turn_create_response import TurnCreateResponse as TurnCreateResponse from .session_create_params import SessionCreateParams as SessionCreateParams 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 .turn_response_event_payload import TurnResponseEventPayload as TurnResponseEventPayload diff --git a/src/llama_stack_client/types/agents/turn_create_response.py b/src/llama_stack_client/types/agents/turn_create_response.py index 16f48abe..8e12c94d 100644 --- a/src/llama_stack_client/types/agents/turn_create_response.py +++ b/src/llama_stack_client/types/agents/turn_create_response.py @@ -1,97 +1,17 @@ # 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 typing import Union +from typing_extensions import 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 ..tool_execution_step import ToolExecutionStep -from ..shared.content_delta import ContentDelta -from ..memory_retrieval_step import MemoryRetrievalStep +from .turn_response_event import TurnResponseEvent -__all__ = [ - "TurnCreateResponse", - "AgentTurnResponseStreamChunk", - "AgentTurnResponseStreamChunkEvent", - "AgentTurnResponseStreamChunkEventPayload", - "AgentTurnResponseStreamChunkEventPayloadStepStart", - "AgentTurnResponseStreamChunkEventPayloadStepProgress", - "AgentTurnResponseStreamChunkEventPayloadStepComplete", - "AgentTurnResponseStreamChunkEventPayloadStepCompleteStepDetails", - "AgentTurnResponseStreamChunkEventPayloadTurnStart", - "AgentTurnResponseStreamChunkEventPayloadTurnComplete", -] - - -class AgentTurnResponseStreamChunkEventPayloadStepStart(BaseModel): - event_type: Literal["step_start"] - - step_id: str - - step_type: Literal["inference", "tool_execution", "shield_call", "memory_retrieval"] - - metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - - -class AgentTurnResponseStreamChunkEventPayloadStepProgress(BaseModel): - delta: ContentDelta - - event_type: Literal["step_progress"] - - step_id: str - - step_type: Literal["inference", "tool_execution", "shield_call", "memory_retrieval"] - - -AgentTurnResponseStreamChunkEventPayloadStepCompleteStepDetails: TypeAlias = Annotated[ - Union[InferenceStep, ToolExecutionStep, ShieldCallStep, MemoryRetrievalStep], - PropertyInfo(discriminator="step_type"), -] - - -class AgentTurnResponseStreamChunkEventPayloadStepComplete(BaseModel): - event_type: Literal["step_complete"] - - step_details: AgentTurnResponseStreamChunkEventPayloadStepCompleteStepDetails - - step_id: str - - step_type: Literal["inference", "tool_execution", "shield_call", "memory_retrieval"] - - -class AgentTurnResponseStreamChunkEventPayloadTurnStart(BaseModel): - event_type: Literal["turn_start"] - - turn_id: str - - -class AgentTurnResponseStreamChunkEventPayloadTurnComplete(BaseModel): - event_type: Literal["turn_complete"] - - turn: Turn - - -AgentTurnResponseStreamChunkEventPayload: TypeAlias = Annotated[ - Union[ - AgentTurnResponseStreamChunkEventPayloadStepStart, - AgentTurnResponseStreamChunkEventPayloadStepProgress, - AgentTurnResponseStreamChunkEventPayloadStepComplete, - AgentTurnResponseStreamChunkEventPayloadTurnStart, - AgentTurnResponseStreamChunkEventPayloadTurnComplete, - ], - PropertyInfo(discriminator="event_type"), -] - - -class AgentTurnResponseStreamChunkEvent(BaseModel): - payload: AgentTurnResponseStreamChunkEventPayload +__all__ = ["TurnCreateResponse", "AgentTurnResponseStreamChunk"] class AgentTurnResponseStreamChunk(BaseModel): - event: AgentTurnResponseStreamChunkEvent + event: TurnResponseEvent TurnCreateResponse: TypeAlias = Union[Turn, AgentTurnResponseStreamChunk] diff --git a/src/llama_stack_client/types/agents/turn_response_event.py b/src/llama_stack_client/types/agents/turn_response_event.py new file mode 100644 index 00000000..1b9ad5a6 --- /dev/null +++ b/src/llama_stack_client/types/agents/turn_response_event.py @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + + +from ..._models import BaseModel +from .turn_response_event_payload import TurnResponseEventPayload + +__all__ = ["TurnResponseEvent"] + + +class TurnResponseEvent(BaseModel): + payload: TurnResponseEventPayload diff --git a/src/llama_stack_client/types/agents/turn_response_event_payload.py b/src/llama_stack_client/types/agents/turn_response_event_payload.py new file mode 100644 index 00000000..d320a9b3 --- /dev/null +++ b/src/llama_stack_client/types/agents/turn_response_event_payload.py @@ -0,0 +1,83 @@ +# 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 ..tool_execution_step import ToolExecutionStep +from ..shared.content_delta import ContentDelta +from ..memory_retrieval_step import MemoryRetrievalStep + +__all__ = [ + "TurnResponseEventPayload", + "AgentTurnResponseStepStartPayload", + "AgentTurnResponseStepProgressPayload", + "AgentTurnResponseStepCompletePayload", + "AgentTurnResponseStepCompletePayloadStepDetails", + "AgentTurnResponseTurnStartPayload", + "AgentTurnResponseTurnCompletePayload", +] + + +class AgentTurnResponseStepStartPayload(BaseModel): + event_type: Literal["step_start"] + + step_id: str + + step_type: Literal["inference", "tool_execution", "shield_call", "memory_retrieval"] + + metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None + + +class AgentTurnResponseStepProgressPayload(BaseModel): + delta: ContentDelta + + event_type: Literal["step_progress"] + + step_id: str + + step_type: Literal["inference", "tool_execution", "shield_call", "memory_retrieval"] + + +AgentTurnResponseStepCompletePayloadStepDetails: TypeAlias = Annotated[ + Union[InferenceStep, ToolExecutionStep, ShieldCallStep, MemoryRetrievalStep], + PropertyInfo(discriminator="step_type"), +] + + +class AgentTurnResponseStepCompletePayload(BaseModel): + event_type: Literal["step_complete"] + + step_details: AgentTurnResponseStepCompletePayloadStepDetails + + step_id: str + + step_type: Literal["inference", "tool_execution", "shield_call", "memory_retrieval"] + + +class AgentTurnResponseTurnStartPayload(BaseModel): + event_type: Literal["turn_start"] + + turn_id: str + + +class AgentTurnResponseTurnCompletePayload(BaseModel): + event_type: Literal["turn_complete"] + + turn: Turn + + +TurnResponseEventPayload: TypeAlias = Annotated[ + Union[ + AgentTurnResponseStepStartPayload, + AgentTurnResponseStepProgressPayload, + AgentTurnResponseStepCompletePayload, + AgentTurnResponseTurnStartPayload, + AgentTurnResponseTurnCompletePayload, + ], + PropertyInfo(discriminator="event_type"), +] diff --git a/src/llama_stack_client/types/algorithm_config_param.py b/src/llama_stack_client/types/algorithm_config_param.py new file mode 100644 index 00000000..3f3c0cac --- /dev/null +++ b/src/llama_stack_client/types/algorithm_config_param.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = ["AlgorithmConfigParam", "LoraFinetuningConfig", "QatFinetuningConfig"] + + +class LoraFinetuningConfig(TypedDict, total=False): + alpha: Required[int] + + apply_lora_to_mlp: Required[bool] + + apply_lora_to_output: Required[bool] + + lora_attn_modules: Required[List[str]] + + rank: Required[int] + + type: Required[Literal["LoRA"]] + + quantize_base: bool + + use_dora: bool + + +class QatFinetuningConfig(TypedDict, total=False): + group_size: Required[int] + + quantizer_name: Required[str] + + type: Required[Literal["QAT"]] + + +AlgorithmConfigParam: TypeAlias = Union[LoraFinetuningConfig, QatFinetuningConfig] diff --git a/src/llama_stack_client/types/eval_candidate_param.py b/src/llama_stack_client/types/eval_candidate_param.py new file mode 100644 index 00000000..d9483b5b --- /dev/null +++ b/src/llama_stack_client/types/eval_candidate_param.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .shared_params.agent_config import AgentConfig +from .shared_params.system_message import SystemMessage +from .shared_params.sampling_params import SamplingParams + +__all__ = ["EvalCandidateParam", "ModelCandidate", "AgentCandidate"] + + +class ModelCandidate(TypedDict, total=False): + model: Required[str] + + sampling_params: Required[SamplingParams] + + type: Required[Literal["model"]] + + system_message: SystemMessage + + +class AgentCandidate(TypedDict, total=False): + config: Required[AgentConfig] + + type: Required[Literal["agent"]] + + +EvalCandidateParam: TypeAlias = Union[ModelCandidate, AgentCandidate] diff --git a/src/llama_stack_client/types/eval_evaluate_rows_params.py b/src/llama_stack_client/types/eval_evaluate_rows_params.py index 10e32ea7..c3ed4bae 100644 --- a/src/llama_stack_client/types/eval_evaluate_rows_params.py +++ b/src/llama_stack_client/types/eval_evaluate_rows_params.py @@ -3,29 +3,12 @@ from __future__ import annotations from typing import Dict, List, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo -from .shared_params.agent_config import AgentConfig -from .shared_params.system_message import SystemMessage -from .shared_params.sampling_params import SamplingParams +from .eval_task_config_param import EvalTaskConfigParam -__all__ = [ - "EvalEvaluateRowsParams", - "TaskConfig", - "TaskConfigBenchmark", - "TaskConfigBenchmarkEvalCandidate", - "TaskConfigBenchmarkEvalCandidateModel", - "TaskConfigBenchmarkEvalCandidateAgent", - "TaskConfigApp", - "TaskConfigAppEvalCandidate", - "TaskConfigAppEvalCandidateModel", - "TaskConfigAppEvalCandidateAgent", - "TaskConfigAppScoringParams", - "TaskConfigAppScoringParamsLlmAsJudge", - "TaskConfigAppScoringParamsRegexParser", - "TaskConfigAppScoringParamsBasic", -] +__all__ = ["EvalEvaluateRowsParams"] class EvalEvaluateRowsParams(TypedDict, total=False): @@ -33,100 +16,8 @@ class EvalEvaluateRowsParams(TypedDict, total=False): scoring_functions: Required[List[str]] - task_config: Required[TaskConfig] + task_config: Required[EvalTaskConfigParam] x_llama_stack_client_version: Annotated[str, PropertyInfo(alias="X-LlamaStack-Client-Version")] x_llama_stack_provider_data: Annotated[str, PropertyInfo(alias="X-LlamaStack-Provider-Data")] - - -class TaskConfigBenchmarkEvalCandidateModel(TypedDict, total=False): - model: Required[str] - - sampling_params: Required[SamplingParams] - - type: Required[Literal["model"]] - - system_message: SystemMessage - - -class TaskConfigBenchmarkEvalCandidateAgent(TypedDict, total=False): - config: Required[AgentConfig] - - type: Required[Literal["agent"]] - - -TaskConfigBenchmarkEvalCandidate: TypeAlias = Union[ - TaskConfigBenchmarkEvalCandidateModel, TaskConfigBenchmarkEvalCandidateAgent -] - - -class TaskConfigBenchmark(TypedDict, total=False): - eval_candidate: Required[TaskConfigBenchmarkEvalCandidate] - - type: Required[Literal["benchmark"]] - - num_examples: int - - -class TaskConfigAppEvalCandidateModel(TypedDict, total=False): - model: Required[str] - - sampling_params: Required[SamplingParams] - - type: Required[Literal["model"]] - - system_message: SystemMessage - - -class TaskConfigAppEvalCandidateAgent(TypedDict, total=False): - config: Required[AgentConfig] - - type: Required[Literal["agent"]] - - -TaskConfigAppEvalCandidate: TypeAlias = Union[TaskConfigAppEvalCandidateModel, TaskConfigAppEvalCandidateAgent] - - -class TaskConfigAppScoringParamsLlmAsJudge(TypedDict, total=False): - judge_model: Required[str] - - type: Required[Literal["llm_as_judge"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - judge_score_regexes: List[str] - - prompt_template: str - - -class TaskConfigAppScoringParamsRegexParser(TypedDict, total=False): - type: Required[Literal["regex_parser"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - parsing_regexes: List[str] - - -class TaskConfigAppScoringParamsBasic(TypedDict, total=False): - type: Required[Literal["basic"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - -TaskConfigAppScoringParams: TypeAlias = Union[ - TaskConfigAppScoringParamsLlmAsJudge, TaskConfigAppScoringParamsRegexParser, TaskConfigAppScoringParamsBasic -] - - -class TaskConfigApp(TypedDict, total=False): - eval_candidate: Required[TaskConfigAppEvalCandidate] - - scoring_params: Required[Dict[str, TaskConfigAppScoringParams]] - - type: Required[Literal["app"]] - - num_examples: int - - -TaskConfig: TypeAlias = Union[TaskConfigBenchmark, TaskConfigApp] diff --git a/src/llama_stack_client/types/eval_run_eval_params.py b/src/llama_stack_client/types/eval_run_eval_params.py index 87f4928b..cd37e293 100644 --- a/src/llama_stack_client/types/eval_run_eval_params.py +++ b/src/llama_stack_client/types/eval_run_eval_params.py @@ -2,127 +2,17 @@ from __future__ import annotations -from typing import Dict, List, Union -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo -from .shared_params.agent_config import AgentConfig -from .shared_params.system_message import SystemMessage -from .shared_params.sampling_params import SamplingParams +from .eval_task_config_param import EvalTaskConfigParam -__all__ = [ - "EvalRunEvalParams", - "TaskConfig", - "TaskConfigBenchmark", - "TaskConfigBenchmarkEvalCandidate", - "TaskConfigBenchmarkEvalCandidateModel", - "TaskConfigBenchmarkEvalCandidateAgent", - "TaskConfigApp", - "TaskConfigAppEvalCandidate", - "TaskConfigAppEvalCandidateModel", - "TaskConfigAppEvalCandidateAgent", - "TaskConfigAppScoringParams", - "TaskConfigAppScoringParamsLlmAsJudge", - "TaskConfigAppScoringParamsRegexParser", - "TaskConfigAppScoringParamsBasic", -] +__all__ = ["EvalRunEvalParams"] class EvalRunEvalParams(TypedDict, total=False): - task_config: Required[TaskConfig] + task_config: Required[EvalTaskConfigParam] x_llama_stack_client_version: Annotated[str, PropertyInfo(alias="X-LlamaStack-Client-Version")] x_llama_stack_provider_data: Annotated[str, PropertyInfo(alias="X-LlamaStack-Provider-Data")] - - -class TaskConfigBenchmarkEvalCandidateModel(TypedDict, total=False): - model: Required[str] - - sampling_params: Required[SamplingParams] - - type: Required[Literal["model"]] - - system_message: SystemMessage - - -class TaskConfigBenchmarkEvalCandidateAgent(TypedDict, total=False): - config: Required[AgentConfig] - - type: Required[Literal["agent"]] - - -TaskConfigBenchmarkEvalCandidate: TypeAlias = Union[ - TaskConfigBenchmarkEvalCandidateModel, TaskConfigBenchmarkEvalCandidateAgent -] - - -class TaskConfigBenchmark(TypedDict, total=False): - eval_candidate: Required[TaskConfigBenchmarkEvalCandidate] - - type: Required[Literal["benchmark"]] - - num_examples: int - - -class TaskConfigAppEvalCandidateModel(TypedDict, total=False): - model: Required[str] - - sampling_params: Required[SamplingParams] - - type: Required[Literal["model"]] - - system_message: SystemMessage - - -class TaskConfigAppEvalCandidateAgent(TypedDict, total=False): - config: Required[AgentConfig] - - type: Required[Literal["agent"]] - - -TaskConfigAppEvalCandidate: TypeAlias = Union[TaskConfigAppEvalCandidateModel, TaskConfigAppEvalCandidateAgent] - - -class TaskConfigAppScoringParamsLlmAsJudge(TypedDict, total=False): - judge_model: Required[str] - - type: Required[Literal["llm_as_judge"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - judge_score_regexes: List[str] - - prompt_template: str - - -class TaskConfigAppScoringParamsRegexParser(TypedDict, total=False): - type: Required[Literal["regex_parser"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - parsing_regexes: List[str] - - -class TaskConfigAppScoringParamsBasic(TypedDict, total=False): - type: Required[Literal["basic"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - -TaskConfigAppScoringParams: TypeAlias = Union[ - TaskConfigAppScoringParamsLlmAsJudge, TaskConfigAppScoringParamsRegexParser, TaskConfigAppScoringParamsBasic -] - - -class TaskConfigApp(TypedDict, total=False): - eval_candidate: Required[TaskConfigAppEvalCandidate] - - scoring_params: Required[Dict[str, TaskConfigAppScoringParams]] - - type: Required[Literal["app"]] - - num_examples: int - - -TaskConfig: TypeAlias = Union[TaskConfigBenchmark, TaskConfigApp] diff --git a/src/llama_stack_client/types/eval_task_config_param.py b/src/llama_stack_client/types/eval_task_config_param.py new file mode 100644 index 00000000..9ec5e29d --- /dev/null +++ b/src/llama_stack_client/types/eval_task_config_param.py @@ -0,0 +1,32 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +from .eval_candidate_param import EvalCandidateParam +from .scoring_fn_params_param import ScoringFnParamsParam + +__all__ = ["EvalTaskConfigParam", "BenchmarkEvalTaskConfig", "AppEvalTaskConfig"] + + +class BenchmarkEvalTaskConfig(TypedDict, total=False): + eval_candidate: Required[EvalCandidateParam] + + type: Required[Literal["benchmark"]] + + num_examples: int + + +class AppEvalTaskConfig(TypedDict, total=False): + eval_candidate: Required[EvalCandidateParam] + + scoring_params: Required[Dict[str, ScoringFnParamsParam]] + + type: Required[Literal["app"]] + + num_examples: int + + +EvalTaskConfigParam: TypeAlias = Union[BenchmarkEvalTaskConfig, AppEvalTaskConfig] diff --git a/src/llama_stack_client/types/event_param.py b/src/llama_stack_client/types/event_param.py new file mode 100644 index 00000000..7505d6f7 --- /dev/null +++ b/src/llama_stack_client/types/event_param.py @@ -0,0 +1,89 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Union, Iterable +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict + +from .._utils import PropertyInfo + +__all__ = [ + "EventParam", + "UnstructuredLogEvent", + "MetricEvent", + "StructuredLogEvent", + "StructuredLogEventPayload", + "StructuredLogEventPayloadSpanStartPayload", + "StructuredLogEventPayloadSpanEndPayload", +] + + +class UnstructuredLogEvent(TypedDict, total=False): + message: Required[str] + + severity: Required[Literal["verbose", "debug", "info", "warn", "error", "critical"]] + + span_id: Required[str] + + timestamp: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + + trace_id: Required[str] + + type: Required[Literal["unstructured_log"]] + + attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] + + +class MetricEvent(TypedDict, total=False): + metric: Required[str] + + span_id: Required[str] + + timestamp: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + + trace_id: Required[str] + + type: Required[Literal["metric"]] + + unit: Required[str] + + value: Required[float] + + attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] + + +class StructuredLogEventPayloadSpanStartPayload(TypedDict, total=False): + name: Required[str] + + type: Required[Literal["span_start"]] + + parent_span_id: str + + +class StructuredLogEventPayloadSpanEndPayload(TypedDict, total=False): + status: Required[Literal["ok", "error"]] + + type: Required[Literal["span_end"]] + + +StructuredLogEventPayload: TypeAlias = Union[ + StructuredLogEventPayloadSpanStartPayload, StructuredLogEventPayloadSpanEndPayload +] + + +class StructuredLogEvent(TypedDict, total=False): + payload: Required[StructuredLogEventPayload] + + span_id: Required[str] + + timestamp: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + + trace_id: Required[str] + + type: Required[Literal["structured_log"]] + + attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] + + +EventParam: TypeAlias = Union[UnstructuredLogEvent, MetricEvent, StructuredLogEvent] diff --git a/src/llama_stack_client/types/inference_chat_completion_params.py b/src/llama_stack_client/types/inference_chat_completion_params.py index 4d22a7d2..3ab3c497 100644 --- a/src/llama_stack_client/types/inference_chat_completion_params.py +++ b/src/llama_stack_client/types/inference_chat_completion_params.py @@ -3,9 +3,10 @@ from __future__ import annotations from typing import Dict, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Literal, Required, Annotated, TypedDict from .._utils import PropertyInfo +from .response_format_param import ResponseFormatParam from .shared_params.message import Message from .shared_params.sampling_params import SamplingParams from .shared_params.tool_param_definition import ToolParamDefinition @@ -13,9 +14,6 @@ __all__ = [ "InferenceChatCompletionParamsBase", "Logprobs", - "ResponseFormat", - "ResponseFormatJsonSchema", - "ResponseFormatGrammar", "Tool", "InferenceChatCompletionParamsNonStreaming", "InferenceChatCompletionParamsStreaming", @@ -29,7 +27,7 @@ class InferenceChatCompletionParamsBase(TypedDict, total=False): logprobs: Logprobs - response_format: ResponseFormat + response_format: ResponseFormatParam sampling_params: SamplingParams @@ -59,21 +57,6 @@ class Logprobs(TypedDict, total=False): top_k: int -class ResponseFormatJsonSchema(TypedDict, total=False): - json_schema: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - - type: Required[Literal["json_schema"]] - - -class ResponseFormatGrammar(TypedDict, total=False): - bnf: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - - type: Required[Literal["grammar"]] - - -ResponseFormat: TypeAlias = Union[ResponseFormatJsonSchema, ResponseFormatGrammar] - - class Tool(TypedDict, total=False): tool_name: Required[Union[Literal["brave_search", "wolfram_alpha", "photogen", "code_interpreter"], str]] diff --git a/src/llama_stack_client/types/inference_completion_params.py b/src/llama_stack_client/types/inference_completion_params.py index efa3ace2..d2632617 100644 --- a/src/llama_stack_client/types/inference_completion_params.py +++ b/src/llama_stack_client/types/inference_completion_params.py @@ -2,19 +2,17 @@ from __future__ import annotations -from typing import Dict, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import Union +from typing_extensions import Literal, Required, Annotated, TypedDict from .._utils import PropertyInfo +from .response_format_param import ResponseFormatParam from .shared_params.sampling_params import SamplingParams from .shared_params.interleaved_content import InterleavedContent __all__ = [ "InferenceCompletionParamsBase", "Logprobs", - "ResponseFormat", - "ResponseFormatJsonSchema", - "ResponseFormatGrammar", "InferenceCompletionParamsNonStreaming", "InferenceCompletionParamsStreaming", ] @@ -27,7 +25,7 @@ class InferenceCompletionParamsBase(TypedDict, total=False): logprobs: Logprobs - response_format: ResponseFormat + response_format: ResponseFormatParam sampling_params: SamplingParams @@ -40,21 +38,6 @@ class Logprobs(TypedDict, total=False): top_k: int -class ResponseFormatJsonSchema(TypedDict, total=False): - json_schema: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - - type: Required[Literal["json_schema"]] - - -class ResponseFormatGrammar(TypedDict, total=False): - bnf: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - - type: Required[Literal["grammar"]] - - -ResponseFormat: TypeAlias = Union[ResponseFormatJsonSchema, ResponseFormatGrammar] - - class InferenceCompletionParamsNonStreaming(InferenceCompletionParamsBase, total=False): stream: Literal[False] diff --git a/src/llama_stack_client/types/post_training_supervised_fine_tune_params.py b/src/llama_stack_client/types/post_training_supervised_fine_tune_params.py index 0e2a4212..923ceaf6 100644 --- a/src/llama_stack_client/types/post_training_supervised_fine_tune_params.py +++ b/src/llama_stack_client/types/post_training_supervised_fine_tune_params.py @@ -2,10 +2,11 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import Dict, Union, Iterable +from typing_extensions import Literal, Required, Annotated, TypedDict from .._utils import PropertyInfo +from .algorithm_config_param import AlgorithmConfigParam __all__ = [ "PostTrainingSupervisedFineTuneParams", @@ -13,9 +14,6 @@ "TrainingConfigDataConfig", "TrainingConfigOptimizerConfig", "TrainingConfigEfficiencyConfig", - "AlgorithmConfig", - "AlgorithmConfigLoRa", - "AlgorithmConfigQat", ] @@ -30,7 +28,7 @@ class PostTrainingSupervisedFineTuneParams(TypedDict, total=False): training_config: Required[TrainingConfig] - algorithm_config: AlgorithmConfig + algorithm_config: AlgorithmConfigParam checkpoint_dir: str @@ -91,32 +89,3 @@ class TrainingConfig(TypedDict, total=False): dtype: str efficiency_config: TrainingConfigEfficiencyConfig - - -class AlgorithmConfigLoRa(TypedDict, total=False): - alpha: Required[int] - - apply_lora_to_mlp: Required[bool] - - apply_lora_to_output: Required[bool] - - lora_attn_modules: Required[List[str]] - - rank: Required[int] - - type: Required[Literal["LoRA"]] - - quantize_base: bool - - use_dora: bool - - -class AlgorithmConfigQat(TypedDict, total=False): - group_size: Required[int] - - quantizer_name: Required[str] - - type: Required[Literal["QAT"]] - - -AlgorithmConfig: TypeAlias = Union[AlgorithmConfigLoRa, AlgorithmConfigQat] diff --git a/src/llama_stack_client/types/query_condition_param.py b/src/llama_stack_client/types/query_condition_param.py new file mode 100644 index 00000000..37c48093 --- /dev/null +++ b/src/llama_stack_client/types/query_condition_param.py @@ -0,0 +1,16 @@ +# 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 + +__all__ = ["QueryConditionParam"] + + +class QueryConditionParam(TypedDict, total=False): + key: Required[str] + + op: Required[Literal["eq", "ne", "gt", "lt"]] + + value: Required[Union[bool, float, str, Iterable[object], object, None]] diff --git a/src/llama_stack_client/types/response_format_param.py b/src/llama_stack_client/types/response_format_param.py new file mode 100644 index 00000000..bc8fdefc --- /dev/null +++ b/src/llama_stack_client/types/response_format_param.py @@ -0,0 +1,23 @@ +# 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__ = ["ResponseFormatParam", "JsonSchemaResponseFormat", "GrammarResponseFormat"] + + +class JsonSchemaResponseFormat(TypedDict, total=False): + json_schema: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] + + type: Required[Literal["json_schema"]] + + +class GrammarResponseFormat(TypedDict, total=False): + bnf: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] + + type: Required[Literal["grammar"]] + + +ResponseFormatParam: TypeAlias = Union[JsonSchemaResponseFormat, GrammarResponseFormat] diff --git a/src/llama_stack_client/types/scoring_fn.py b/src/llama_stack_client/types/scoring_fn.py index 0e29e956..459f090b 100644 --- a/src/llama_stack_client/types/scoring_fn.py +++ b/src/llama_stack_client/types/scoring_fn.py @@ -1,44 +1,13 @@ # 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 typing_extensions import Literal -from .._utils import PropertyInfo from .._models import BaseModel +from .scoring_fn_params import ScoringFnParams from .shared.return_type import ReturnType -__all__ = ["ScoringFn", "Params", "ParamsLlmAsJudge", "ParamsRegexParser", "ParamsBasic"] - - -class ParamsLlmAsJudge(BaseModel): - judge_model: str - - type: Literal["llm_as_judge"] - - aggregation_functions: Optional[List[Literal["average", "median", "categorical_count", "accuracy"]]] = None - - judge_score_regexes: Optional[List[str]] = None - - prompt_template: Optional[str] = None - - -class ParamsRegexParser(BaseModel): - type: Literal["regex_parser"] - - aggregation_functions: Optional[List[Literal["average", "median", "categorical_count", "accuracy"]]] = None - - parsing_regexes: Optional[List[str]] = None - - -class ParamsBasic(BaseModel): - type: Literal["basic"] - - aggregation_functions: Optional[List[Literal["average", "median", "categorical_count", "accuracy"]]] = None - - -Params: TypeAlias = Annotated[ - Union[ParamsLlmAsJudge, ParamsRegexParser, ParamsBasic], PropertyInfo(discriminator="type") -] +__all__ = ["ScoringFn"] class ScoringFn(BaseModel): @@ -56,4 +25,4 @@ class ScoringFn(BaseModel): description: Optional[str] = None - params: Optional[Params] = None + params: Optional[ScoringFnParams] = None diff --git a/src/llama_stack_client/types/scoring_fn_params.py b/src/llama_stack_client/types/scoring_fn_params.py new file mode 100644 index 00000000..5ca23590 --- /dev/null +++ b/src/llama_stack_client/types/scoring_fn_params.py @@ -0,0 +1,41 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Union, Optional +from typing_extensions import Literal, Annotated, TypeAlias + +from .._utils import PropertyInfo +from .._models import BaseModel + +__all__ = ["ScoringFnParams", "LlmAsJudgeScoringFnParams", "RegexParserScoringFnParams", "BasicScoringFnParams"] + + +class LlmAsJudgeScoringFnParams(BaseModel): + judge_model: str + + type: Literal["llm_as_judge"] + + aggregation_functions: Optional[List[Literal["average", "median", "categorical_count", "accuracy"]]] = None + + judge_score_regexes: Optional[List[str]] = None + + prompt_template: Optional[str] = None + + +class RegexParserScoringFnParams(BaseModel): + type: Literal["regex_parser"] + + aggregation_functions: Optional[List[Literal["average", "median", "categorical_count", "accuracy"]]] = None + + parsing_regexes: Optional[List[str]] = None + + +class BasicScoringFnParams(BaseModel): + type: Literal["basic"] + + aggregation_functions: Optional[List[Literal["average", "median", "categorical_count", "accuracy"]]] = None + + +ScoringFnParams: TypeAlias = Annotated[ + Union[LlmAsJudgeScoringFnParams, RegexParserScoringFnParams, BasicScoringFnParams], + PropertyInfo(discriminator="type"), +] diff --git a/src/llama_stack_client/types/scoring_fn_params_param.py b/src/llama_stack_client/types/scoring_fn_params_param.py new file mode 100644 index 00000000..5b636c27 --- /dev/null +++ b/src/llama_stack_client/types/scoring_fn_params_param.py @@ -0,0 +1,37 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = ["ScoringFnParamsParam", "LlmAsJudgeScoringFnParams", "RegexParserScoringFnParams", "BasicScoringFnParams"] + + +class LlmAsJudgeScoringFnParams(TypedDict, total=False): + judge_model: Required[str] + + type: Required[Literal["llm_as_judge"]] + + aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] + + judge_score_regexes: List[str] + + prompt_template: str + + +class RegexParserScoringFnParams(TypedDict, total=False): + type: Required[Literal["regex_parser"]] + + aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] + + parsing_regexes: List[str] + + +class BasicScoringFnParams(TypedDict, total=False): + type: Required[Literal["basic"]] + + aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] + + +ScoringFnParamsParam: TypeAlias = Union[LlmAsJudgeScoringFnParams, RegexParserScoringFnParams, BasicScoringFnParams] diff --git a/src/llama_stack_client/types/scoring_function_register_params.py b/src/llama_stack_client/types/scoring_function_register_params.py index 1c7347cf..d00a7576 100644 --- a/src/llama_stack_client/types/scoring_function_register_params.py +++ b/src/llama_stack_client/types/scoring_function_register_params.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import List, Union -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo +from .scoring_fn_params_param import ScoringFnParamsParam from .shared_params.return_type import ReturnType -__all__ = ["ScoringFunctionRegisterParams", "Params", "ParamsLlmAsJudge", "ParamsRegexParser", "ParamsBasic"] +__all__ = ["ScoringFunctionRegisterParams"] class ScoringFunctionRegisterParams(TypedDict, total=False): @@ -18,7 +18,7 @@ class ScoringFunctionRegisterParams(TypedDict, total=False): scoring_fn_id: Required[str] - params: Params + params: ScoringFnParamsParam provider_id: str @@ -27,32 +27,3 @@ class ScoringFunctionRegisterParams(TypedDict, total=False): x_llama_stack_client_version: Annotated[str, PropertyInfo(alias="X-LlamaStack-Client-Version")] x_llama_stack_provider_data: Annotated[str, PropertyInfo(alias="X-LlamaStack-Provider-Data")] - - -class ParamsLlmAsJudge(TypedDict, total=False): - judge_model: Required[str] - - type: Required[Literal["llm_as_judge"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - judge_score_regexes: List[str] - - prompt_template: str - - -class ParamsRegexParser(TypedDict, total=False): - type: Required[Literal["regex_parser"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - parsing_regexes: List[str] - - -class ParamsBasic(TypedDict, total=False): - type: Required[Literal["basic"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - -Params: TypeAlias = Union[ParamsLlmAsJudge, ParamsRegexParser, ParamsBasic] diff --git a/src/llama_stack_client/types/scoring_score_batch_params.py b/src/llama_stack_client/types/scoring_score_batch_params.py index affae33d..dd6a7430 100644 --- a/src/llama_stack_client/types/scoring_score_batch_params.py +++ b/src/llama_stack_client/types/scoring_score_batch_params.py @@ -2,18 +2,13 @@ from __future__ import annotations -from typing import Dict, List, Union, Optional -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import Dict, Optional +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo +from .scoring_fn_params_param import ScoringFnParamsParam -__all__ = [ - "ScoringScoreBatchParams", - "ScoringFunctions", - "ScoringFunctionsLlmAsJudge", - "ScoringFunctionsRegexParser", - "ScoringFunctionsBasic", -] +__all__ = ["ScoringScoreBatchParams"] class ScoringScoreBatchParams(TypedDict, total=False): @@ -21,37 +16,8 @@ class ScoringScoreBatchParams(TypedDict, total=False): save_results_dataset: Required[bool] - scoring_functions: Required[Dict[str, Optional[ScoringFunctions]]] + scoring_functions: Required[Dict[str, Optional[ScoringFnParamsParam]]] x_llama_stack_client_version: Annotated[str, PropertyInfo(alias="X-LlamaStack-Client-Version")] x_llama_stack_provider_data: Annotated[str, PropertyInfo(alias="X-LlamaStack-Provider-Data")] - - -class ScoringFunctionsLlmAsJudge(TypedDict, total=False): - judge_model: Required[str] - - type: Required[Literal["llm_as_judge"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - judge_score_regexes: List[str] - - prompt_template: str - - -class ScoringFunctionsRegexParser(TypedDict, total=False): - type: Required[Literal["regex_parser"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - parsing_regexes: List[str] - - -class ScoringFunctionsBasic(TypedDict, total=False): - type: Required[Literal["basic"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - -ScoringFunctions: TypeAlias = Union[ScoringFunctionsLlmAsJudge, ScoringFunctionsRegexParser, ScoringFunctionsBasic] diff --git a/src/llama_stack_client/types/scoring_score_params.py b/src/llama_stack_client/types/scoring_score_params.py index 561f2627..f294e191 100644 --- a/src/llama_stack_client/types/scoring_score_params.py +++ b/src/llama_stack_client/types/scoring_score_params.py @@ -2,54 +2,20 @@ from __future__ import annotations -from typing import Dict, List, Union, Iterable, Optional -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing import Dict, Union, Iterable, Optional +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo +from .scoring_fn_params_param import ScoringFnParamsParam -__all__ = [ - "ScoringScoreParams", - "ScoringFunctions", - "ScoringFunctionsLlmAsJudge", - "ScoringFunctionsRegexParser", - "ScoringFunctionsBasic", -] +__all__ = ["ScoringScoreParams"] class ScoringScoreParams(TypedDict, total=False): input_rows: Required[Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]] - scoring_functions: Required[Dict[str, Optional[ScoringFunctions]]] + scoring_functions: Required[Dict[str, Optional[ScoringFnParamsParam]]] x_llama_stack_client_version: Annotated[str, PropertyInfo(alias="X-LlamaStack-Client-Version")] x_llama_stack_provider_data: Annotated[str, PropertyInfo(alias="X-LlamaStack-Provider-Data")] - - -class ScoringFunctionsLlmAsJudge(TypedDict, total=False): - judge_model: Required[str] - - type: Required[Literal["llm_as_judge"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - judge_score_regexes: List[str] - - prompt_template: str - - -class ScoringFunctionsRegexParser(TypedDict, total=False): - type: Required[Literal["regex_parser"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - parsing_regexes: List[str] - - -class ScoringFunctionsBasic(TypedDict, total=False): - type: Required[Literal["basic"]] - - aggregation_functions: List[Literal["average", "median", "categorical_count", "accuracy"]] - - -ScoringFunctions: TypeAlias = Union[ScoringFunctionsLlmAsJudge, ScoringFunctionsRegexParser, ScoringFunctionsBasic] diff --git a/src/llama_stack_client/types/shared/content_delta.py b/src/llama_stack_client/types/shared/content_delta.py index 6af2cb70..18207c75 100644 --- a/src/llama_stack_client/types/shared/content_delta.py +++ b/src/llama_stack_client/types/shared/content_delta.py @@ -3,34 +3,34 @@ from typing import Union from typing_extensions import Literal, Annotated, TypeAlias -from . import tool_call from ..._utils import PropertyInfo from ..._models import BaseModel +from .tool_call import ToolCall -__all__ = ["ContentDelta", "Text", "Image", "ToolCall", "ToolCallToolCall"] +__all__ = ["ContentDelta", "TextDelta", "ImageDelta", "ToolCallDelta", "ToolCallDeltaToolCall"] -class Text(BaseModel): +class TextDelta(BaseModel): text: str type: Literal["text"] -class Image(BaseModel): +class ImageDelta(BaseModel): image: str type: Literal["image"] -ToolCallToolCall: TypeAlias = Union[str, tool_call.ToolCall] +ToolCallDeltaToolCall: TypeAlias = Union[str, ToolCall] -class ToolCall(BaseModel): +class ToolCallDelta(BaseModel): parse_status: Literal["started", "in_progress", "failed", "succeeded"] - tool_call: ToolCallToolCall + tool_call: ToolCallDeltaToolCall type: Literal["tool_call"] -ContentDelta: TypeAlias = Annotated[Union[Text, Image, ToolCall], PropertyInfo(discriminator="type")] +ContentDelta: TypeAlias = Annotated[Union[TextDelta, ImageDelta, ToolCallDelta], PropertyInfo(discriminator="type")] diff --git a/src/llama_stack_client/types/shared/interleaved_content_item.py b/src/llama_stack_client/types/shared/interleaved_content_item.py index 087b0863..30a14ee3 100644 --- a/src/llama_stack_client/types/shared/interleaved_content_item.py +++ b/src/llama_stack_client/types/shared/interleaved_content_item.py @@ -7,25 +7,27 @@ from ..._utils import PropertyInfo from ..._models import BaseModel -__all__ = ["InterleavedContentItem", "Image", "ImageImage", "Text"] +__all__ = ["InterleavedContentItem", "ImageContentItem", "ImageContentItemImage", "TextContentItem"] -class ImageImage(BaseModel): +class ImageContentItemImage(BaseModel): data: Optional[str] = None url: Optional[URL] = None -class Image(BaseModel): - image: ImageImage +class ImageContentItem(BaseModel): + image: ImageContentItemImage type: Literal["image"] -class Text(BaseModel): +class TextContentItem(BaseModel): text: str type: Literal["text"] -InterleavedContentItem: TypeAlias = Annotated[Union[Image, Text], PropertyInfo(discriminator="type")] +InterleavedContentItem: TypeAlias = Annotated[ + Union[ImageContentItem, TextContentItem], PropertyInfo(discriminator="type") +] diff --git a/src/llama_stack_client/types/shared/param_type.py b/src/llama_stack_client/types/shared/param_type.py index aed161e3..2fed6df2 100644 --- a/src/llama_stack_client/types/shared/param_type.py +++ b/src/llama_stack_client/types/shared/param_type.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import typing +from typing import Union from typing_extensions import Literal, Annotated, TypeAlias from ..._utils import PropertyInfo @@ -8,62 +8,71 @@ __all__ = [ "ParamType", - "String", - "Number", - "Boolean", - "Array", - "Object", - "Json", - "Union", - "ChatCompletionInput", - "CompletionInput", - "AgentTurnInput", + "StringType", + "NumberType", + "BooleanType", + "ArrayType", + "ObjectType", + "JsonType", + "UnionType", + "ChatCompletionInputType", + "CompletionInputType", + "AgentTurnInputType", ] -class String(BaseModel): +class StringType(BaseModel): type: Literal["string"] -class Number(BaseModel): +class NumberType(BaseModel): type: Literal["number"] -class Boolean(BaseModel): +class BooleanType(BaseModel): type: Literal["boolean"] -class Array(BaseModel): +class ArrayType(BaseModel): type: Literal["array"] -class Object(BaseModel): +class ObjectType(BaseModel): type: Literal["object"] -class Json(BaseModel): +class JsonType(BaseModel): type: Literal["json"] -class Union(BaseModel): +class UnionType(BaseModel): type: Literal["union"] -class ChatCompletionInput(BaseModel): +class ChatCompletionInputType(BaseModel): type: Literal["chat_completion_input"] -class CompletionInput(BaseModel): +class CompletionInputType(BaseModel): type: Literal["completion_input"] -class AgentTurnInput(BaseModel): +class AgentTurnInputType(BaseModel): type: Literal["agent_turn_input"] ParamType: TypeAlias = Annotated[ - typing.Union[ - String, Number, Boolean, Array, Object, Json, Union, ChatCompletionInput, CompletionInput, AgentTurnInput + Union[ + StringType, + NumberType, + BooleanType, + ArrayType, + ObjectType, + JsonType, + UnionType, + ChatCompletionInputType, + CompletionInputType, + AgentTurnInputType, ], PropertyInfo(discriminator="type"), ] diff --git a/src/llama_stack_client/types/shared/query_config.py b/src/llama_stack_client/types/shared/query_config.py index cc13cf2f..7efc6f0b 100644 --- a/src/llama_stack_client/types/shared/query_config.py +++ b/src/llama_stack_client/types/shared/query_config.py @@ -6,16 +6,21 @@ from ..._utils import PropertyInfo from ..._models import BaseModel -__all__ = ["QueryConfig", "QueryGeneratorConfig", "QueryGeneratorConfigDefault", "QueryGeneratorConfigLlm"] +__all__ = [ + "QueryConfig", + "QueryGeneratorConfig", + "QueryGeneratorConfigDefaultRagQueryGeneratorConfig", + "QueryGeneratorConfigLlmragQueryGeneratorConfig", +] -class QueryGeneratorConfigDefault(BaseModel): +class QueryGeneratorConfigDefaultRagQueryGeneratorConfig(BaseModel): separator: str type: Literal["default"] -class QueryGeneratorConfigLlm(BaseModel): +class QueryGeneratorConfigLlmragQueryGeneratorConfig(BaseModel): model: str template: str @@ -24,7 +29,8 @@ class QueryGeneratorConfigLlm(BaseModel): QueryGeneratorConfig: TypeAlias = Annotated[ - Union[QueryGeneratorConfigDefault, QueryGeneratorConfigLlm], PropertyInfo(discriminator="type") + Union[QueryGeneratorConfigDefaultRagQueryGeneratorConfig, QueryGeneratorConfigLlmragQueryGeneratorConfig], + PropertyInfo(discriminator="type"), ] diff --git a/src/llama_stack_client/types/shared/sampling_params.py b/src/llama_stack_client/types/shared/sampling_params.py index a54899da..bb5866a6 100644 --- a/src/llama_stack_client/types/shared/sampling_params.py +++ b/src/llama_stack_client/types/shared/sampling_params.py @@ -6,14 +6,20 @@ from ..._utils import PropertyInfo from ..._models import BaseModel -__all__ = ["SamplingParams", "Strategy", "StrategyGreedy", "StrategyTopP", "StrategyTopK"] +__all__ = [ + "SamplingParams", + "Strategy", + "StrategyGreedySamplingStrategy", + "StrategyTopPSamplingStrategy", + "StrategyTopKSamplingStrategy", +] -class StrategyGreedy(BaseModel): +class StrategyGreedySamplingStrategy(BaseModel): type: Literal["greedy"] -class StrategyTopP(BaseModel): +class StrategyTopPSamplingStrategy(BaseModel): type: Literal["top_p"] temperature: Optional[float] = None @@ -21,13 +27,16 @@ class StrategyTopP(BaseModel): top_p: Optional[float] = None -class StrategyTopK(BaseModel): +class StrategyTopKSamplingStrategy(BaseModel): top_k: int type: Literal["top_k"] -Strategy: TypeAlias = Annotated[Union[StrategyGreedy, StrategyTopP, StrategyTopK], PropertyInfo(discriminator="type")] +Strategy: TypeAlias = Annotated[ + Union[StrategyGreedySamplingStrategy, StrategyTopPSamplingStrategy, StrategyTopKSamplingStrategy], + PropertyInfo(discriminator="type"), +] class SamplingParams(BaseModel): diff --git a/src/llama_stack_client/types/shared_params/interleaved_content_item.py b/src/llama_stack_client/types/shared_params/interleaved_content_item.py index f4fd3798..8a5da06f 100644 --- a/src/llama_stack_client/types/shared_params/interleaved_content_item.py +++ b/src/llama_stack_client/types/shared_params/interleaved_content_item.py @@ -7,25 +7,25 @@ from .url import URL -__all__ = ["InterleavedContentItem", "Image", "ImageImage", "Text"] +__all__ = ["InterleavedContentItem", "ImageContentItem", "ImageContentItemImage", "TextContentItem"] -class ImageImage(TypedDict, total=False): +class ImageContentItemImage(TypedDict, total=False): data: str url: URL -class Image(TypedDict, total=False): - image: Required[ImageImage] +class ImageContentItem(TypedDict, total=False): + image: Required[ImageContentItemImage] type: Required[Literal["image"]] -class Text(TypedDict, total=False): +class TextContentItem(TypedDict, total=False): text: Required[str] type: Required[Literal["text"]] -InterleavedContentItem: TypeAlias = Union[Image, Text] +InterleavedContentItem: TypeAlias = Union[ImageContentItem, TextContentItem] diff --git a/src/llama_stack_client/types/shared_params/param_type.py b/src/llama_stack_client/types/shared_params/param_type.py index 05d99b4e..b93dfeff 100644 --- a/src/llama_stack_client/types/shared_params/param_type.py +++ b/src/llama_stack_client/types/shared_params/param_type.py @@ -2,64 +2,73 @@ from __future__ import annotations -import typing +from typing import Union from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ "ParamType", - "String", - "Number", - "Boolean", - "Array", - "Object", - "Json", - "Union", - "ChatCompletionInput", - "CompletionInput", - "AgentTurnInput", + "StringType", + "NumberType", + "BooleanType", + "ArrayType", + "ObjectType", + "JsonType", + "UnionType", + "ChatCompletionInputType", + "CompletionInputType", + "AgentTurnInputType", ] -class String(TypedDict, total=False): +class StringType(TypedDict, total=False): type: Required[Literal["string"]] -class Number(TypedDict, total=False): +class NumberType(TypedDict, total=False): type: Required[Literal["number"]] -class Boolean(TypedDict, total=False): +class BooleanType(TypedDict, total=False): type: Required[Literal["boolean"]] -class Array(TypedDict, total=False): +class ArrayType(TypedDict, total=False): type: Required[Literal["array"]] -class Object(TypedDict, total=False): +class ObjectType(TypedDict, total=False): type: Required[Literal["object"]] -class Json(TypedDict, total=False): +class JsonType(TypedDict, total=False): type: Required[Literal["json"]] -class Union(TypedDict, total=False): +class UnionType(TypedDict, total=False): type: Required[Literal["union"]] -class ChatCompletionInput(TypedDict, total=False): +class ChatCompletionInputType(TypedDict, total=False): type: Required[Literal["chat_completion_input"]] -class CompletionInput(TypedDict, total=False): +class CompletionInputType(TypedDict, total=False): type: Required[Literal["completion_input"]] -class AgentTurnInput(TypedDict, total=False): +class AgentTurnInputType(TypedDict, total=False): type: Required[Literal["agent_turn_input"]] -ParamType: TypeAlias = typing.Union[ - String, Number, Boolean, Array, Object, Json, Union, ChatCompletionInput, CompletionInput, AgentTurnInput +ParamType: TypeAlias = Union[ + StringType, + NumberType, + BooleanType, + ArrayType, + ObjectType, + JsonType, + UnionType, + ChatCompletionInputType, + CompletionInputType, + AgentTurnInputType, ] diff --git a/src/llama_stack_client/types/shared_params/query_config.py b/src/llama_stack_client/types/shared_params/query_config.py index 683e1aee..25f05d8c 100644 --- a/src/llama_stack_client/types/shared_params/query_config.py +++ b/src/llama_stack_client/types/shared_params/query_config.py @@ -5,16 +5,21 @@ from typing import Union from typing_extensions import Literal, Required, TypeAlias, TypedDict -__all__ = ["QueryConfig", "QueryGeneratorConfig", "QueryGeneratorConfigDefault", "QueryGeneratorConfigLlm"] +__all__ = [ + "QueryConfig", + "QueryGeneratorConfig", + "QueryGeneratorConfigDefaultRagQueryGeneratorConfig", + "QueryGeneratorConfigLlmragQueryGeneratorConfig", +] -class QueryGeneratorConfigDefault(TypedDict, total=False): +class QueryGeneratorConfigDefaultRagQueryGeneratorConfig(TypedDict, total=False): separator: Required[str] type: Required[Literal["default"]] -class QueryGeneratorConfigLlm(TypedDict, total=False): +class QueryGeneratorConfigLlmragQueryGeneratorConfig(TypedDict, total=False): model: Required[str] template: Required[str] @@ -22,7 +27,9 @@ class QueryGeneratorConfigLlm(TypedDict, total=False): type: Required[Literal["llm"]] -QueryGeneratorConfig: TypeAlias = Union[QueryGeneratorConfigDefault, QueryGeneratorConfigLlm] +QueryGeneratorConfig: TypeAlias = Union[ + QueryGeneratorConfigDefaultRagQueryGeneratorConfig, QueryGeneratorConfigLlmragQueryGeneratorConfig +] class QueryConfig(TypedDict, total=False): diff --git a/src/llama_stack_client/types/shared_params/sampling_params.py b/src/llama_stack_client/types/shared_params/sampling_params.py index daa252f9..1d9bcaf5 100644 --- a/src/llama_stack_client/types/shared_params/sampling_params.py +++ b/src/llama_stack_client/types/shared_params/sampling_params.py @@ -5,14 +5,20 @@ from typing import Union from typing_extensions import Literal, Required, TypeAlias, TypedDict -__all__ = ["SamplingParams", "Strategy", "StrategyGreedy", "StrategyTopP", "StrategyTopK"] +__all__ = [ + "SamplingParams", + "Strategy", + "StrategyGreedySamplingStrategy", + "StrategyTopPSamplingStrategy", + "StrategyTopKSamplingStrategy", +] -class StrategyGreedy(TypedDict, total=False): +class StrategyGreedySamplingStrategy(TypedDict, total=False): type: Required[Literal["greedy"]] -class StrategyTopP(TypedDict, total=False): +class StrategyTopPSamplingStrategy(TypedDict, total=False): type: Required[Literal["top_p"]] temperature: float @@ -20,13 +26,13 @@ class StrategyTopP(TypedDict, total=False): top_p: float -class StrategyTopK(TypedDict, total=False): +class StrategyTopKSamplingStrategy(TypedDict, total=False): top_k: Required[int] type: Required[Literal["top_k"]] -Strategy: TypeAlias = Union[StrategyGreedy, StrategyTopP, StrategyTopK] +Strategy: TypeAlias = Union[StrategyGreedySamplingStrategy, StrategyTopPSamplingStrategy, StrategyTopKSamplingStrategy] class SamplingParams(TypedDict, total=False): diff --git a/src/llama_stack_client/types/telemetry_log_event_params.py b/src/llama_stack_client/types/telemetry_log_event_params.py index a6686388..44b72322 100644 --- a/src/llama_stack_client/types/telemetry_log_event_params.py +++ b/src/llama_stack_client/types/telemetry_log_event_params.py @@ -2,97 +2,19 @@ from __future__ import annotations -from typing import Dict, Union, Iterable -from datetime import datetime -from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo +from .event_param import EventParam -__all__ = [ - "TelemetryLogEventParams", - "Event", - "EventUnstructuredLog", - "EventMetric", - "EventStructuredLog", - "EventStructuredLogPayload", - "EventStructuredLogPayloadSpanStart", - "EventStructuredLogPayloadSpanEnd", -] +__all__ = ["TelemetryLogEventParams"] class TelemetryLogEventParams(TypedDict, total=False): - event: Required[Event] + event: Required[EventParam] ttl_seconds: Required[int] x_llama_stack_client_version: Annotated[str, PropertyInfo(alias="X-LlamaStack-Client-Version")] x_llama_stack_provider_data: Annotated[str, PropertyInfo(alias="X-LlamaStack-Provider-Data")] - - -class EventUnstructuredLog(TypedDict, total=False): - message: Required[str] - - severity: Required[Literal["verbose", "debug", "info", "warn", "error", "critical"]] - - span_id: Required[str] - - timestamp: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - - trace_id: Required[str] - - type: Required[Literal["unstructured_log"]] - - attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - - -class EventMetric(TypedDict, total=False): - metric: Required[str] - - span_id: Required[str] - - timestamp: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - - trace_id: Required[str] - - type: Required[Literal["metric"]] - - unit: Required[str] - - value: Required[float] - - attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - - -class EventStructuredLogPayloadSpanStart(TypedDict, total=False): - name: Required[str] - - type: Required[Literal["span_start"]] - - parent_span_id: str - - -class EventStructuredLogPayloadSpanEnd(TypedDict, total=False): - status: Required[Literal["ok", "error"]] - - type: Required[Literal["span_end"]] - - -EventStructuredLogPayload: TypeAlias = Union[EventStructuredLogPayloadSpanStart, EventStructuredLogPayloadSpanEnd] - - -class EventStructuredLog(TypedDict, total=False): - payload: Required[EventStructuredLogPayload] - - span_id: Required[str] - - timestamp: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - - trace_id: Required[str] - - type: Required[Literal["structured_log"]] - - attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - - -Event: TypeAlias = Union[EventUnstructuredLog, EventMetric, EventStructuredLog] diff --git a/src/llama_stack_client/types/telemetry_query_spans_params.py b/src/llama_stack_client/types/telemetry_query_spans_params.py index 8c13c84b..ec588473 100644 --- a/src/llama_stack_client/types/telemetry_query_spans_params.py +++ b/src/llama_stack_client/types/telemetry_query_spans_params.py @@ -2,16 +2,17 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import List, Iterable +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo +from .query_condition_param import QueryConditionParam -__all__ = ["TelemetryQuerySpansParams", "AttributeFilter"] +__all__ = ["TelemetryQuerySpansParams"] class TelemetryQuerySpansParams(TypedDict, total=False): - attribute_filters: Required[Iterable[AttributeFilter]] + attribute_filters: Required[Iterable[QueryConditionParam]] attributes_to_return: Required[List[str]] @@ -20,11 +21,3 @@ class TelemetryQuerySpansParams(TypedDict, total=False): x_llama_stack_client_version: Annotated[str, PropertyInfo(alias="X-LlamaStack-Client-Version")] x_llama_stack_provider_data: Annotated[str, PropertyInfo(alias="X-LlamaStack-Provider-Data")] - - -class AttributeFilter(TypedDict, total=False): - key: Required[str] - - op: Required[Literal["eq", "ne", "gt", "lt"]] - - value: Required[Union[bool, float, str, Iterable[object], object, None]] diff --git a/src/llama_stack_client/types/telemetry_query_traces_params.py b/src/llama_stack_client/types/telemetry_query_traces_params.py index 708a9dd2..f54252d7 100644 --- a/src/llama_stack_client/types/telemetry_query_traces_params.py +++ b/src/llama_stack_client/types/telemetry_query_traces_params.py @@ -2,16 +2,17 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import List, Iterable +from typing_extensions import Annotated, TypedDict from .._utils import PropertyInfo +from .query_condition_param import QueryConditionParam -__all__ = ["TelemetryQueryTracesParams", "AttributeFilter"] +__all__ = ["TelemetryQueryTracesParams"] class TelemetryQueryTracesParams(TypedDict, total=False): - attribute_filters: Iterable[AttributeFilter] + attribute_filters: Iterable[QueryConditionParam] limit: int @@ -22,11 +23,3 @@ class TelemetryQueryTracesParams(TypedDict, total=False): x_llama_stack_client_version: Annotated[str, PropertyInfo(alias="X-LlamaStack-Client-Version")] x_llama_stack_provider_data: Annotated[str, PropertyInfo(alias="X-LlamaStack-Provider-Data")] - - -class AttributeFilter(TypedDict, total=False): - key: Required[str] - - op: Required[Literal["eq", "ne", "gt", "lt"]] - - value: Required[Union[bool, float, str, Iterable[object], object, None]] diff --git a/src/llama_stack_client/types/telemetry_save_spans_to_dataset_params.py b/src/llama_stack_client/types/telemetry_save_spans_to_dataset_params.py index 7793b793..5c13f671 100644 --- a/src/llama_stack_client/types/telemetry_save_spans_to_dataset_params.py +++ b/src/llama_stack_client/types/telemetry_save_spans_to_dataset_params.py @@ -2,16 +2,17 @@ from __future__ import annotations -from typing import List, Union, Iterable -from typing_extensions import Literal, Required, Annotated, TypedDict +from typing import List, Iterable +from typing_extensions import Required, Annotated, TypedDict from .._utils import PropertyInfo +from .query_condition_param import QueryConditionParam -__all__ = ["TelemetrySaveSpansToDatasetParams", "AttributeFilter"] +__all__ = ["TelemetrySaveSpansToDatasetParams"] class TelemetrySaveSpansToDatasetParams(TypedDict, total=False): - attribute_filters: Required[Iterable[AttributeFilter]] + attribute_filters: Required[Iterable[QueryConditionParam]] attributes_to_save: Required[List[str]] @@ -22,11 +23,3 @@ class TelemetrySaveSpansToDatasetParams(TypedDict, total=False): x_llama_stack_client_version: Annotated[str, PropertyInfo(alias="X-LlamaStack-Client-Version")] x_llama_stack_provider_data: Annotated[str, PropertyInfo(alias="X-LlamaStack-Provider-Data")] - - -class AttributeFilter(TypedDict, total=False): - key: Required[str] - - op: Required[Literal["eq", "ne", "gt", "lt"]] - - value: Required[Union[bool, float, str, Iterable[object], object, None]] diff --git a/tests/api_resources/test_eval.py b/tests/api_resources/test_eval.py index 1e270798..d1913199 100644 --- a/tests/api_resources/test_eval.py +++ b/tests/api_resources/test_eval.py @@ -9,7 +9,10 @@ from tests.utils import assert_matches_type from llama_stack_client import LlamaStackClient, AsyncLlamaStackClient -from llama_stack_client.types import Job, EvaluateResponse +from llama_stack_client.types import ( + Job, + EvaluateResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") diff --git a/tests/api_resources/test_scoring_functions.py b/tests/api_resources/test_scoring_functions.py index d88af7f6..da89a3bb 100644 --- a/tests/api_resources/test_scoring_functions.py +++ b/tests/api_resources/test_scoring_functions.py @@ -9,7 +9,10 @@ from tests.utils import assert_matches_type from llama_stack_client import LlamaStackClient, AsyncLlamaStackClient -from llama_stack_client.types import ScoringFn, ScoringFunctionListResponse +from llama_stack_client.types import ( + ScoringFn, + ScoringFunctionListResponse, +) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")