diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 89ed046f..d12052d9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.4.0-alpha.8" + ".": "0.4.0-alpha.9" } diff --git a/.stats.yml b/.stats.yml index c4e4ef9b..253e4ba9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 96 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-602ce64aa309cc15fa09388d99c9f298795686fc37605237cbc03c39d29aabf6.yml -openapi_spec_hash: fc6995247b2555e8660bc9291eb10415 -config_hash: e8a35d9d37cb4774b4b0fe1b167dc156 +configured_endpoints: 103 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-2b99a80543f8bc8fa164167693c214651ac8e710f4726fb5869183b4d6c71a03.yml +openapi_spec_hash: a5632057f5e4d956a71c20a79c0d879c +config_hash: 0017f6c419cbbf7b949f9b2842917a79 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f7e8689..c8d2fac9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.4.0-alpha.9 (2025-11-14) + +Full Changelog: [v0.4.0-alpha.8...v0.4.0-alpha.9](https://github.com/llamastack/llama-stack-client-python/compare/v0.4.0-alpha.8...v0.4.0-alpha.9) + +### Chores + +* use Pydantic to generate OpenAPI schema ([59f7867](https://github.com/llamastack/llama-stack-client-python/commit/59f7867d3d96eaa7048aae70fcb0a0fe4670a9fa)) + ## 0.4.0-alpha.8 (2025-11-14) Full Changelog: [v0.4.0-alpha.7...v0.4.0-alpha.8](https://github.com/llamastack/llama-stack-client-python/compare/v0.4.0-alpha.7...v0.4.0-alpha.8) diff --git a/README.md b/README.md index 985b7a72..634a892b 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,7 @@ from llama_stack_client import LlamaStackClient client = LlamaStackClient() -response = client.models.register( - model_id="model_id", -) -print(response.identifier) +models = client.models.list() ``` While you can provide an `api_key` keyword argument, we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/) to add `LLAMA_STACK_CLIENT_API_KEY="My API Key"` to your `.env` file so that your API Key is not stored in source control. @@ -93,10 +90,7 @@ client = AsyncLlamaStackClient( async def main() -> None: - response = await client.models.register( - model_id="model_id", - ) - print(response.identifier) + models = await client.models.list() asyncio.run(main()) @@ -127,10 +121,7 @@ async def main() -> None: async with AsyncLlamaStackClient( http_client=DefaultAioHttpClient(), ) as client: - response = await client.models.register( - model_id="model_id", - ) - print(response.identifier) + models = await client.models.list() asyncio.run(main()) @@ -156,7 +147,7 @@ stream = client.chat.completions.create( stream=True, ) for completion in stream: - print(completion) + print(completion.id) ``` The async client uses the exact same interface. @@ -177,7 +168,7 @@ stream = await client.chat.completions.create( stream=True, ) async for completion in stream: - print(completion) + print(completion.id) ``` ## Using types @@ -378,7 +369,7 @@ response = client.chat.completions.with_raw_response.create( print(response.headers.get('X-My-Header')) completion = response.parse() # get the object that `chat.completions.create()` would have returned -print(completion) +print(completion.id) ``` These methods return an [`APIResponse`](https://github.com/meta-llama/llama-stack-python/tree/main/src/llama_stack_client/_response.py) object. diff --git a/api.md b/api.md index 7f8501e6..c613cdb8 100644 --- a/api.md +++ b/api.md @@ -50,8 +50,8 @@ from llama_stack_client.types import ToolDef, ToolInvocationResult, ToolRuntimeL Methods: -- client.tool_runtime.invoke_tool(\*\*params) -> ToolInvocationResult -- client.tool_runtime.list_tools(\*\*params) -> ToolRuntimeListToolsResponse +- client.tool_runtime.invoke_tool(\*\*params) -> ToolInvocationResult +- client.tool_runtime.list_tools(\*\*params) -> ToolRuntimeListToolsResponse # Responses @@ -131,6 +131,7 @@ Types: from llama_stack_client.types.conversations import ( ItemCreateResponse, ItemListResponse, + ItemDeleteResponse, ItemGetResponse, ) ``` @@ -139,6 +140,7 @@ Methods: - client.conversations.items.create(conversation_id, \*\*params) -> ItemCreateResponse - client.conversations.items.list(conversation_id, \*\*params) -> SyncOpenAICursorPage[ItemListResponse] +- client.conversations.items.delete(item_id, \*, conversation_id) -> ItemDeleteResponse - client.conversations.items.get(item_id, \*, conversation_id) -> ItemGetResponse # Inspect @@ -190,7 +192,7 @@ Methods: - client.chat.completions.create(\*\*params) -> CompletionCreateResponse - client.chat.completions.retrieve(completion_id) -> CompletionRetrieveResponse -- client.chat.completions.list(\*\*params) -> SyncOpenAICursorPage[CompletionListResponse] +- client.chat.completions.list(\*\*params) -> CompletionListResponse # Completions @@ -400,6 +402,7 @@ Methods: - client.scoring_functions.retrieve(scoring_fn_id) -> ScoringFn - client.scoring_functions.list() -> ScoringFunctionListResponse - client.scoring_functions.register(\*\*params) -> None +- client.scoring_functions.unregister(scoring_fn_id) -> None # Files @@ -417,6 +420,26 @@ Methods: - client.files.delete(file_id) -> DeleteFileResponse - client.files.content(file_id) -> object +# Batches + +Types: + +```python +from llama_stack_client.types import ( + BatchCreateResponse, + BatchRetrieveResponse, + BatchListResponse, + BatchCancelResponse, +) +``` + +Methods: + +- client.batches.create(\*\*params) -> BatchCreateResponse +- client.batches.retrieve(batch_id) -> BatchRetrieveResponse +- client.batches.list(\*\*params) -> SyncOpenAICursorPage[BatchListResponse] +- client.batches.cancel(batch_id) -> BatchCancelResponse + # Alpha ## Inference @@ -480,6 +503,7 @@ Methods: - client.alpha.benchmarks.retrieve(benchmark_id) -> Benchmark - client.alpha.benchmarks.list() -> BenchmarkListResponse - client.alpha.benchmarks.register(\*\*params) -> None +- client.alpha.benchmarks.unregister(benchmark_id) -> None ## Eval diff --git a/pyproject.toml b/pyproject.toml index 2bdf6316..c4d1d77f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "llama_stack_client" -version = "0.4.0-alpha.8" +version = "0.4.0-alpha.9" description = "The official Python library for the llama-stack-client API" dynamic = ["readme"] license = "MIT" diff --git a/src/llama_stack_client/_client.py b/src/llama_stack_client/_client.py index d42e6fb0..6c68b282 100644 --- a/src/llama_stack_client/_client.py +++ b/src/llama_stack_client/_client.py @@ -47,6 +47,7 @@ models, routes, safety, + batches, inspect, prompts, scoring, @@ -67,6 +68,7 @@ from .resources.tools import ToolsResource, AsyncToolsResource from .resources.routes import RoutesResource, AsyncRoutesResource from .resources.safety import SafetyResource, AsyncSafetyResource + from .resources.batches import BatchesResource, AsyncBatchesResource from .resources.inspect import InspectResource, AsyncInspectResource from .resources.scoring import ScoringResource, AsyncScoringResource from .resources.shields import ShieldsResource, AsyncShieldsResource @@ -79,11 +81,11 @@ from .resources.alpha.alpha import AlphaResource, AsyncAlphaResource from .resources.completions import CompletionsResource, AsyncCompletionsResource from .resources.moderations import ModerationsResource, AsyncModerationsResource + from .resources.tool_runtime import ToolRuntimeResource, AsyncToolRuntimeResource from .resources.models.models import ModelsResource, AsyncModelsResource from .resources.prompts.prompts import PromptsResource, AsyncPromptsResource from .resources.scoring_functions import ScoringFunctionsResource, AsyncScoringFunctionsResource from .resources.responses.responses import ResponsesResource, AsyncResponsesResource - from .resources.tool_runtime.tool_runtime import ToolRuntimeResource, AsyncToolRuntimeResource from .resources.conversations.conversations import ConversationsResource, AsyncConversationsResource from .resources.vector_stores.vector_stores import VectorStoresResource, AsyncVectorStoresResource @@ -282,6 +284,12 @@ def files(self) -> FilesResource: return FilesResource(self) + @cached_property + def batches(self) -> BatchesResource: + from .resources.batches import BatchesResource + + return BatchesResource(self) + @cached_property def alpha(self) -> AlphaResource: from .resources.alpha import AlphaResource @@ -592,6 +600,12 @@ def files(self) -> AsyncFilesResource: return AsyncFilesResource(self) + @cached_property + def batches(self) -> AsyncBatchesResource: + from .resources.batches import AsyncBatchesResource + + return AsyncBatchesResource(self) + @cached_property def alpha(self) -> AsyncAlphaResource: from .resources.alpha import AsyncAlphaResource @@ -851,6 +865,12 @@ def files(self) -> files.FilesResourceWithRawResponse: return FilesResourceWithRawResponse(self._client.files) + @cached_property + def batches(self) -> batches.BatchesResourceWithRawResponse: + from .resources.batches import BatchesResourceWithRawResponse + + return BatchesResourceWithRawResponse(self._client.batches) + @cached_property def alpha(self) -> alpha.AlphaResourceWithRawResponse: from .resources.alpha import AlphaResourceWithRawResponse @@ -996,6 +1016,12 @@ def files(self) -> files.AsyncFilesResourceWithRawResponse: return AsyncFilesResourceWithRawResponse(self._client.files) + @cached_property + def batches(self) -> batches.AsyncBatchesResourceWithRawResponse: + from .resources.batches import AsyncBatchesResourceWithRawResponse + + return AsyncBatchesResourceWithRawResponse(self._client.batches) + @cached_property def alpha(self) -> alpha.AsyncAlphaResourceWithRawResponse: from .resources.alpha import AsyncAlphaResourceWithRawResponse @@ -1141,6 +1167,12 @@ def files(self) -> files.FilesResourceWithStreamingResponse: return FilesResourceWithStreamingResponse(self._client.files) + @cached_property + def batches(self) -> batches.BatchesResourceWithStreamingResponse: + from .resources.batches import BatchesResourceWithStreamingResponse + + return BatchesResourceWithStreamingResponse(self._client.batches) + @cached_property def alpha(self) -> alpha.AlphaResourceWithStreamingResponse: from .resources.alpha import AlphaResourceWithStreamingResponse @@ -1286,6 +1318,12 @@ def files(self) -> files.AsyncFilesResourceWithStreamingResponse: return AsyncFilesResourceWithStreamingResponse(self._client.files) + @cached_property + def batches(self) -> batches.AsyncBatchesResourceWithStreamingResponse: + from .resources.batches import AsyncBatchesResourceWithStreamingResponse + + return AsyncBatchesResourceWithStreamingResponse(self._client.batches) + @cached_property def alpha(self) -> alpha.AsyncAlphaResourceWithStreamingResponse: from .resources.alpha import AsyncAlphaResourceWithStreamingResponse diff --git a/src/llama_stack_client/resources/__init__.py b/src/llama_stack_client/resources/__init__.py index 0255b3e3..d0ec7ad7 100644 --- a/src/llama_stack_client/resources/__init__.py +++ b/src/llama_stack_client/resources/__init__.py @@ -70,6 +70,14 @@ SafetyResourceWithStreamingResponse, AsyncSafetyResourceWithStreamingResponse, ) +from .batches import ( + BatchesResource, + AsyncBatchesResource, + BatchesResourceWithRawResponse, + AsyncBatchesResourceWithRawResponse, + BatchesResourceWithStreamingResponse, + AsyncBatchesResourceWithStreamingResponse, +) from .inspect import ( InspectResource, AsyncInspectResource, @@ -318,6 +326,12 @@ "AsyncFilesResourceWithRawResponse", "FilesResourceWithStreamingResponse", "AsyncFilesResourceWithStreamingResponse", + "BatchesResource", + "AsyncBatchesResource", + "BatchesResourceWithRawResponse", + "AsyncBatchesResourceWithRawResponse", + "BatchesResourceWithStreamingResponse", + "AsyncBatchesResourceWithStreamingResponse", "AlphaResource", "AsyncAlphaResource", "AlphaResourceWithRawResponse", diff --git a/src/llama_stack_client/resources/alpha/benchmarks.py b/src/llama_stack_client/resources/alpha/benchmarks.py index ee613ed6..b737258a 100644 --- a/src/llama_stack_client/resources/alpha/benchmarks.py +++ b/src/llama_stack_client/resources/alpha/benchmarks.py @@ -9,7 +9,7 @@ from __future__ import annotations import typing_extensions -from typing import Dict, Type, Union, Iterable, cast +from typing import Dict, Type, Optional, cast import httpx @@ -115,9 +115,9 @@ def register( benchmark_id: str, dataset_id: str, scoring_functions: SequenceNotStr[str], - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - provider_benchmark_id: str | Omit = omit, - provider_id: str | Omit = omit, + metadata: Optional[Dict[str, object]] | Omit = omit, + provider_benchmark_id: Optional[str] | Omit = omit, + provider_id: Optional[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, @@ -129,18 +129,6 @@ def register( Register a benchmark. Args: - benchmark_id: The ID of the benchmark to register. - - dataset_id: The ID of the dataset to use for the benchmark. - - scoring_functions: The scoring functions to use for the benchmark. - - metadata: The metadata to use for the benchmark. - - provider_benchmark_id: The ID of the provider benchmark to use for the benchmark. - - provider_id: The ID of the provider to use for the benchmark. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -169,6 +157,41 @@ def register( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") + def unregister( + self, + benchmark_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: + """ + Unregister a benchmark. + + 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 benchmark_id: + raise ValueError(f"Expected a non-empty value for `benchmark_id` but received {benchmark_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/v1alpha/eval/benchmarks/{benchmark_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + class AsyncBenchmarksResource(AsyncAPIResource): @cached_property @@ -253,9 +276,9 @@ async def register( benchmark_id: str, dataset_id: str, scoring_functions: SequenceNotStr[str], - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - provider_benchmark_id: str | Omit = omit, - provider_id: str | Omit = omit, + metadata: Optional[Dict[str, object]] | Omit = omit, + provider_benchmark_id: Optional[str] | Omit = omit, + provider_id: Optional[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, @@ -267,18 +290,6 @@ async def register( Register a benchmark. Args: - benchmark_id: The ID of the benchmark to register. - - dataset_id: The ID of the dataset to use for the benchmark. - - scoring_functions: The scoring functions to use for the benchmark. - - metadata: The metadata to use for the benchmark. - - provider_benchmark_id: The ID of the provider benchmark to use for the benchmark. - - provider_id: The ID of the provider to use for the benchmark. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -307,6 +318,41 @@ async def register( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") + async def unregister( + self, + benchmark_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: + """ + Unregister a benchmark. + + 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 benchmark_id: + raise ValueError(f"Expected a non-empty value for `benchmark_id` but received {benchmark_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/v1alpha/eval/benchmarks/{benchmark_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + class BenchmarksResourceWithRawResponse: def __init__(self, benchmarks: BenchmarksResource) -> None: @@ -323,6 +369,11 @@ def __init__(self, benchmarks: BenchmarksResource) -> None: benchmarks.register, # pyright: ignore[reportDeprecated], ) ) + self.unregister = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + benchmarks.unregister, # pyright: ignore[reportDeprecated], + ) + ) class AsyncBenchmarksResourceWithRawResponse: @@ -340,6 +391,11 @@ def __init__(self, benchmarks: AsyncBenchmarksResource) -> None: benchmarks.register, # pyright: ignore[reportDeprecated], ) ) + self.unregister = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + benchmarks.unregister, # pyright: ignore[reportDeprecated], + ) + ) class BenchmarksResourceWithStreamingResponse: @@ -357,6 +413,11 @@ def __init__(self, benchmarks: BenchmarksResource) -> None: benchmarks.register, # pyright: ignore[reportDeprecated], ) ) + self.unregister = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + benchmarks.unregister, # pyright: ignore[reportDeprecated], + ) + ) class AsyncBenchmarksResourceWithStreamingResponse: @@ -374,3 +435,8 @@ def __init__(self, benchmarks: AsyncBenchmarksResource) -> None: benchmarks.register, # pyright: ignore[reportDeprecated], ) ) + self.unregister = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + benchmarks.unregister, # pyright: ignore[reportDeprecated], + ) + ) diff --git a/src/llama_stack_client/resources/alpha/eval/eval.py b/src/llama_stack_client/resources/alpha/eval/eval.py index 89101510..c6532721 100644 --- a/src/llama_stack_client/resources/alpha/eval/eval.py +++ b/src/llama_stack_client/resources/alpha/eval/eval.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Iterable, Optional import httpx @@ -20,7 +20,7 @@ JobsResourceWithStreamingResponse, AsyncJobsResourceWithStreamingResponse, ) -from ...._types import Body, Query, Headers, NotGiven, SequenceNotStr, not_given +from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given from ...._utils import maybe_transform, async_maybe_transform from ...._compat import cached_property from ...._resource import SyncAPIResource, AsyncAPIResource @@ -73,7 +73,7 @@ def evaluate_rows( benchmark_id: str, *, benchmark_config: BenchmarkConfigParam, - input_rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], + input_rows: Iterable[Dict[str, object]], scoring_functions: SequenceNotStr[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. @@ -86,11 +86,7 @@ def evaluate_rows( Evaluate a list of rows on a benchmark. Args: - benchmark_config: The configuration for the benchmark. - - input_rows: The rows to evaluate. - - scoring_functions: The scoring functions to use for the evaluation. + benchmark_config: A benchmark configuration for evaluation. extra_headers: Send extra headers @@ -123,7 +119,7 @@ def evaluate_rows_alpha( benchmark_id: str, *, benchmark_config: BenchmarkConfigParam, - input_rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], + input_rows: Iterable[Dict[str, object]], scoring_functions: SequenceNotStr[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. @@ -136,11 +132,7 @@ def evaluate_rows_alpha( Evaluate a list of rows on a benchmark. Args: - benchmark_config: The configuration for the benchmark. - - input_rows: The rows to evaluate. - - scoring_functions: The scoring functions to use for the evaluation. + benchmark_config: A benchmark configuration for evaluation. extra_headers: Send extra headers @@ -172,7 +164,9 @@ def run_eval( self, benchmark_id: str, *, - benchmark_config: BenchmarkConfigParam, + eval_candidate: eval_run_eval_params.EvalCandidate, + num_examples: Optional[int] | Omit = omit, + scoring_params: Dict[str, eval_run_eval_params.ScoringParams] | 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, @@ -184,7 +178,13 @@ def run_eval( Run an evaluation on a benchmark. Args: - benchmark_config: The configuration for the benchmark. + eval_candidate: A model candidate for evaluation. + + num_examples: Number of examples to evaluate (useful for testing), if not provided, all + examples in the dataset will be evaluated + + scoring_params: Map between scoring function id and parameters for each scoring function you + want to run extra_headers: Send extra headers @@ -198,7 +198,14 @@ def run_eval( raise ValueError(f"Expected a non-empty value for `benchmark_id` but received {benchmark_id!r}") return self._post( f"/v1alpha/eval/benchmarks/{benchmark_id}/jobs", - body=maybe_transform({"benchmark_config": benchmark_config}, eval_run_eval_params.EvalRunEvalParams), + body=maybe_transform( + { + "eval_candidate": eval_candidate, + "num_examples": num_examples, + "scoring_params": scoring_params, + }, + eval_run_eval_params.EvalRunEvalParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -209,7 +216,9 @@ def run_eval_alpha( self, benchmark_id: str, *, - benchmark_config: BenchmarkConfigParam, + eval_candidate: eval_run_eval_alpha_params.EvalCandidate, + num_examples: Optional[int] | Omit = omit, + scoring_params: Dict[str, eval_run_eval_alpha_params.ScoringParams] | 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, @@ -221,7 +230,13 @@ def run_eval_alpha( Run an evaluation on a benchmark. Args: - benchmark_config: The configuration for the benchmark. + eval_candidate: A model candidate for evaluation. + + num_examples: Number of examples to evaluate (useful for testing), if not provided, all + examples in the dataset will be evaluated + + scoring_params: Map between scoring function id and parameters for each scoring function you + want to run extra_headers: Send extra headers @@ -236,7 +251,12 @@ def run_eval_alpha( return self._post( f"/v1alpha/eval/benchmarks/{benchmark_id}/jobs", body=maybe_transform( - {"benchmark_config": benchmark_config}, eval_run_eval_alpha_params.EvalRunEvalAlphaParams + { + "eval_candidate": eval_candidate, + "num_examples": num_examples, + "scoring_params": scoring_params, + }, + eval_run_eval_alpha_params.EvalRunEvalAlphaParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -274,7 +294,7 @@ async def evaluate_rows( benchmark_id: str, *, benchmark_config: BenchmarkConfigParam, - input_rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], + input_rows: Iterable[Dict[str, object]], scoring_functions: SequenceNotStr[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. @@ -287,11 +307,7 @@ async def evaluate_rows( Evaluate a list of rows on a benchmark. Args: - benchmark_config: The configuration for the benchmark. - - input_rows: The rows to evaluate. - - scoring_functions: The scoring functions to use for the evaluation. + benchmark_config: A benchmark configuration for evaluation. extra_headers: Send extra headers @@ -324,7 +340,7 @@ async def evaluate_rows_alpha( benchmark_id: str, *, benchmark_config: BenchmarkConfigParam, - input_rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], + input_rows: Iterable[Dict[str, object]], scoring_functions: SequenceNotStr[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. @@ -337,11 +353,7 @@ async def evaluate_rows_alpha( Evaluate a list of rows on a benchmark. Args: - benchmark_config: The configuration for the benchmark. - - input_rows: The rows to evaluate. - - scoring_functions: The scoring functions to use for the evaluation. + benchmark_config: A benchmark configuration for evaluation. extra_headers: Send extra headers @@ -373,7 +385,9 @@ async def run_eval( self, benchmark_id: str, *, - benchmark_config: BenchmarkConfigParam, + eval_candidate: eval_run_eval_params.EvalCandidate, + num_examples: Optional[int] | Omit = omit, + scoring_params: Dict[str, eval_run_eval_params.ScoringParams] | 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, @@ -385,7 +399,13 @@ async def run_eval( Run an evaluation on a benchmark. Args: - benchmark_config: The configuration for the benchmark. + eval_candidate: A model candidate for evaluation. + + num_examples: Number of examples to evaluate (useful for testing), if not provided, all + examples in the dataset will be evaluated + + scoring_params: Map between scoring function id and parameters for each scoring function you + want to run extra_headers: Send extra headers @@ -400,7 +420,12 @@ async def run_eval( return await self._post( f"/v1alpha/eval/benchmarks/{benchmark_id}/jobs", body=await async_maybe_transform( - {"benchmark_config": benchmark_config}, eval_run_eval_params.EvalRunEvalParams + { + "eval_candidate": eval_candidate, + "num_examples": num_examples, + "scoring_params": scoring_params, + }, + eval_run_eval_params.EvalRunEvalParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -412,7 +437,9 @@ async def run_eval_alpha( self, benchmark_id: str, *, - benchmark_config: BenchmarkConfigParam, + eval_candidate: eval_run_eval_alpha_params.EvalCandidate, + num_examples: Optional[int] | Omit = omit, + scoring_params: Dict[str, eval_run_eval_alpha_params.ScoringParams] | 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, @@ -424,7 +451,13 @@ async def run_eval_alpha( Run an evaluation on a benchmark. Args: - benchmark_config: The configuration for the benchmark. + eval_candidate: A model candidate for evaluation. + + num_examples: Number of examples to evaluate (useful for testing), if not provided, all + examples in the dataset will be evaluated + + scoring_params: Map between scoring function id and parameters for each scoring function you + want to run extra_headers: Send extra headers @@ -439,7 +472,12 @@ async def run_eval_alpha( return await self._post( f"/v1alpha/eval/benchmarks/{benchmark_id}/jobs", body=await async_maybe_transform( - {"benchmark_config": benchmark_config}, eval_run_eval_alpha_params.EvalRunEvalAlphaParams + { + "eval_candidate": eval_candidate, + "num_examples": num_examples, + "scoring_params": scoring_params, + }, + eval_run_eval_alpha_params.EvalRunEvalAlphaParams, ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout diff --git a/src/llama_stack_client/resources/alpha/inference.py b/src/llama_stack_client/resources/alpha/inference.py index 9db21d26..145e4f65 100644 --- a/src/llama_stack_client/resources/alpha/inference.py +++ b/src/llama_stack_client/resources/alpha/inference.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -56,7 +56,7 @@ def rerank( items: SequenceNotStr[inference_rerank_params.Item], model: str, query: inference_rerank_params.Query, - max_num_results: int | Omit = omit, + max_num_results: Optional[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, @@ -68,16 +68,7 @@ def rerank( Rerank a list of documents based on their relevance to a query. Args: - items: List of items to rerank. Each item can be a string, text content part, or image - content part. Each input must not exceed the model's max input token length. - - model: The identifier of the reranking model to use. - - query: The search query to rank items against. Can be a string, text content part, or - image content part. The input must not exceed the model's max input token - length. - - max_num_results: (Optional) Maximum number of results to return. Default: returns all. + query: Text content part for OpenAI-compatible chat completion messages. extra_headers: Send extra headers @@ -135,7 +126,7 @@ async def rerank( items: SequenceNotStr[inference_rerank_params.Item], model: str, query: inference_rerank_params.Query, - max_num_results: int | Omit = omit, + max_num_results: Optional[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, @@ -147,16 +138,7 @@ async def rerank( Rerank a list of documents based on their relevance to a query. Args: - items: List of items to rerank. Each item can be a string, text content part, or image - content part. Each input must not exceed the model's max input token length. - - model: The identifier of the reranking model to use. - - query: The search query to rank items against. Can be a string, text content part, or - image content part. The input must not exceed the model's max input token - length. - - max_num_results: (Optional) Maximum number of results to return. Default: returns all. + query: Text content part for OpenAI-compatible chat completion messages. extra_headers: Send extra headers diff --git a/src/llama_stack_client/resources/alpha/post_training/job.py b/src/llama_stack_client/resources/alpha/post_training/job.py index 8e09f335..22431b51 100644 --- a/src/llama_stack_client/resources/alpha/post_training/job.py +++ b/src/llama_stack_client/resources/alpha/post_training/job.py @@ -90,8 +90,6 @@ def artifacts( Get the artifacts of a training job. Args: - job_uuid: The UUID of the job to get the artifacts of. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -127,8 +125,6 @@ def cancel( Cancel a training job. Args: - job_uuid: The UUID of the job to cancel. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -162,8 +158,6 @@ def status( Get the status of a training job. Args: - job_uuid: The UUID of the job to get the status of. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -243,8 +237,6 @@ async def artifacts( Get the artifacts of a training job. Args: - job_uuid: The UUID of the job to get the artifacts of. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -280,8 +272,6 @@ async def cancel( Cancel a training job. Args: - job_uuid: The UUID of the job to cancel. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -315,8 +305,6 @@ async def status( Get the status of a training job. Args: - job_uuid: The UUID of the job to get the status of. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/llama_stack_client/resources/alpha/post_training/post_training.py b/src/llama_stack_client/resources/alpha/post_training/post_training.py index 9b1fe87a..09ca5cb1 100644 --- a/src/llama_stack_client/resources/alpha/post_training/post_training.py +++ b/src/llama_stack_client/resources/alpha/post_training/post_training.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Optional import httpx @@ -30,13 +30,9 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ....types.alpha import ( - post_training_preference_optimize_params, - post_training_supervised_fine_tune_params, -) +from ....types.alpha import post_training_preference_optimize_params, post_training_supervised_fine_tune_params from ...._base_client import make_request_options from ....types.alpha.post_training_job import PostTrainingJob -from ....types.alpha.algorithm_config_param import AlgorithmConfigParam __all__ = ["PostTrainingResource", "AsyncPostTrainingResource"] @@ -70,9 +66,9 @@ def preference_optimize( *, algorithm_config: post_training_preference_optimize_params.AlgorithmConfig, finetuned_model: str, - hyperparam_search_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + hyperparam_search_config: Dict[str, object], job_uuid: str, - logger_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + logger_config: Dict[str, object], training_config: post_training_preference_optimize_params.TrainingConfig, # 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. @@ -85,17 +81,9 @@ def preference_optimize( Run preference optimization of a model. Args: - algorithm_config: The algorithm configuration. - - finetuned_model: The model to fine-tune. - - hyperparam_search_config: The hyperparam search configuration. - - job_uuid: The UUID of the job to create. - - logger_config: The logger configuration. + algorithm_config: Configuration for Direct Preference Optimization (DPO) alignment. - training_config: The training configuration. + training_config: Comprehensive configuration for the training process. extra_headers: Send extra headers @@ -127,13 +115,13 @@ def preference_optimize( def supervised_fine_tune( self, *, - hyperparam_search_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + hyperparam_search_config: Dict[str, object], job_uuid: str, - logger_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + logger_config: Dict[str, object], training_config: post_training_supervised_fine_tune_params.TrainingConfig, - algorithm_config: AlgorithmConfigParam | Omit = omit, - checkpoint_dir: str | Omit = omit, - model: str | Omit = omit, + algorithm_config: Optional[post_training_supervised_fine_tune_params.AlgorithmConfig] | Omit = omit, + checkpoint_dir: Optional[str] | Omit = omit, + model: Optional[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, @@ -145,19 +133,11 @@ def supervised_fine_tune( Run supervised fine-tuning of a model. Args: - hyperparam_search_config: The hyperparam search configuration. - - job_uuid: The UUID of the job to create. - - logger_config: The logger configuration. - - training_config: The training configuration. - - algorithm_config: The algorithm configuration. + training_config: Comprehensive configuration for the training process. - checkpoint_dir: The directory to save checkpoint(s) to. + algorithm_config: Configuration for Low-Rank Adaptation (LoRA) fine-tuning. - model: The model to fine-tune. + model: Model descriptor for training if not in provider config` extra_headers: Send extra headers @@ -217,9 +197,9 @@ async def preference_optimize( *, algorithm_config: post_training_preference_optimize_params.AlgorithmConfig, finetuned_model: str, - hyperparam_search_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + hyperparam_search_config: Dict[str, object], job_uuid: str, - logger_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + logger_config: Dict[str, object], training_config: post_training_preference_optimize_params.TrainingConfig, # 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. @@ -232,17 +212,9 @@ async def preference_optimize( Run preference optimization of a model. Args: - algorithm_config: The algorithm configuration. + algorithm_config: Configuration for Direct Preference Optimization (DPO) alignment. - finetuned_model: The model to fine-tune. - - hyperparam_search_config: The hyperparam search configuration. - - job_uuid: The UUID of the job to create. - - logger_config: The logger configuration. - - training_config: The training configuration. + training_config: Comprehensive configuration for the training process. extra_headers: Send extra headers @@ -274,13 +246,13 @@ async def preference_optimize( async def supervised_fine_tune( self, *, - hyperparam_search_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + hyperparam_search_config: Dict[str, object], job_uuid: str, - logger_config: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + logger_config: Dict[str, object], training_config: post_training_supervised_fine_tune_params.TrainingConfig, - algorithm_config: AlgorithmConfigParam | Omit = omit, - checkpoint_dir: str | Omit = omit, - model: str | Omit = omit, + algorithm_config: Optional[post_training_supervised_fine_tune_params.AlgorithmConfig] | Omit = omit, + checkpoint_dir: Optional[str] | Omit = omit, + model: Optional[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, @@ -292,19 +264,11 @@ async def supervised_fine_tune( Run supervised fine-tuning of a model. Args: - hyperparam_search_config: The hyperparam search configuration. - - job_uuid: The UUID of the job to create. - - logger_config: The logger configuration. - - training_config: The training configuration. - - algorithm_config: The algorithm configuration. + training_config: Comprehensive configuration for the training process. - checkpoint_dir: The directory to save checkpoint(s) to. + algorithm_config: Configuration for Low-Rank Adaptation (LoRA) fine-tuning. - model: The model to fine-tune. + model: Model descriptor for training if not in provider config` extra_headers: Send extra headers diff --git a/src/llama_stack_client/resources/batches.py b/src/llama_stack_client/resources/batches.py new file mode 100644 index 00000000..94afa057 --- /dev/null +++ b/src/llama_stack_client/resources/batches.py @@ -0,0 +1,450 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal + +import httpx + +from ..types import batch_list_params, batch_create_params +from .._types import Body, Omit, Query, Headers, 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 ..pagination import SyncOpenAICursorPage, AsyncOpenAICursorPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.batch_list_response import BatchListResponse +from ..types.batch_cancel_response import BatchCancelResponse +from ..types.batch_create_response import BatchCreateResponse +from ..types.batch_retrieve_response import BatchRetrieveResponse + +__all__ = ["BatchesResource", "AsyncBatchesResource"] + + +class BatchesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BatchesResourceWithRawResponse: + """ + 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 BatchesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BatchesResourceWithStreamingResponse: + """ + 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 BatchesResourceWithStreamingResponse(self) + + def create( + self, + *, + completion_window: Literal["24h"], + endpoint: str, + input_file_id: str, + idempotency_key: Optional[str] | Omit = omit, + metadata: Optional[Dict[str, 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, + ) -> BatchCreateResponse: + """ + Create a new batch for processing multiple API requests. + + 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 + """ + return self._post( + "/v1/batches", + body=maybe_transform( + { + "completion_window": completion_window, + "endpoint": endpoint, + "input_file_id": input_file_id, + "idempotency_key": idempotency_key, + "metadata": metadata, + }, + batch_create_params.BatchCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BatchCreateResponse, + ) + + def retrieve( + self, + batch_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, + ) -> BatchRetrieveResponse: + """ + Retrieve information about a specific batch. + + 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 batch_id: + raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") + return self._get( + f"/v1/batches/{batch_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BatchRetrieveResponse, + ) + + def list( + self, + *, + after: Optional[str] | Omit = omit, + limit: 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, + ) -> SyncOpenAICursorPage[BatchListResponse]: + """ + List all batches for the current user. + + 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 + """ + return self._get_api_list( + "/v1/batches", + page=SyncOpenAICursorPage[BatchListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "after": after, + "limit": limit, + }, + batch_list_params.BatchListParams, + ), + ), + model=BatchListResponse, + ) + + def cancel( + self, + batch_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, + ) -> BatchCancelResponse: + """ + Cancel a batch that is in progress. + + 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 batch_id: + raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") + return self._post( + f"/v1/batches/{batch_id}/cancel", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BatchCancelResponse, + ) + + +class AsyncBatchesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBatchesResourceWithRawResponse: + """ + 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 AsyncBatchesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBatchesResourceWithStreamingResponse: + """ + 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 AsyncBatchesResourceWithStreamingResponse(self) + + async def create( + self, + *, + completion_window: Literal["24h"], + endpoint: str, + input_file_id: str, + idempotency_key: Optional[str] | Omit = omit, + metadata: Optional[Dict[str, 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, + ) -> BatchCreateResponse: + """ + Create a new batch for processing multiple API requests. + + 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 + """ + return await self._post( + "/v1/batches", + body=await async_maybe_transform( + { + "completion_window": completion_window, + "endpoint": endpoint, + "input_file_id": input_file_id, + "idempotency_key": idempotency_key, + "metadata": metadata, + }, + batch_create_params.BatchCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BatchCreateResponse, + ) + + async def retrieve( + self, + batch_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, + ) -> BatchRetrieveResponse: + """ + Retrieve information about a specific batch. + + 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 batch_id: + raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") + return await self._get( + f"/v1/batches/{batch_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BatchRetrieveResponse, + ) + + def list( + self, + *, + after: Optional[str] | Omit = omit, + limit: 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, + ) -> AsyncPaginator[BatchListResponse, AsyncOpenAICursorPage[BatchListResponse]]: + """ + List all batches for the current user. + + 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 + """ + return self._get_api_list( + "/v1/batches", + page=AsyncOpenAICursorPage[BatchListResponse], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "after": after, + "limit": limit, + }, + batch_list_params.BatchListParams, + ), + ), + model=BatchListResponse, + ) + + async def cancel( + self, + batch_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, + ) -> BatchCancelResponse: + """ + Cancel a batch that is in progress. + + 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 batch_id: + raise ValueError(f"Expected a non-empty value for `batch_id` but received {batch_id!r}") + return await self._post( + f"/v1/batches/{batch_id}/cancel", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=BatchCancelResponse, + ) + + +class BatchesResourceWithRawResponse: + def __init__(self, batches: BatchesResource) -> None: + self._batches = batches + + self.create = to_raw_response_wrapper( + batches.create, + ) + self.retrieve = to_raw_response_wrapper( + batches.retrieve, + ) + self.list = to_raw_response_wrapper( + batches.list, + ) + self.cancel = to_raw_response_wrapper( + batches.cancel, + ) + + +class AsyncBatchesResourceWithRawResponse: + def __init__(self, batches: AsyncBatchesResource) -> None: + self._batches = batches + + self.create = async_to_raw_response_wrapper( + batches.create, + ) + self.retrieve = async_to_raw_response_wrapper( + batches.retrieve, + ) + self.list = async_to_raw_response_wrapper( + batches.list, + ) + self.cancel = async_to_raw_response_wrapper( + batches.cancel, + ) + + +class BatchesResourceWithStreamingResponse: + def __init__(self, batches: BatchesResource) -> None: + self._batches = batches + + self.create = to_streamed_response_wrapper( + batches.create, + ) + self.retrieve = to_streamed_response_wrapper( + batches.retrieve, + ) + self.list = to_streamed_response_wrapper( + batches.list, + ) + self.cancel = to_streamed_response_wrapper( + batches.cancel, + ) + + +class AsyncBatchesResourceWithStreamingResponse: + def __init__(self, batches: AsyncBatchesResource) -> None: + self._batches = batches + + self.create = async_to_streamed_response_wrapper( + batches.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + batches.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + batches.list, + ) + self.cancel = async_to_streamed_response_wrapper( + batches.cancel, + ) diff --git a/src/llama_stack_client/resources/beta/datasets.py b/src/llama_stack_client/resources/beta/datasets.py index 6cc1885b..ba7841df 100644 --- a/src/llama_stack_client/resources/beta/datasets.py +++ b/src/llama_stack_client/resources/beta/datasets.py @@ -9,8 +9,7 @@ from __future__ import annotations import typing_extensions -from typing import Dict, Type, Union, Iterable, cast -from typing_extensions import Literal +from typing import Dict, Type, Iterable, Optional, cast import httpx @@ -115,7 +114,7 @@ def appendrows( self, dataset_id: str, *, - rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], + rows: Iterable[Dict[str, object]], # 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, @@ -127,8 +126,6 @@ def appendrows( Append rows to a dataset. Args: - rows: The rows to append to the dataset. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -153,8 +150,8 @@ def iterrows( self, dataset_id: str, *, - limit: int | Omit = omit, - start_index: int | Omit = omit, + limit: Optional[int] | Omit = omit, + start_index: Optional[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, @@ -162,7 +159,8 @@ def iterrows( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetIterrowsResponse: - """Get a paginated list of rows from a dataset. + """ + Get a paginated list of rows from a dataset. Uses offset-based pagination where: @@ -175,10 +173,6 @@ def iterrows( - has_more: Whether there are more items available after this set. Args: - limit: The number of rows to get. - - start_index: Index into dataset for the first row to get. Get all rows if None. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -211,10 +205,10 @@ def iterrows( def register( self, *, - purpose: Literal["post-training/messages", "eval/question-answer", "eval/messages-answer"], - source: dataset_register_params.Source, - dataset_id: str | Omit = omit, - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, + purpose: object, + source: object, + dataset_id: object | Omit = omit, + metadata: object | 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, @@ -222,36 +216,10 @@ def register( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetRegisterResponse: - """Register a new dataset. + """ + Register a new dataset. Args: - purpose: The purpose of the dataset. - - One of: - "post-training/messages": The dataset - contains a messages column with list of messages for post-training. { - "messages": [ {"role": "user", "content": "Hello, world!"}, {"role": - "assistant", "content": "Hello, world!"}, ] } - "eval/question-answer": The - dataset contains a question column and an answer column for evaluation. { - "question": "What is the capital of France?", "answer": "Paris" } - - "eval/messages-answer": The dataset contains a messages column with list of - messages and an answer column for evaluation. { "messages": [ {"role": "user", - "content": "Hello, my name is John Doe."}, {"role": "assistant", "content": - "Hello, John Doe. How can I help you today?"}, {"role": "user", "content": - "What's my name?"}, ], "answer": "John Doe" } - - source: The data source of the dataset. Ensure that the data source schema is compatible - with the purpose of the dataset. Examples: - { "type": "uri", "uri": - "https://mywebsite.com/mydata.jsonl" } - { "type": "uri", "uri": - "lsfs://mydata.jsonl" } - { "type": "uri", "uri": - "data:csv;base64,{base64_content}" } - { "type": "uri", "uri": - "huggingface://llamastack/simpleqa?split=train" } - { "type": "rows", "rows": [ - { "messages": [ {"role": "user", "content": "Hello, world!"}, {"role": - "assistant", "content": "Hello, world!"}, ] } ] } - - dataset_id: The ID of the dataset. If not provided, an ID will be generated. - - metadata: The metadata for the dataset. - E.g. {"description": "My dataset"}. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -393,7 +361,7 @@ async def appendrows( self, dataset_id: str, *, - rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], + rows: Iterable[Dict[str, object]], # 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, @@ -405,8 +373,6 @@ async def appendrows( Append rows to a dataset. Args: - rows: The rows to append to the dataset. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -431,8 +397,8 @@ async def iterrows( self, dataset_id: str, *, - limit: int | Omit = omit, - start_index: int | Omit = omit, + limit: Optional[int] | Omit = omit, + start_index: Optional[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, @@ -440,7 +406,8 @@ async def iterrows( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetIterrowsResponse: - """Get a paginated list of rows from a dataset. + """ + Get a paginated list of rows from a dataset. Uses offset-based pagination where: @@ -453,10 +420,6 @@ async def iterrows( - has_more: Whether there are more items available after this set. Args: - limit: The number of rows to get. - - start_index: Index into dataset for the first row to get. Get all rows if None. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -489,10 +452,10 @@ async def iterrows( async def register( self, *, - purpose: Literal["post-training/messages", "eval/question-answer", "eval/messages-answer"], - source: dataset_register_params.Source, - dataset_id: str | Omit = omit, - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, + purpose: object, + source: object, + dataset_id: object | Omit = omit, + metadata: object | 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, @@ -500,36 +463,10 @@ async def register( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DatasetRegisterResponse: - """Register a new dataset. + """ + Register a new dataset. Args: - purpose: The purpose of the dataset. - - One of: - "post-training/messages": The dataset - contains a messages column with list of messages for post-training. { - "messages": [ {"role": "user", "content": "Hello, world!"}, {"role": - "assistant", "content": "Hello, world!"}, ] } - "eval/question-answer": The - dataset contains a question column and an answer column for evaluation. { - "question": "What is the capital of France?", "answer": "Paris" } - - "eval/messages-answer": The dataset contains a messages column with list of - messages and an answer column for evaluation. { "messages": [ {"role": "user", - "content": "Hello, my name is John Doe."}, {"role": "assistant", "content": - "Hello, John Doe. How can I help you today?"}, {"role": "user", "content": - "What's my name?"}, ], "answer": "John Doe" } - - source: The data source of the dataset. Ensure that the data source schema is compatible - with the purpose of the dataset. Examples: - { "type": "uri", "uri": - "https://mywebsite.com/mydata.jsonl" } - { "type": "uri", "uri": - "lsfs://mydata.jsonl" } - { "type": "uri", "uri": - "data:csv;base64,{base64_content}" } - { "type": "uri", "uri": - "huggingface://llamastack/simpleqa?split=train" } - { "type": "rows", "rows": [ - { "messages": [ {"role": "user", "content": "Hello, world!"}, {"role": - "assistant", "content": "Hello, world!"}, ] } ] } - - dataset_id: The ID of the dataset. If not provided, an ID will be generated. - - metadata: The metadata for the dataset. - E.g. {"description": "My dataset"}. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/llama_stack_client/resources/chat/completions.py b/src/llama_stack_client/resources/chat/completions.py index 5986a4d8..21e2ec03 100644 --- a/src/llama_stack_client/resources/chat/completions.py +++ b/src/llama_stack_client/resources/chat/completions.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Any, Dict, Union, Iterable, cast +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, overload import httpx @@ -24,9 +24,8 @@ async_to_streamed_response_wrapper, ) from ..._streaming import Stream, AsyncStream -from ...pagination import SyncOpenAICursorPage, AsyncOpenAICursorPage from ...types.chat import completion_list_params, completion_create_params -from ..._base_client import AsyncPaginator, make_request_options +from ..._base_client import make_request_options from ...types.chat_completion_chunk import ChatCompletionChunk from ...types.chat.completion_list_response import CompletionListResponse from ...types.chat.completion_create_response import CompletionCreateResponse @@ -61,27 +60,27 @@ def create( *, messages: Iterable[completion_create_params.Message], model: str, - frequency_penalty: float | Omit = omit, - function_call: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - functions: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_completion_tokens: int | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - parallel_tool_calls: bool | Omit = omit, - presence_penalty: float | Omit = omit, - response_format: completion_create_params.ResponseFormat | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream: Literal[False] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - temperature: float | Omit = omit, - tool_choice: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - tools: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - top_logprobs: int | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + function_call: Union[str, Dict[str, object], None] | Omit = omit, + functions: Optional[Iterable[Dict[str, object]]] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_completion_tokens: Optional[int] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + parallel_tool_calls: Optional[bool] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + response_format: Optional[completion_create_params.ResponseFormat] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream: Optional[Literal[False]] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + temperature: Optional[float] | Omit = omit, + tool_choice: Union[str, Dict[str, object], None] | Omit = omit, + tools: Optional[Iterable[Dict[str, object]]] | Omit = omit, + top_logprobs: Optional[int] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -89,58 +88,14 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionCreateResponse: - """Create chat completions. + """ + Create chat completions. - Generate an OpenAI-compatible chat completion for the - given messages using the specified model. + Generate an OpenAI-compatible chat completion for the given messages using the + specified model. Args: - messages: List of messages in the conversation. - - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - function_call: (Optional) The function call to use. - - functions: (Optional) List of functions to use. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_completion_tokens: (Optional) The maximum number of tokens to generate. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - parallel_tool_calls: (Optional) Whether to parallelize tool calls. - - presence_penalty: (Optional) The penalty for repeated tokens. - - response_format: (Optional) The response format to use. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream: (Optional) Whether to stream the response. - - stream_options: (Optional) The stream options to use. - - temperature: (Optional) The temperature to use. - - tool_choice: (Optional) The tool choice to use. - - tools: (Optional) The tools to use. - - top_logprobs: (Optional) The top log probabilities to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. + response_format: Text response format for OpenAI-compatible chat completion requests. extra_headers: Send extra headers @@ -159,26 +114,26 @@ def create( messages: Iterable[completion_create_params.Message], model: str, stream: Literal[True], - frequency_penalty: float | Omit = omit, - function_call: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - functions: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_completion_tokens: int | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - parallel_tool_calls: bool | Omit = omit, - presence_penalty: float | Omit = omit, - response_format: completion_create_params.ResponseFormat | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - temperature: float | Omit = omit, - tool_choice: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - tools: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - top_logprobs: int | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + function_call: Union[str, Dict[str, object], None] | Omit = omit, + functions: Optional[Iterable[Dict[str, object]]] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_completion_tokens: Optional[int] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + parallel_tool_calls: Optional[bool] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + response_format: Optional[completion_create_params.ResponseFormat] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + temperature: Optional[float] | Omit = omit, + tool_choice: Union[str, Dict[str, object], None] | Omit = omit, + tools: Optional[Iterable[Dict[str, object]]] | Omit = omit, + top_logprobs: Optional[int] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -186,58 +141,14 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream[ChatCompletionChunk]: - """Create chat completions. + """ + Create chat completions. - Generate an OpenAI-compatible chat completion for the - given messages using the specified model. + Generate an OpenAI-compatible chat completion for the given messages using the + specified model. Args: - messages: List of messages in the conversation. - - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - stream: (Optional) Whether to stream the response. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - function_call: (Optional) The function call to use. - - functions: (Optional) List of functions to use. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_completion_tokens: (Optional) The maximum number of tokens to generate. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - parallel_tool_calls: (Optional) Whether to parallelize tool calls. - - presence_penalty: (Optional) The penalty for repeated tokens. - - response_format: (Optional) The response format to use. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream_options: (Optional) The stream options to use. - - temperature: (Optional) The temperature to use. - - tool_choice: (Optional) The tool choice to use. - - tools: (Optional) The tools to use. - - top_logprobs: (Optional) The top log probabilities to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. + response_format: Text response format for OpenAI-compatible chat completion requests. extra_headers: Send extra headers @@ -256,26 +167,26 @@ def create( messages: Iterable[completion_create_params.Message], model: str, stream: bool, - frequency_penalty: float | Omit = omit, - function_call: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - functions: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_completion_tokens: int | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - parallel_tool_calls: bool | Omit = omit, - presence_penalty: float | Omit = omit, - response_format: completion_create_params.ResponseFormat | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - temperature: float | Omit = omit, - tool_choice: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - tools: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - top_logprobs: int | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + function_call: Union[str, Dict[str, object], None] | Omit = omit, + functions: Optional[Iterable[Dict[str, object]]] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_completion_tokens: Optional[int] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + parallel_tool_calls: Optional[bool] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + response_format: Optional[completion_create_params.ResponseFormat] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + temperature: Optional[float] | Omit = omit, + tool_choice: Union[str, Dict[str, object], None] | Omit = omit, + tools: Optional[Iterable[Dict[str, object]]] | Omit = omit, + top_logprobs: Optional[int] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -283,58 +194,14 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionCreateResponse | Stream[ChatCompletionChunk]: - """Create chat completions. + """ + Create chat completions. - Generate an OpenAI-compatible chat completion for the - given messages using the specified model. + Generate an OpenAI-compatible chat completion for the given messages using the + specified model. Args: - messages: List of messages in the conversation. - - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - stream: (Optional) Whether to stream the response. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - function_call: (Optional) The function call to use. - - functions: (Optional) List of functions to use. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_completion_tokens: (Optional) The maximum number of tokens to generate. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - parallel_tool_calls: (Optional) Whether to parallelize tool calls. - - presence_penalty: (Optional) The penalty for repeated tokens. - - response_format: (Optional) The response format to use. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream_options: (Optional) The stream options to use. - - temperature: (Optional) The temperature to use. - - tool_choice: (Optional) The tool choice to use. - - tools: (Optional) The tools to use. - - top_logprobs: (Optional) The top log probabilities to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. + response_format: Text response format for OpenAI-compatible chat completion requests. extra_headers: Send extra headers @@ -352,27 +219,27 @@ def create( *, messages: Iterable[completion_create_params.Message], model: str, - frequency_penalty: float | Omit = omit, - function_call: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - functions: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_completion_tokens: int | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - parallel_tool_calls: bool | Omit = omit, - presence_penalty: float | Omit = omit, - response_format: completion_create_params.ResponseFormat | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - temperature: float | Omit = omit, - tool_choice: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - tools: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - top_logprobs: int | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + function_call: Union[str, Dict[str, object], None] | Omit = omit, + functions: Optional[Iterable[Dict[str, object]]] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_completion_tokens: Optional[int] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + parallel_tool_calls: Optional[bool] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + response_format: Optional[completion_create_params.ResponseFormat] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream: Optional[Literal[False]] | Literal[True] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + temperature: Optional[float] | Omit = omit, + tool_choice: Union[str, Dict[str, object], None] | Omit = omit, + tools: Optional[Iterable[Dict[str, object]]] | Omit = omit, + top_logprobs: Optional[int] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -415,9 +282,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast( - Any, CompletionCreateResponse - ), # Union types cannot be passed in as arguments in the type system + cast_to=CompletionCreateResponse, stream=stream or False, stream_cls=Stream[ChatCompletionChunk], ) @@ -433,7 +298,8 @@ def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionRetrieveResponse: - """Get chat completion. + """ + Get chat completion. Describe a chat completion by its ID. @@ -459,28 +325,22 @@ def retrieve( def list( self, *, - after: str | Omit = omit, - limit: int | Omit = omit, - model: str | Omit = omit, - order: Literal["asc", "desc"] | Omit = omit, + after: Optional[str] | Omit = omit, + limit: Optional[int] | Omit = omit, + model: Optional[str] | Omit = omit, + order: Optional[Literal["asc", "desc"]] | 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, - ) -> SyncOpenAICursorPage[CompletionListResponse]: + ) -> CompletionListResponse: """ List chat completions. Args: - after: The ID of the last chat completion to return. - - limit: The maximum number of chat completions to return. - - model: The model to filter by. - - order: The order to sort the chat completions by: "asc" or "desc". Defaults to "desc". + order: Sort order for paginated responses. extra_headers: Send extra headers @@ -490,9 +350,8 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return self._get( "/v1/chat/completions", - page=SyncOpenAICursorPage[CompletionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -508,7 +367,7 @@ def list( completion_list_params.CompletionListParams, ), ), - model=CompletionListResponse, + cast_to=CompletionListResponse, ) @@ -538,27 +397,27 @@ async def create( *, messages: Iterable[completion_create_params.Message], model: str, - frequency_penalty: float | Omit = omit, - function_call: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - functions: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_completion_tokens: int | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - parallel_tool_calls: bool | Omit = omit, - presence_penalty: float | Omit = omit, - response_format: completion_create_params.ResponseFormat | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream: Literal[False] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - temperature: float | Omit = omit, - tool_choice: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - tools: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - top_logprobs: int | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + function_call: Union[str, Dict[str, object], None] | Omit = omit, + functions: Optional[Iterable[Dict[str, object]]] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_completion_tokens: Optional[int] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + parallel_tool_calls: Optional[bool] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + response_format: Optional[completion_create_params.ResponseFormat] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream: Optional[Literal[False]] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + temperature: Optional[float] | Omit = omit, + tool_choice: Union[str, Dict[str, object], None] | Omit = omit, + tools: Optional[Iterable[Dict[str, object]]] | Omit = omit, + top_logprobs: Optional[int] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -566,58 +425,14 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionCreateResponse: - """Create chat completions. + """ + Create chat completions. - Generate an OpenAI-compatible chat completion for the - given messages using the specified model. + Generate an OpenAI-compatible chat completion for the given messages using the + specified model. Args: - messages: List of messages in the conversation. - - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - function_call: (Optional) The function call to use. - - functions: (Optional) List of functions to use. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_completion_tokens: (Optional) The maximum number of tokens to generate. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - parallel_tool_calls: (Optional) Whether to parallelize tool calls. - - presence_penalty: (Optional) The penalty for repeated tokens. - - response_format: (Optional) The response format to use. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream: (Optional) Whether to stream the response. - - stream_options: (Optional) The stream options to use. - - temperature: (Optional) The temperature to use. - - tool_choice: (Optional) The tool choice to use. - - tools: (Optional) The tools to use. - - top_logprobs: (Optional) The top log probabilities to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. + response_format: Text response format for OpenAI-compatible chat completion requests. extra_headers: Send extra headers @@ -636,26 +451,26 @@ async def create( messages: Iterable[completion_create_params.Message], model: str, stream: Literal[True], - frequency_penalty: float | Omit = omit, - function_call: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - functions: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_completion_tokens: int | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - parallel_tool_calls: bool | Omit = omit, - presence_penalty: float | Omit = omit, - response_format: completion_create_params.ResponseFormat | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - temperature: float | Omit = omit, - tool_choice: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - tools: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - top_logprobs: int | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + function_call: Union[str, Dict[str, object], None] | Omit = omit, + functions: Optional[Iterable[Dict[str, object]]] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_completion_tokens: Optional[int] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + parallel_tool_calls: Optional[bool] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + response_format: Optional[completion_create_params.ResponseFormat] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + temperature: Optional[float] | Omit = omit, + tool_choice: Union[str, Dict[str, object], None] | Omit = omit, + tools: Optional[Iterable[Dict[str, object]]] | Omit = omit, + top_logprobs: Optional[int] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -663,58 +478,14 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncStream[ChatCompletionChunk]: - """Create chat completions. + """ + Create chat completions. - Generate an OpenAI-compatible chat completion for the - given messages using the specified model. + Generate an OpenAI-compatible chat completion for the given messages using the + specified model. Args: - messages: List of messages in the conversation. - - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - stream: (Optional) Whether to stream the response. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - function_call: (Optional) The function call to use. - - functions: (Optional) List of functions to use. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_completion_tokens: (Optional) The maximum number of tokens to generate. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - parallel_tool_calls: (Optional) Whether to parallelize tool calls. - - presence_penalty: (Optional) The penalty for repeated tokens. - - response_format: (Optional) The response format to use. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream_options: (Optional) The stream options to use. - - temperature: (Optional) The temperature to use. - - tool_choice: (Optional) The tool choice to use. - - tools: (Optional) The tools to use. - - top_logprobs: (Optional) The top log probabilities to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. + response_format: Text response format for OpenAI-compatible chat completion requests. extra_headers: Send extra headers @@ -733,26 +504,26 @@ async def create( messages: Iterable[completion_create_params.Message], model: str, stream: bool, - frequency_penalty: float | Omit = omit, - function_call: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - functions: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_completion_tokens: int | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - parallel_tool_calls: bool | Omit = omit, - presence_penalty: float | Omit = omit, - response_format: completion_create_params.ResponseFormat | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - temperature: float | Omit = omit, - tool_choice: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - tools: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - top_logprobs: int | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + function_call: Union[str, Dict[str, object], None] | Omit = omit, + functions: Optional[Iterable[Dict[str, object]]] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_completion_tokens: Optional[int] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + parallel_tool_calls: Optional[bool] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + response_format: Optional[completion_create_params.ResponseFormat] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + temperature: Optional[float] | Omit = omit, + tool_choice: Union[str, Dict[str, object], None] | Omit = omit, + tools: Optional[Iterable[Dict[str, object]]] | Omit = omit, + top_logprobs: Optional[int] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -760,58 +531,14 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionCreateResponse | AsyncStream[ChatCompletionChunk]: - """Create chat completions. + """ + Create chat completions. - Generate an OpenAI-compatible chat completion for the - given messages using the specified model. + Generate an OpenAI-compatible chat completion for the given messages using the + specified model. Args: - messages: List of messages in the conversation. - - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - stream: (Optional) Whether to stream the response. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - function_call: (Optional) The function call to use. - - functions: (Optional) List of functions to use. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_completion_tokens: (Optional) The maximum number of tokens to generate. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - parallel_tool_calls: (Optional) Whether to parallelize tool calls. - - presence_penalty: (Optional) The penalty for repeated tokens. - - response_format: (Optional) The response format to use. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream_options: (Optional) The stream options to use. - - temperature: (Optional) The temperature to use. - - tool_choice: (Optional) The tool choice to use. - - tools: (Optional) The tools to use. - - top_logprobs: (Optional) The top log probabilities to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. + response_format: Text response format for OpenAI-compatible chat completion requests. extra_headers: Send extra headers @@ -829,27 +556,27 @@ async def create( *, messages: Iterable[completion_create_params.Message], model: str, - frequency_penalty: float | Omit = omit, - function_call: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - functions: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_completion_tokens: int | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - parallel_tool_calls: bool | Omit = omit, - presence_penalty: float | Omit = omit, - response_format: completion_create_params.ResponseFormat | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - temperature: float | Omit = omit, - tool_choice: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - tools: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] | Omit = omit, - top_logprobs: int | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + function_call: Union[str, Dict[str, object], None] | Omit = omit, + functions: Optional[Iterable[Dict[str, object]]] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_completion_tokens: Optional[int] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + parallel_tool_calls: Optional[bool] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + response_format: Optional[completion_create_params.ResponseFormat] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream: Optional[Literal[False]] | Literal[True] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + temperature: Optional[float] | Omit = omit, + tool_choice: Union[str, Dict[str, object], None] | Omit = omit, + tools: Optional[Iterable[Dict[str, object]]] | Omit = omit, + top_logprobs: Optional[int] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -892,9 +619,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast( - Any, CompletionCreateResponse - ), # Union types cannot be passed in as arguments in the type system + cast_to=CompletionCreateResponse, stream=stream or False, stream_cls=AsyncStream[ChatCompletionChunk], ) @@ -910,7 +635,8 @@ async def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionRetrieveResponse: - """Get chat completion. + """ + Get chat completion. Describe a chat completion by its ID. @@ -933,31 +659,25 @@ async def retrieve( cast_to=CompletionRetrieveResponse, ) - def list( + async def list( self, *, - after: str | Omit = omit, - limit: int | Omit = omit, - model: str | Omit = omit, - order: Literal["asc", "desc"] | Omit = omit, + after: Optional[str] | Omit = omit, + limit: Optional[int] | Omit = omit, + model: Optional[str] | Omit = omit, + order: Optional[Literal["asc", "desc"]] | 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, - ) -> AsyncPaginator[CompletionListResponse, AsyncOpenAICursorPage[CompletionListResponse]]: + ) -> CompletionListResponse: """ List chat completions. Args: - after: The ID of the last chat completion to return. - - limit: The maximum number of chat completions to return. - - model: The model to filter by. - - order: The order to sort the chat completions by: "asc" or "desc". Defaults to "desc". + order: Sort order for paginated responses. extra_headers: Send extra headers @@ -967,15 +687,14 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - return self._get_api_list( + return await self._get( "/v1/chat/completions", - page=AsyncOpenAICursorPage[CompletionListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=maybe_transform( + query=await async_maybe_transform( { "after": after, "limit": limit, @@ -985,7 +704,7 @@ def list( completion_list_params.CompletionListParams, ), ), - model=CompletionListResponse, + cast_to=CompletionListResponse, ) diff --git a/src/llama_stack_client/resources/completions.py b/src/llama_stack_client/resources/completions.py index 1f7ddb60..73c29edd 100644 --- a/src/llama_stack_client/resources/completions.py +++ b/src/llama_stack_client/resources/completions.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, overload import httpx @@ -57,22 +57,22 @@ def create( *, model: str, prompt: Union[str, SequenceNotStr[str], Iterable[int], Iterable[Iterable[int]]], - best_of: int | Omit = omit, - echo: bool | Omit = omit, - frequency_penalty: float | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - presence_penalty: float | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream: Literal[False] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - suffix: str | Omit = omit, - temperature: float | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + best_of: Optional[int] | Omit = omit, + echo: Optional[bool] | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream: Optional[Literal[False]] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + suffix: Optional[str] | Omit = omit, + temperature: Optional[float] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -80,49 +80,13 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionCreateResponse: - """Create completion. + """ + Create completion. - Generate an OpenAI-compatible completion for the given prompt - using the specified model. + Generate an OpenAI-compatible completion for the given prompt using the + specified model. Args: - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - prompt: The prompt to generate a completion for. - - best_of: (Optional) The number of completions to generate. - - echo: (Optional) Whether to echo the prompt. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - presence_penalty: (Optional) The penalty for repeated tokens. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream: (Optional) Whether to stream the response. - - stream_options: (Optional) The stream options to use. - - suffix: (Optional) The suffix that should be appended to the completion. - - temperature: (Optional) The temperature to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -140,21 +104,21 @@ def create( model: str, prompt: Union[str, SequenceNotStr[str], Iterable[int], Iterable[Iterable[int]]], stream: Literal[True], - best_of: int | Omit = omit, - echo: bool | Omit = omit, - frequency_penalty: float | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - presence_penalty: float | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - suffix: str | Omit = omit, - temperature: float | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + best_of: Optional[int] | Omit = omit, + echo: Optional[bool] | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + suffix: Optional[str] | Omit = omit, + temperature: Optional[float] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -162,49 +126,13 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Stream[CompletionCreateResponse]: - """Create completion. + """ + Create completion. - Generate an OpenAI-compatible completion for the given prompt - using the specified model. + Generate an OpenAI-compatible completion for the given prompt using the + specified model. Args: - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - prompt: The prompt to generate a completion for. - - stream: (Optional) Whether to stream the response. - - best_of: (Optional) The number of completions to generate. - - echo: (Optional) Whether to echo the prompt. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - presence_penalty: (Optional) The penalty for repeated tokens. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream_options: (Optional) The stream options to use. - - suffix: (Optional) The suffix that should be appended to the completion. - - temperature: (Optional) The temperature to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -222,21 +150,21 @@ def create( model: str, prompt: Union[str, SequenceNotStr[str], Iterable[int], Iterable[Iterable[int]]], stream: bool, - best_of: int | Omit = omit, - echo: bool | Omit = omit, - frequency_penalty: float | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - presence_penalty: float | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - suffix: str | Omit = omit, - temperature: float | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + best_of: Optional[int] | Omit = omit, + echo: Optional[bool] | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + suffix: Optional[str] | Omit = omit, + temperature: Optional[float] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -244,49 +172,13 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionCreateResponse | Stream[CompletionCreateResponse]: - """Create completion. + """ + Create completion. - Generate an OpenAI-compatible completion for the given prompt - using the specified model. + Generate an OpenAI-compatible completion for the given prompt using the + specified model. Args: - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - prompt: The prompt to generate a completion for. - - stream: (Optional) Whether to stream the response. - - best_of: (Optional) The number of completions to generate. - - echo: (Optional) Whether to echo the prompt. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - presence_penalty: (Optional) The penalty for repeated tokens. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream_options: (Optional) The stream options to use. - - suffix: (Optional) The suffix that should be appended to the completion. - - temperature: (Optional) The temperature to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -303,22 +195,22 @@ def create( *, model: str, prompt: Union[str, SequenceNotStr[str], Iterable[int], Iterable[Iterable[int]]], - best_of: int | Omit = omit, - echo: bool | Omit = omit, - frequency_penalty: float | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - presence_penalty: float | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - suffix: str | Omit = omit, - temperature: float | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + best_of: Optional[int] | Omit = omit, + echo: Optional[bool] | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream: Optional[Literal[False]] | Literal[True] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + suffix: Optional[str] | Omit = omit, + temperature: Optional[float] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -388,22 +280,22 @@ async def create( *, model: str, prompt: Union[str, SequenceNotStr[str], Iterable[int], Iterable[Iterable[int]]], - best_of: int | Omit = omit, - echo: bool | Omit = omit, - frequency_penalty: float | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - presence_penalty: float | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream: Literal[False] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - suffix: str | Omit = omit, - temperature: float | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + best_of: Optional[int] | Omit = omit, + echo: Optional[bool] | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream: Optional[Literal[False]] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + suffix: Optional[str] | Omit = omit, + temperature: Optional[float] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -411,49 +303,13 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionCreateResponse: - """Create completion. + """ + Create completion. - Generate an OpenAI-compatible completion for the given prompt - using the specified model. + Generate an OpenAI-compatible completion for the given prompt using the + specified model. Args: - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - prompt: The prompt to generate a completion for. - - best_of: (Optional) The number of completions to generate. - - echo: (Optional) Whether to echo the prompt. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - presence_penalty: (Optional) The penalty for repeated tokens. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream: (Optional) Whether to stream the response. - - stream_options: (Optional) The stream options to use. - - suffix: (Optional) The suffix that should be appended to the completion. - - temperature: (Optional) The temperature to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -471,21 +327,21 @@ async def create( model: str, prompt: Union[str, SequenceNotStr[str], Iterable[int], Iterable[Iterable[int]]], stream: Literal[True], - best_of: int | Omit = omit, - echo: bool | Omit = omit, - frequency_penalty: float | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - presence_penalty: float | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - suffix: str | Omit = omit, - temperature: float | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + best_of: Optional[int] | Omit = omit, + echo: Optional[bool] | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + suffix: Optional[str] | Omit = omit, + temperature: Optional[float] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -493,49 +349,13 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncStream[CompletionCreateResponse]: - """Create completion. + """ + Create completion. - Generate an OpenAI-compatible completion for the given prompt - using the specified model. + Generate an OpenAI-compatible completion for the given prompt using the + specified model. Args: - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - prompt: The prompt to generate a completion for. - - stream: (Optional) Whether to stream the response. - - best_of: (Optional) The number of completions to generate. - - echo: (Optional) Whether to echo the prompt. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - presence_penalty: (Optional) The penalty for repeated tokens. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream_options: (Optional) The stream options to use. - - suffix: (Optional) The suffix that should be appended to the completion. - - temperature: (Optional) The temperature to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -553,21 +373,21 @@ async def create( model: str, prompt: Union[str, SequenceNotStr[str], Iterable[int], Iterable[Iterable[int]]], stream: bool, - best_of: int | Omit = omit, - echo: bool | Omit = omit, - frequency_penalty: float | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - presence_penalty: float | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - suffix: str | Omit = omit, - temperature: float | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + best_of: Optional[int] | Omit = omit, + echo: Optional[bool] | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + suffix: Optional[str] | Omit = omit, + temperature: Optional[float] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, @@ -575,49 +395,13 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CompletionCreateResponse | AsyncStream[CompletionCreateResponse]: - """Create completion. + """ + Create completion. - Generate an OpenAI-compatible completion for the given prompt - using the specified model. + Generate an OpenAI-compatible completion for the given prompt using the + specified model. Args: - model: The identifier of the model to use. The model must be registered with Llama - Stack and available via the /models endpoint. - - prompt: The prompt to generate a completion for. - - stream: (Optional) Whether to stream the response. - - best_of: (Optional) The number of completions to generate. - - echo: (Optional) Whether to echo the prompt. - - frequency_penalty: (Optional) The penalty for repeated tokens. - - logit_bias: (Optional) The logit bias to use. - - logprobs: (Optional) The log probabilities to use. - - max_tokens: (Optional) The maximum number of tokens to generate. - - n: (Optional) The number of completions to generate. - - presence_penalty: (Optional) The penalty for repeated tokens. - - seed: (Optional) The seed to use. - - stop: (Optional) The stop tokens to use. - - stream_options: (Optional) The stream options to use. - - suffix: (Optional) The suffix that should be appended to the completion. - - temperature: (Optional) The temperature to use. - - top_p: (Optional) The top p to use. - - user: (Optional) The user to use. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -634,22 +418,22 @@ async def create( *, model: str, prompt: Union[str, SequenceNotStr[str], Iterable[int], Iterable[Iterable[int]]], - best_of: int | Omit = omit, - echo: bool | Omit = omit, - frequency_penalty: float | Omit = omit, - logit_bias: Dict[str, float] | Omit = omit, - logprobs: bool | Omit = omit, - max_tokens: int | Omit = omit, - n: int | Omit = omit, - presence_penalty: float | Omit = omit, - seed: int | Omit = omit, - stop: Union[str, SequenceNotStr[str]] | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - suffix: str | Omit = omit, - temperature: float | Omit = omit, - top_p: float | Omit = omit, - user: str | Omit = omit, + best_of: Optional[int] | Omit = omit, + echo: Optional[bool] | Omit = omit, + frequency_penalty: Optional[float] | Omit = omit, + logit_bias: Optional[Dict[str, float]] | Omit = omit, + logprobs: Optional[bool] | Omit = omit, + max_tokens: Optional[int] | Omit = omit, + n: Optional[int] | Omit = omit, + presence_penalty: Optional[float] | Omit = omit, + seed: Optional[int] | Omit = omit, + stop: Union[str, SequenceNotStr[str], None] | Omit = omit, + stream: Optional[Literal[False]] | Literal[True] | Omit = omit, + stream_options: Optional[Dict[str, object]] | Omit = omit, + suffix: Optional[str] | Omit = omit, + temperature: Optional[float] | Omit = omit, + top_p: Optional[float] | Omit = omit, + user: Optional[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, diff --git a/src/llama_stack_client/resources/conversations/conversations.py b/src/llama_stack_client/resources/conversations/conversations.py index 66dfe7d3..b3736d53 100644 --- a/src/llama_stack_client/resources/conversations/conversations.py +++ b/src/llama_stack_client/resources/conversations/conversations.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Iterable +from typing import Dict, Iterable, Optional import httpx @@ -65,8 +65,8 @@ def with_streaming_response(self) -> ConversationsResourceWithStreamingResponse: def create( self, *, - items: Iterable[conversation_create_params.Item] | Omit = omit, - metadata: Dict[str, str] | Omit = omit, + items: Optional[Iterable[conversation_create_params.Item]] | Omit = omit, + metadata: Optional[Dict[str, 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, @@ -74,15 +74,12 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConversationObject: - """Create a conversation. + """ + Create a conversation. Create a conversation. Args: - items: Initial items to include in the conversation context. - - metadata: Set of key-value pairs that can be attached to an object. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -117,7 +114,8 @@ def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConversationObject: - """Retrieve a conversation. + """ + Retrieve a conversation. Get a conversation with the given ID. @@ -152,13 +150,12 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConversationObject: - """Update a conversation. + """ + Update a conversation. Update a conversation's metadata with the given ID. Args: - metadata: Set of key-value pairs that can be attached to an object. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -189,7 +186,8 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConversationDeleteResponse: - """Delete a conversation. + """ + Delete a conversation. Delete a conversation with the given ID. @@ -240,8 +238,8 @@ def with_streaming_response(self) -> AsyncConversationsResourceWithStreamingResp async def create( self, *, - items: Iterable[conversation_create_params.Item] | Omit = omit, - metadata: Dict[str, str] | Omit = omit, + items: Optional[Iterable[conversation_create_params.Item]] | Omit = omit, + metadata: Optional[Dict[str, 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, @@ -249,15 +247,12 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConversationObject: - """Create a conversation. + """ + Create a conversation. Create a conversation. Args: - items: Initial items to include in the conversation context. - - metadata: Set of key-value pairs that can be attached to an object. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -292,7 +287,8 @@ async def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConversationObject: - """Retrieve a conversation. + """ + Retrieve a conversation. Get a conversation with the given ID. @@ -327,13 +323,12 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConversationObject: - """Update a conversation. + """ + Update a conversation. Update a conversation's metadata with the given ID. Args: - metadata: Set of key-value pairs that can be attached to an object. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -366,7 +361,8 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ConversationDeleteResponse: - """Delete a conversation. + """ + Delete a conversation. Delete a conversation with the given ID. diff --git a/src/llama_stack_client/resources/conversations/items.py b/src/llama_stack_client/resources/conversations/items.py index 4850adf8..24f60606 100644 --- a/src/llama_stack_client/resources/conversations/items.py +++ b/src/llama_stack_client/resources/conversations/items.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Any, List, Iterable, cast +from typing import Any, List, Iterable, Optional, cast from typing_extensions import Literal import httpx @@ -29,6 +29,7 @@ from ...types.conversations.item_get_response import ItemGetResponse from ...types.conversations.item_list_response import ItemListResponse from ...types.conversations.item_create_response import ItemCreateResponse +from ...types.conversations.item_delete_response import ItemDeleteResponse __all__ = ["ItemsResource", "AsyncItemsResource"] @@ -65,13 +66,12 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ItemCreateResponse: - """Create items. + """ + Create items. Create items in the conversation. Args: - items: Items to include in the conversation context. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -95,21 +95,23 @@ def list( self, conversation_id: str, *, - after: str | Omit = omit, - include: List[ - Literal[ - "web_search_call.action.sources", - "code_interpreter_call.outputs", - "computer_call_output.output.image_url", - "file_search_call.results", - "message.input_image.image_url", - "message.output_text.logprobs", - "reasoning.encrypted_content", + after: Optional[str] | Omit = omit, + include: Optional[ + List[ + Literal[ + "web_search_call.action.sources", + "code_interpreter_call.outputs", + "computer_call_output.output.image_url", + "file_search_call.results", + "message.input_image.image_url", + "message.output_text.logprobs", + "reasoning.encrypted_content", + ] ] ] | Omit = omit, - limit: int | Omit = omit, - order: Literal["asc", "desc"] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[Literal["asc", "desc"]] | 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, @@ -117,19 +119,12 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOpenAICursorPage[ItemListResponse]: - """List items. + """ + List items. List items in the conversation. Args: - after: An item ID to list items after, used in pagination. - - include: Specify additional output data to include in the response. - - limit: A limit on the number of objects to be returned (1-100, default 20). - - order: The order to return items in (asc or desc, default desc). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -161,6 +156,44 @@ def list( model=cast(Any, ItemListResponse), # Union types cannot be passed in as arguments in the type system ) + def delete( + self, + item_id: str, + *, + conversation_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, + ) -> ItemDeleteResponse: + """ + Delete an item. + + Delete a conversation item. + + 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 conversation_id: + raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}") + if not item_id: + raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") + return self._delete( + f"/v1/conversations/{conversation_id}/items/{item_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ItemDeleteResponse, + ) + def get( self, item_id: str, @@ -173,7 +206,8 @@ def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ItemGetResponse: - """Retrieve an item. + """ + Retrieve an item. Retrieve a conversation item. @@ -190,15 +224,12 @@ def get( raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}") if not item_id: raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") - return cast( - ItemGetResponse, - self._get( - f"/v1/conversations/{conversation_id}/items/{item_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast(Any, ItemGetResponse), # Union types cannot be passed in as arguments in the type system + return self._get( + f"/v1/conversations/{conversation_id}/items/{item_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=ItemGetResponse, ) @@ -234,13 +265,12 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ItemCreateResponse: - """Create items. + """ + Create items. Create items in the conversation. Args: - items: Items to include in the conversation context. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -264,21 +294,23 @@ def list( self, conversation_id: str, *, - after: str | Omit = omit, - include: List[ - Literal[ - "web_search_call.action.sources", - "code_interpreter_call.outputs", - "computer_call_output.output.image_url", - "file_search_call.results", - "message.input_image.image_url", - "message.output_text.logprobs", - "reasoning.encrypted_content", + after: Optional[str] | Omit = omit, + include: Optional[ + List[ + Literal[ + "web_search_call.action.sources", + "code_interpreter_call.outputs", + "computer_call_output.output.image_url", + "file_search_call.results", + "message.input_image.image_url", + "message.output_text.logprobs", + "reasoning.encrypted_content", + ] ] ] | Omit = omit, - limit: int | Omit = omit, - order: Literal["asc", "desc"] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[Literal["asc", "desc"]] | 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, @@ -286,19 +318,12 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ItemListResponse, AsyncOpenAICursorPage[ItemListResponse]]: - """List items. + """ + List items. List items in the conversation. Args: - after: An item ID to list items after, used in pagination. - - include: Specify additional output data to include in the response. - - limit: A limit on the number of objects to be returned (1-100, default 20). - - order: The order to return items in (asc or desc, default desc). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -330,6 +355,44 @@ def list( model=cast(Any, ItemListResponse), # Union types cannot be passed in as arguments in the type system ) + async def delete( + self, + item_id: str, + *, + conversation_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, + ) -> ItemDeleteResponse: + """ + Delete an item. + + Delete a conversation item. + + 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 conversation_id: + raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}") + if not item_id: + raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") + return await self._delete( + f"/v1/conversations/{conversation_id}/items/{item_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ItemDeleteResponse, + ) + async def get( self, item_id: str, @@ -342,7 +405,8 @@ async def get( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ItemGetResponse: - """Retrieve an item. + """ + Retrieve an item. Retrieve a conversation item. @@ -359,15 +423,12 @@ async def get( raise ValueError(f"Expected a non-empty value for `conversation_id` but received {conversation_id!r}") if not item_id: raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}") - return cast( - ItemGetResponse, - await self._get( - f"/v1/conversations/{conversation_id}/items/{item_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=cast(Any, ItemGetResponse), # Union types cannot be passed in as arguments in the type system + return await self._get( + f"/v1/conversations/{conversation_id}/items/{item_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), + cast_to=ItemGetResponse, ) @@ -381,6 +442,9 @@ def __init__(self, items: ItemsResource) -> None: self.list = to_raw_response_wrapper( items.list, ) + self.delete = to_raw_response_wrapper( + items.delete, + ) self.get = to_raw_response_wrapper( items.get, ) @@ -396,6 +460,9 @@ def __init__(self, items: AsyncItemsResource) -> None: self.list = async_to_raw_response_wrapper( items.list, ) + self.delete = async_to_raw_response_wrapper( + items.delete, + ) self.get = async_to_raw_response_wrapper( items.get, ) @@ -411,6 +478,9 @@ def __init__(self, items: ItemsResource) -> None: self.list = to_streamed_response_wrapper( items.list, ) + self.delete = to_streamed_response_wrapper( + items.delete, + ) self.get = to_streamed_response_wrapper( items.get, ) @@ -426,6 +496,9 @@ def __init__(self, items: AsyncItemsResource) -> None: self.list = async_to_streamed_response_wrapper( items.list, ) + self.delete = async_to_streamed_response_wrapper( + items.delete, + ) self.get = async_to_streamed_response_wrapper( items.get, ) diff --git a/src/llama_stack_client/resources/embeddings.py b/src/llama_stack_client/resources/embeddings.py index b1cbd018..6ff5d802 100644 --- a/src/llama_stack_client/resources/embeddings.py +++ b/src/llama_stack_client/resources/embeddings.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional import httpx @@ -54,9 +54,9 @@ def create( *, input: Union[str, SequenceNotStr[str]], model: str, - dimensions: int | Omit = omit, - encoding_format: str | Omit = omit, - user: str | Omit = omit, + dimensions: Optional[int] | Omit = omit, + encoding_format: Optional[str] | Omit = omit, + user: Optional[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, @@ -64,27 +64,13 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CreateEmbeddingsResponse: - """Create embeddings. + """ + Create embeddings. - Generate OpenAI-compatible embeddings for the given input - using the specified model. + Generate OpenAI-compatible embeddings for the given input using the specified + model. Args: - input: Input text to embed, encoded as a string or array of strings. To embed multiple - inputs in a single request, pass an array of strings. - - model: The identifier of the model to use. The model must be an embedding model - registered with Llama Stack and available via the /models endpoint. - - dimensions: (Optional) The number of dimensions the resulting output embeddings should have. - Only supported in text-embedding-3 and later models. - - encoding_format: (Optional) The format to return the embeddings in. Can be either "float" or - "base64". Defaults to "float". - - user: (Optional) A unique identifier representing your end-user, which can help OpenAI - to monitor and detect abuse. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -137,9 +123,9 @@ async def create( *, input: Union[str, SequenceNotStr[str]], model: str, - dimensions: int | Omit = omit, - encoding_format: str | Omit = omit, - user: str | Omit = omit, + dimensions: Optional[int] | Omit = omit, + encoding_format: Optional[str] | Omit = omit, + user: Optional[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, @@ -147,27 +133,13 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CreateEmbeddingsResponse: - """Create embeddings. + """ + Create embeddings. - Generate OpenAI-compatible embeddings for the given input - using the specified model. + Generate OpenAI-compatible embeddings for the given input using the specified + model. Args: - input: Input text to embed, encoded as a string or array of strings. To embed multiple - inputs in a single request, pass an array of strings. - - model: The identifier of the model to use. The model must be an embedding model - registered with Llama Stack and available via the /models endpoint. - - dimensions: (Optional) The number of dimensions the resulting output embeddings should have. - Only supported in text-embedding-3 and later models. - - encoding_format: (Optional) The format to return the embeddings in. Can be either "float" or - "base64". Defaults to "float". - - user: (Optional) A unique identifier representing your end-user, which can help OpenAI - to monitor and detect abuse. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/llama_stack_client/resources/files.py b/src/llama_stack_client/resources/files.py index 5916dd3b..a9f6fbce 100644 --- a/src/llama_stack_client/resources/files.py +++ b/src/llama_stack_client/resources/files.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Mapping, cast +from typing import Mapping, Optional, cast from typing_extensions import Literal import httpx @@ -57,7 +57,7 @@ def create( *, file: FileTypes, purpose: Literal["assistants", "batch"], - expires_after: file_create_params.ExpiresAfter | Omit = omit, + expires_after: Optional[file_create_params.ExpiresAfter] | 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, @@ -65,7 +65,8 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> File: - """Upload file. + """ + Upload file. Upload a file that can be used across various endpoints. @@ -78,8 +79,9 @@ def create( Args: purpose: Valid purpose values for OpenAI Files API. - expires_after: - Control expiration of uploaded files. Params: + expires_after: Control expiration of uploaded files. + + Params: - anchor, must be "created_at" - seconds, must be int between 3600 and 2592000 (1 hour to 30 days) @@ -125,7 +127,8 @@ def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> File: - """Retrieve file. + """ + Retrieve file. Returns information about a specific file. @@ -151,10 +154,10 @@ def retrieve( def list( self, *, - after: str | Omit = omit, - limit: int | Omit = omit, - order: Literal["asc", "desc"] | Omit = omit, - purpose: Literal["assistants", "batch"] | Omit = omit, + after: Optional[str] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[Literal["asc", "desc"]] | Omit = omit, + purpose: Optional[Literal["assistants", "batch"]] | 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, @@ -162,23 +165,15 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOpenAICursorPage[File]: - """List files. + """ + List files. Returns a list of files that belong to the user's organization. Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. + order: Sort order for paginated responses. - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 10,000, and the default is 10,000. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - purpose: Only return files with the given purpose. + purpose: Valid purpose values for OpenAI Files API. extra_headers: Send extra headers @@ -253,7 +248,8 @@ def content( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: - """Retrieve file content. + """ + Retrieve file content. Returns the contents of the specified file. @@ -302,7 +298,7 @@ async def create( *, file: FileTypes, purpose: Literal["assistants", "batch"], - expires_after: file_create_params.ExpiresAfter | Omit = omit, + expires_after: Optional[file_create_params.ExpiresAfter] | 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, @@ -310,7 +306,8 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> File: - """Upload file. + """ + Upload file. Upload a file that can be used across various endpoints. @@ -323,8 +320,9 @@ async def create( Args: purpose: Valid purpose values for OpenAI Files API. - expires_after: - Control expiration of uploaded files. Params: + expires_after: Control expiration of uploaded files. + + Params: - anchor, must be "created_at" - seconds, must be int between 3600 and 2592000 (1 hour to 30 days) @@ -370,7 +368,8 @@ async def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> File: - """Retrieve file. + """ + Retrieve file. Returns information about a specific file. @@ -396,10 +395,10 @@ async def retrieve( def list( self, *, - after: str | Omit = omit, - limit: int | Omit = omit, - order: Literal["asc", "desc"] | Omit = omit, - purpose: Literal["assistants", "batch"] | Omit = omit, + after: Optional[str] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[Literal["asc", "desc"]] | Omit = omit, + purpose: Optional[Literal["assistants", "batch"]] | 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, @@ -407,23 +406,15 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[File, AsyncOpenAICursorPage[File]]: - """List files. + """ + List files. Returns a list of files that belong to the user's organization. Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. For instance, if you make a list request and receive 100 objects, - ending with obj_foo, your subsequent call can include after=obj_foo in order to - fetch the next page of the list. + order: Sort order for paginated responses. - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 10,000, and the default is 10,000. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - - purpose: Only return files with the given purpose. + purpose: Valid purpose values for OpenAI Files API. extra_headers: Send extra headers @@ -498,7 +489,8 @@ async def content( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> object: - """Retrieve file content. + """ + Retrieve file content. Returns the contents of the specified file. diff --git a/src/llama_stack_client/resources/inspect.py b/src/llama_stack_client/resources/inspect.py index eaa4b9f7..73e7c972 100644 --- a/src/llama_stack_client/resources/inspect.py +++ b/src/llama_stack_client/resources/inspect.py @@ -56,7 +56,11 @@ def health( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> HealthInfo: - """Get health status. Get the current health status of the service.""" + """ + Get health status. + + Get the current health status of the service. + """ return self._get( "/v1/health", options=make_request_options( @@ -75,7 +79,11 @@ def version( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VersionInfo: - """Get version. Get the version of the service.""" + """ + Get version. + + Get the version of the service. + """ return self._get( "/v1/version", options=make_request_options( @@ -115,7 +123,11 @@ async def health( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> HealthInfo: - """Get health status. Get the current health status of the service.""" + """ + Get health status. + + Get the current health status of the service. + """ return await self._get( "/v1/health", options=make_request_options( @@ -134,7 +146,11 @@ async def version( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VersionInfo: - """Get version. Get the version of the service.""" + """ + Get version. + + Get the version of the service. + """ return await self._get( "/v1/version", options=make_request_options( diff --git a/src/llama_stack_client/resources/models/models.py b/src/llama_stack_client/resources/models/models.py index 7592e0b1..6eae5daf 100644 --- a/src/llama_stack_client/resources/models/models.py +++ b/src/llama_stack_client/resources/models/models.py @@ -9,7 +9,7 @@ from __future__ import annotations import typing_extensions -from typing import Dict, Type, Union, Iterable, cast +from typing import Dict, Type, Optional, cast from typing_extensions import Literal import httpx @@ -77,7 +77,8 @@ def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ModelRetrieveResponse: - """Get model. + """ + Get model. Get a model by its identifier. @@ -128,10 +129,10 @@ def register( self, *, model_id: str, - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - model_type: Literal["llm", "embedding", "rerank"] | Omit = omit, - provider_id: str | Omit = omit, - provider_model_id: str | Omit = omit, + metadata: Optional[Dict[str, object]] | Omit = omit, + model_type: Optional[Literal["llm", "embedding", "rerank"]] | Omit = omit, + provider_id: Optional[str] | Omit = omit, + provider_model_id: Optional[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, @@ -139,20 +140,13 @@ def register( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ModelRegisterResponse: - """Register model. + """ + Register model. Register a model. Args: - model_id: The identifier of the model to register. - - metadata: Any additional metadata for this model. - - model_type: The type of model to register. - - provider_id: The identifier of the provider. - - provider_model_id: The identifier of the model in the provider. + model_type: Enumeration of supported model types in Llama Stack. extra_headers: Send extra headers @@ -192,7 +186,8 @@ def unregister( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Unregister model. + """ + Unregister model. Unregister a model. @@ -252,7 +247,8 @@ async def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ModelRetrieveResponse: - """Get model. + """ + Get model. Get a model by its identifier. @@ -303,10 +299,10 @@ async def register( self, *, model_id: str, - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - model_type: Literal["llm", "embedding", "rerank"] | Omit = omit, - provider_id: str | Omit = omit, - provider_model_id: str | Omit = omit, + metadata: Optional[Dict[str, object]] | Omit = omit, + model_type: Optional[Literal["llm", "embedding", "rerank"]] | Omit = omit, + provider_id: Optional[str] | Omit = omit, + provider_model_id: Optional[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, @@ -314,20 +310,13 @@ async def register( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ModelRegisterResponse: - """Register model. + """ + Register model. Register a model. Args: - model_id: The identifier of the model to register. - - metadata: Any additional metadata for this model. - - model_type: The type of model to register. - - provider_id: The identifier of the provider. - - provider_model_id: The identifier of the model in the provider. + model_type: Enumeration of supported model types in Llama Stack. extra_headers: Send extra headers @@ -367,7 +356,8 @@ async def unregister( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Unregister model. + """ + Unregister model. Unregister a model. diff --git a/src/llama_stack_client/resources/moderations.py b/src/llama_stack_client/resources/moderations.py index aaa03690..a3b555a8 100644 --- a/src/llama_stack_client/resources/moderations.py +++ b/src/llama_stack_client/resources/moderations.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional import httpx @@ -53,7 +53,7 @@ def create( self, *, input: Union[str, SequenceNotStr[str]], - model: str | Omit = omit, + model: Optional[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, @@ -61,17 +61,12 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CreateResponse: - """Create moderation. + """ + Create moderation. - Classifies if text and/or image inputs are potentially - harmful. + Classifies if text and/or image inputs are potentially harmful. Args: - input: Input (or inputs) to classify. Can be a single string, an array of strings, or - an array of multi-modal input objects similar to other models. - - model: (Optional) The content moderation model you would like to use. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -120,7 +115,7 @@ async def create( self, *, input: Union[str, SequenceNotStr[str]], - model: str | Omit = omit, + model: Optional[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, @@ -128,17 +123,12 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CreateResponse: - """Create moderation. + """ + Create moderation. - Classifies if text and/or image inputs are potentially - harmful. + Classifies if text and/or image inputs are potentially harmful. Args: - input: Input (or inputs) to classify. Can be a single string, an array of strings, or - an array of multi-modal input objects similar to other models. - - model: (Optional) The content moderation model you would like to use. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/llama_stack_client/resources/prompts/prompts.py b/src/llama_stack_client/resources/prompts/prompts.py index aa14c6f2..514c6e28 100644 --- a/src/llama_stack_client/resources/prompts/prompts.py +++ b/src/llama_stack_client/resources/prompts/prompts.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -66,7 +66,7 @@ def create( self, *, prompt: str, - variables: SequenceNotStr[str] | Omit = omit, + variables: Optional[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, @@ -74,15 +74,12 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Prompt: - """Create prompt. + """ + Create prompt. Create a new prompt. Args: - prompt: The prompt text content with variable placeholders. - - variables: List of variable names that can be used in the prompt template. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -110,7 +107,7 @@ def retrieve( self, prompt_id: str, *, - version: int | Omit = omit, + version: Optional[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, @@ -118,13 +115,12 @@ def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Prompt: - """Get prompt. + """ + Get prompt. Get a prompt by its identifier and optional version. Args: - version: The version of the prompt to get (defaults to latest). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -152,9 +148,9 @@ def update( prompt_id: str, *, prompt: str, - set_as_default: bool, version: int, - variables: SequenceNotStr[str] | Omit = omit, + set_as_default: bool | Omit = omit, + variables: Optional[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, @@ -162,19 +158,12 @@ def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Prompt: - """Update prompt. + """ + Update prompt. Update an existing prompt (increments version). Args: - prompt: The updated prompt text content. - - set_as_default: Set the new version as the default (default=True). - - version: The current version of the prompt being updated. - - variables: Updated list of variable names that can be used in the prompt template. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -190,8 +179,8 @@ def update( body=maybe_transform( { "prompt": prompt, - "set_as_default": set_as_default, "version": version, + "set_as_default": set_as_default, "variables": variables, }, prompt_update_params.PromptUpdateParams, @@ -236,7 +225,8 @@ def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Delete prompt. + """ + Delete prompt. Delete a prompt. @@ -272,14 +262,12 @@ def set_default_version( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Prompt: - """Set prompt version. + """ + Set prompt version. - Set which version of a prompt should be the default in - get_prompt (latest). + Set which version of a prompt should be the default in get_prompt (latest). Args: - version: The version to set as default. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -328,7 +316,7 @@ async def create( self, *, prompt: str, - variables: SequenceNotStr[str] | Omit = omit, + variables: Optional[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, @@ -336,15 +324,12 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Prompt: - """Create prompt. + """ + Create prompt. Create a new prompt. Args: - prompt: The prompt text content with variable placeholders. - - variables: List of variable names that can be used in the prompt template. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -372,7 +357,7 @@ async def retrieve( self, prompt_id: str, *, - version: int | Omit = omit, + version: Optional[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, @@ -380,13 +365,12 @@ async def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Prompt: - """Get prompt. + """ + Get prompt. Get a prompt by its identifier and optional version. Args: - version: The version of the prompt to get (defaults to latest). - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -414,9 +398,9 @@ async def update( prompt_id: str, *, prompt: str, - set_as_default: bool, version: int, - variables: SequenceNotStr[str] | Omit = omit, + set_as_default: bool | Omit = omit, + variables: Optional[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, @@ -424,19 +408,12 @@ async def update( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Prompt: - """Update prompt. + """ + Update prompt. Update an existing prompt (increments version). Args: - prompt: The updated prompt text content. - - set_as_default: Set the new version as the default (default=True). - - version: The current version of the prompt being updated. - - variables: Updated list of variable names that can be used in the prompt template. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -452,8 +429,8 @@ async def update( body=await async_maybe_transform( { "prompt": prompt, - "set_as_default": set_as_default, "version": version, + "set_as_default": set_as_default, "variables": variables, }, prompt_update_params.PromptUpdateParams, @@ -498,7 +475,8 @@ async def delete( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Delete prompt. + """ + Delete prompt. Delete a prompt. @@ -534,14 +512,12 @@ async def set_default_version( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Prompt: - """Set prompt version. + """ + Set prompt version. - Set which version of a prompt should be the default in - get_prompt (latest). + Set which version of a prompt should be the default in get_prompt (latest). Args: - version: The version to set as default. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/llama_stack_client/resources/prompts/versions.py b/src/llama_stack_client/resources/prompts/versions.py index bf074dc7..4572bbd8 100644 --- a/src/llama_stack_client/resources/prompts/versions.py +++ b/src/llama_stack_client/resources/prompts/versions.py @@ -53,7 +53,8 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PromptListResponse: - """List prompt versions. + """ + List prompt versions. List all versions of a specific prompt. @@ -112,7 +113,8 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PromptListResponse: - """List prompt versions. + """ + List prompt versions. List all versions of a specific prompt. diff --git a/src/llama_stack_client/resources/providers.py b/src/llama_stack_client/resources/providers.py index 19222338..0a538c8c 100644 --- a/src/llama_stack_client/resources/providers.py +++ b/src/llama_stack_client/resources/providers.py @@ -60,7 +60,8 @@ def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProviderInfo: - """Get provider. + """ + Get provider. Get detailed information about a specific provider. @@ -93,7 +94,11 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProviderListResponse: - """List providers. List all available providers.""" + """ + List providers. + + List all available providers. + """ return self._get( "/v1/providers", options=make_request_options( @@ -138,7 +143,8 @@ async def retrieve( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProviderInfo: - """Get provider. + """ + Get provider. Get detailed information about a specific provider. @@ -171,7 +177,11 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ProviderListResponse: - """List providers. List all available providers.""" + """ + List providers. + + List all available providers. + """ return await self._get( "/v1/providers", options=make_request_options( diff --git a/src/llama_stack_client/resources/responses/input_items.py b/src/llama_stack_client/resources/responses/input_items.py index 6e802d13..be55b2c8 100644 --- a/src/llama_stack_client/resources/responses/input_items.py +++ b/src/llama_stack_client/resources/responses/input_items.py @@ -8,6 +8,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Literal import httpx @@ -53,11 +54,11 @@ def list( self, response_id: str, *, - after: str | Omit = omit, - before: str | Omit = omit, - include: SequenceNotStr[str] | Omit = omit, - limit: int | Omit = omit, - order: Literal["asc", "desc"] | Omit = omit, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + include: Optional[SequenceNotStr[str]] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[Literal["asc", "desc"]] | 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, @@ -69,16 +70,7 @@ def list( List input items. Args: - after: An item ID to list items after, used for pagination. - - before: An item ID to list items before, used for pagination. - - include: Additional fields to include in the response. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: The order to return the input items in. Default is desc. + order: Sort order for paginated responses. extra_headers: Send extra headers @@ -136,11 +128,11 @@ async def list( self, response_id: str, *, - after: str | Omit = omit, - before: str | Omit = omit, - include: SequenceNotStr[str] | Omit = omit, - limit: int | Omit = omit, - order: Literal["asc", "desc"] | Omit = omit, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + include: Optional[SequenceNotStr[str]] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[Literal["asc", "desc"]] | 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, @@ -152,16 +144,7 @@ async def list( List input items. Args: - after: An item ID to list items after, used for pagination. - - before: An item ID to list items before, used for pagination. - - include: Additional fields to include in the response. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: The order to return the input items in. Default is desc. + order: Sort order for paginated responses. extra_headers: Send extra headers diff --git a/src/llama_stack_client/resources/responses/responses.py b/src/llama_stack_client/resources/responses/responses.py index e20d567c..1813f94b 100644 --- a/src/llama_stack_client/resources/responses/responses.py +++ b/src/llama_stack_client/resources/responses/responses.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Union, Iterable +from typing import Union, Iterable, Optional from typing_extensions import Literal, overload import httpx @@ -71,20 +71,25 @@ def with_streaming_response(self) -> ResponsesResourceWithStreamingResponse: def create( self, *, - input: Union[str, Iterable[response_create_params.InputUnionMember1]], + input: Union[ + str, + Iterable[ + response_create_params.InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutput + ], + ], model: str, - conversation: str | Omit = omit, - include: SequenceNotStr[str] | Omit = omit, - instructions: str | Omit = omit, - max_infer_iters: int | Omit = omit, - max_tool_calls: int | Omit = omit, - previous_response_id: str | Omit = omit, - prompt: response_create_params.Prompt | Omit = omit, - store: bool | Omit = omit, - stream: Literal[False] | Omit = omit, - temperature: float | Omit = omit, - text: response_create_params.Text | Omit = omit, - tools: Iterable[response_create_params.Tool] | Omit = omit, + conversation: Optional[str] | Omit = omit, + include: Optional[SequenceNotStr[str]] | Omit = omit, + instructions: Optional[str] | Omit = omit, + max_infer_iters: Optional[int] | Omit = omit, + max_tool_calls: Optional[int] | Omit = omit, + previous_response_id: Optional[str] | Omit = omit, + prompt: Optional[response_create_params.Prompt] | Omit = omit, + store: Optional[bool] | Omit = omit, + stream: Optional[Literal[False]] | Omit = omit, + temperature: Optional[float] | Omit = omit, + text: Optional[response_create_params.Text] | Omit = omit, + tools: Optional[Iterable[response_create_params.Tool]] | 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, @@ -96,24 +101,7 @@ def create( Create a model response. Args: - input: Input message(s) to create the response. - - model: The underlying LLM used for completions. - - conversation: (Optional) The ID of a conversation to add the response to. Must begin with - 'conv\\__'. Input and output messages will be automatically added to the - conversation. - - include: (Optional) Additional fields to include in the response. - - max_tool_calls: (Optional) Max number of total calls to built-in tools that can be processed in - a response. - - previous_response_id: (Optional) if specified, the new response will be a continuation of the previous - response. This can be used to easily fork-off new responses from existing - responses. - - prompt: (Optional) Prompt object with ID, version, and variables. + prompt: OpenAI compatible Prompt object that is used in OpenAI responses. text: Text response configuration for OpenAI responses. @@ -131,20 +119,25 @@ def create( def create( self, *, - input: Union[str, Iterable[response_create_params.InputUnionMember1]], + input: Union[ + str, + Iterable[ + response_create_params.InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutput + ], + ], model: str, stream: Literal[True], - conversation: str | Omit = omit, - include: SequenceNotStr[str] | Omit = omit, - instructions: str | Omit = omit, - max_infer_iters: int | Omit = omit, - max_tool_calls: int | Omit = omit, - previous_response_id: str | Omit = omit, - prompt: response_create_params.Prompt | Omit = omit, - store: bool | Omit = omit, - temperature: float | Omit = omit, - text: response_create_params.Text | Omit = omit, - tools: Iterable[response_create_params.Tool] | Omit = omit, + conversation: Optional[str] | Omit = omit, + include: Optional[SequenceNotStr[str]] | Omit = omit, + instructions: Optional[str] | Omit = omit, + max_infer_iters: Optional[int] | Omit = omit, + max_tool_calls: Optional[int] | Omit = omit, + previous_response_id: Optional[str] | Omit = omit, + prompt: Optional[response_create_params.Prompt] | Omit = omit, + store: Optional[bool] | Omit = omit, + temperature: Optional[float] | Omit = omit, + text: Optional[response_create_params.Text] | Omit = omit, + tools: Optional[Iterable[response_create_params.Tool]] | 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, @@ -156,24 +149,7 @@ def create( Create a model response. Args: - input: Input message(s) to create the response. - - model: The underlying LLM used for completions. - - conversation: (Optional) The ID of a conversation to add the response to. Must begin with - 'conv\\__'. Input and output messages will be automatically added to the - conversation. - - include: (Optional) Additional fields to include in the response. - - max_tool_calls: (Optional) Max number of total calls to built-in tools that can be processed in - a response. - - previous_response_id: (Optional) if specified, the new response will be a continuation of the previous - response. This can be used to easily fork-off new responses from existing - responses. - - prompt: (Optional) Prompt object with ID, version, and variables. + prompt: OpenAI compatible Prompt object that is used in OpenAI responses. text: Text response configuration for OpenAI responses. @@ -191,20 +167,25 @@ def create( def create( self, *, - input: Union[str, Iterable[response_create_params.InputUnionMember1]], + input: Union[ + str, + Iterable[ + response_create_params.InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutput + ], + ], model: str, stream: bool, - conversation: str | Omit = omit, - include: SequenceNotStr[str] | Omit = omit, - instructions: str | Omit = omit, - max_infer_iters: int | Omit = omit, - max_tool_calls: int | Omit = omit, - previous_response_id: str | Omit = omit, - prompt: response_create_params.Prompt | Omit = omit, - store: bool | Omit = omit, - temperature: float | Omit = omit, - text: response_create_params.Text | Omit = omit, - tools: Iterable[response_create_params.Tool] | Omit = omit, + conversation: Optional[str] | Omit = omit, + include: Optional[SequenceNotStr[str]] | Omit = omit, + instructions: Optional[str] | Omit = omit, + max_infer_iters: Optional[int] | Omit = omit, + max_tool_calls: Optional[int] | Omit = omit, + previous_response_id: Optional[str] | Omit = omit, + prompt: Optional[response_create_params.Prompt] | Omit = omit, + store: Optional[bool] | Omit = omit, + temperature: Optional[float] | Omit = omit, + text: Optional[response_create_params.Text] | Omit = omit, + tools: Optional[Iterable[response_create_params.Tool]] | 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, @@ -216,24 +197,7 @@ def create( Create a model response. Args: - input: Input message(s) to create the response. - - model: The underlying LLM used for completions. - - conversation: (Optional) The ID of a conversation to add the response to. Must begin with - 'conv\\__'. Input and output messages will be automatically added to the - conversation. - - include: (Optional) Additional fields to include in the response. - - max_tool_calls: (Optional) Max number of total calls to built-in tools that can be processed in - a response. - - previous_response_id: (Optional) if specified, the new response will be a continuation of the previous - response. This can be used to easily fork-off new responses from existing - responses. - - prompt: (Optional) Prompt object with ID, version, and variables. + prompt: OpenAI compatible Prompt object that is used in OpenAI responses. text: Text response configuration for OpenAI responses. @@ -251,20 +215,25 @@ def create( def create( self, *, - input: Union[str, Iterable[response_create_params.InputUnionMember1]], + input: Union[ + str, + Iterable[ + response_create_params.InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutput + ], + ], model: str, - conversation: str | Omit = omit, - include: SequenceNotStr[str] | Omit = omit, - instructions: str | Omit = omit, - max_infer_iters: int | Omit = omit, - max_tool_calls: int | Omit = omit, - previous_response_id: str | Omit = omit, - prompt: response_create_params.Prompt | Omit = omit, - store: bool | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - temperature: float | Omit = omit, - text: response_create_params.Text | Omit = omit, - tools: Iterable[response_create_params.Tool] | Omit = omit, + conversation: Optional[str] | Omit = omit, + include: Optional[SequenceNotStr[str]] | Omit = omit, + instructions: Optional[str] | Omit = omit, + max_infer_iters: Optional[int] | Omit = omit, + max_tool_calls: Optional[int] | Omit = omit, + previous_response_id: Optional[str] | Omit = omit, + prompt: Optional[response_create_params.Prompt] | Omit = omit, + store: Optional[bool] | Omit = omit, + stream: Optional[Literal[False]] | Literal[True] | Omit = omit, + temperature: Optional[float] | Omit = omit, + text: Optional[response_create_params.Text] | Omit = omit, + tools: Optional[Iterable[response_create_params.Tool]] | 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, @@ -339,10 +308,10 @@ def retrieve( def list( self, *, - after: str | Omit = omit, - limit: int | Omit = omit, - model: str | Omit = omit, - order: Literal["asc", "desc"] | Omit = omit, + after: Optional[str] | Omit = omit, + limit: Optional[int] | Omit = omit, + model: Optional[str] | Omit = omit, + order: Optional[Literal["asc", "desc"]] | 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, @@ -354,13 +323,7 @@ def list( List all responses. Args: - after: The ID of the last response to return. - - limit: The number of responses to return. - - model: The model to filter responses by. - - order: The order to sort responses by when sorted by created_at ('asc' or 'desc'). + order: Sort order for paginated responses. extra_headers: Send extra headers @@ -453,20 +416,25 @@ def with_streaming_response(self) -> AsyncResponsesResourceWithStreamingResponse async def create( self, *, - input: Union[str, Iterable[response_create_params.InputUnionMember1]], + input: Union[ + str, + Iterable[ + response_create_params.InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutput + ], + ], model: str, - conversation: str | Omit = omit, - include: SequenceNotStr[str] | Omit = omit, - instructions: str | Omit = omit, - max_infer_iters: int | Omit = omit, - max_tool_calls: int | Omit = omit, - previous_response_id: str | Omit = omit, - prompt: response_create_params.Prompt | Omit = omit, - store: bool | Omit = omit, - stream: Literal[False] | Omit = omit, - temperature: float | Omit = omit, - text: response_create_params.Text | Omit = omit, - tools: Iterable[response_create_params.Tool] | Omit = omit, + conversation: Optional[str] | Omit = omit, + include: Optional[SequenceNotStr[str]] | Omit = omit, + instructions: Optional[str] | Omit = omit, + max_infer_iters: Optional[int] | Omit = omit, + max_tool_calls: Optional[int] | Omit = omit, + previous_response_id: Optional[str] | Omit = omit, + prompt: Optional[response_create_params.Prompt] | Omit = omit, + store: Optional[bool] | Omit = omit, + stream: Optional[Literal[False]] | Omit = omit, + temperature: Optional[float] | Omit = omit, + text: Optional[response_create_params.Text] | Omit = omit, + tools: Optional[Iterable[response_create_params.Tool]] | 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, @@ -478,24 +446,7 @@ async def create( Create a model response. Args: - input: Input message(s) to create the response. - - model: The underlying LLM used for completions. - - conversation: (Optional) The ID of a conversation to add the response to. Must begin with - 'conv\\__'. Input and output messages will be automatically added to the - conversation. - - include: (Optional) Additional fields to include in the response. - - max_tool_calls: (Optional) Max number of total calls to built-in tools that can be processed in - a response. - - previous_response_id: (Optional) if specified, the new response will be a continuation of the previous - response. This can be used to easily fork-off new responses from existing - responses. - - prompt: (Optional) Prompt object with ID, version, and variables. + prompt: OpenAI compatible Prompt object that is used in OpenAI responses. text: Text response configuration for OpenAI responses. @@ -513,20 +464,25 @@ async def create( async def create( self, *, - input: Union[str, Iterable[response_create_params.InputUnionMember1]], + input: Union[ + str, + Iterable[ + response_create_params.InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutput + ], + ], model: str, stream: Literal[True], - conversation: str | Omit = omit, - include: SequenceNotStr[str] | Omit = omit, - instructions: str | Omit = omit, - max_infer_iters: int | Omit = omit, - max_tool_calls: int | Omit = omit, - previous_response_id: str | Omit = omit, - prompt: response_create_params.Prompt | Omit = omit, - store: bool | Omit = omit, - temperature: float | Omit = omit, - text: response_create_params.Text | Omit = omit, - tools: Iterable[response_create_params.Tool] | Omit = omit, + conversation: Optional[str] | Omit = omit, + include: Optional[SequenceNotStr[str]] | Omit = omit, + instructions: Optional[str] | Omit = omit, + max_infer_iters: Optional[int] | Omit = omit, + max_tool_calls: Optional[int] | Omit = omit, + previous_response_id: Optional[str] | Omit = omit, + prompt: Optional[response_create_params.Prompt] | Omit = omit, + store: Optional[bool] | Omit = omit, + temperature: Optional[float] | Omit = omit, + text: Optional[response_create_params.Text] | Omit = omit, + tools: Optional[Iterable[response_create_params.Tool]] | 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, @@ -538,24 +494,7 @@ async def create( Create a model response. Args: - input: Input message(s) to create the response. - - model: The underlying LLM used for completions. - - conversation: (Optional) The ID of a conversation to add the response to. Must begin with - 'conv\\__'. Input and output messages will be automatically added to the - conversation. - - include: (Optional) Additional fields to include in the response. - - max_tool_calls: (Optional) Max number of total calls to built-in tools that can be processed in - a response. - - previous_response_id: (Optional) if specified, the new response will be a continuation of the previous - response. This can be used to easily fork-off new responses from existing - responses. - - prompt: (Optional) Prompt object with ID, version, and variables. + prompt: OpenAI compatible Prompt object that is used in OpenAI responses. text: Text response configuration for OpenAI responses. @@ -573,20 +512,25 @@ async def create( async def create( self, *, - input: Union[str, Iterable[response_create_params.InputUnionMember1]], + input: Union[ + str, + Iterable[ + response_create_params.InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutput + ], + ], model: str, stream: bool, - conversation: str | Omit = omit, - include: SequenceNotStr[str] | Omit = omit, - instructions: str | Omit = omit, - max_infer_iters: int | Omit = omit, - max_tool_calls: int | Omit = omit, - previous_response_id: str | Omit = omit, - prompt: response_create_params.Prompt | Omit = omit, - store: bool | Omit = omit, - temperature: float | Omit = omit, - text: response_create_params.Text | Omit = omit, - tools: Iterable[response_create_params.Tool] | Omit = omit, + conversation: Optional[str] | Omit = omit, + include: Optional[SequenceNotStr[str]] | Omit = omit, + instructions: Optional[str] | Omit = omit, + max_infer_iters: Optional[int] | Omit = omit, + max_tool_calls: Optional[int] | Omit = omit, + previous_response_id: Optional[str] | Omit = omit, + prompt: Optional[response_create_params.Prompt] | Omit = omit, + store: Optional[bool] | Omit = omit, + temperature: Optional[float] | Omit = omit, + text: Optional[response_create_params.Text] | Omit = omit, + tools: Optional[Iterable[response_create_params.Tool]] | 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, @@ -598,24 +542,7 @@ async def create( Create a model response. Args: - input: Input message(s) to create the response. - - model: The underlying LLM used for completions. - - conversation: (Optional) The ID of a conversation to add the response to. Must begin with - 'conv\\__'. Input and output messages will be automatically added to the - conversation. - - include: (Optional) Additional fields to include in the response. - - max_tool_calls: (Optional) Max number of total calls to built-in tools that can be processed in - a response. - - previous_response_id: (Optional) if specified, the new response will be a continuation of the previous - response. This can be used to easily fork-off new responses from existing - responses. - - prompt: (Optional) Prompt object with ID, version, and variables. + prompt: OpenAI compatible Prompt object that is used in OpenAI responses. text: Text response configuration for OpenAI responses. @@ -633,20 +560,25 @@ async def create( async def create( self, *, - input: Union[str, Iterable[response_create_params.InputUnionMember1]], + input: Union[ + str, + Iterable[ + response_create_params.InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutput + ], + ], model: str, - conversation: str | Omit = omit, - include: SequenceNotStr[str] | Omit = omit, - instructions: str | Omit = omit, - max_infer_iters: int | Omit = omit, - max_tool_calls: int | Omit = omit, - previous_response_id: str | Omit = omit, - prompt: response_create_params.Prompt | Omit = omit, - store: bool | Omit = omit, - stream: Literal[False] | Literal[True] | Omit = omit, - temperature: float | Omit = omit, - text: response_create_params.Text | Omit = omit, - tools: Iterable[response_create_params.Tool] | Omit = omit, + conversation: Optional[str] | Omit = omit, + include: Optional[SequenceNotStr[str]] | Omit = omit, + instructions: Optional[str] | Omit = omit, + max_infer_iters: Optional[int] | Omit = omit, + max_tool_calls: Optional[int] | Omit = omit, + previous_response_id: Optional[str] | Omit = omit, + prompt: Optional[response_create_params.Prompt] | Omit = omit, + store: Optional[bool] | Omit = omit, + stream: Optional[Literal[False]] | Literal[True] | Omit = omit, + temperature: Optional[float] | Omit = omit, + text: Optional[response_create_params.Text] | Omit = omit, + tools: Optional[Iterable[response_create_params.Tool]] | 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, @@ -721,10 +653,10 @@ async def retrieve( def list( self, *, - after: str | Omit = omit, - limit: int | Omit = omit, - model: str | Omit = omit, - order: Literal["asc", "desc"] | Omit = omit, + after: Optional[str] | Omit = omit, + limit: Optional[int] | Omit = omit, + model: Optional[str] | Omit = omit, + order: Optional[Literal["asc", "desc"]] | 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, @@ -736,13 +668,7 @@ def list( List all responses. Args: - after: The ID of the last response to return. - - limit: The number of responses to return. - - model: The model to filter responses by. - - order: The order to sort responses by when sorted by created_at ('asc' or 'desc'). + order: Sort order for paginated responses. extra_headers: Send extra headers diff --git a/src/llama_stack_client/resources/routes.py b/src/llama_stack_client/resources/routes.py index 3f1927fe..c8e93cfd 100644 --- a/src/llama_stack_client/resources/routes.py +++ b/src/llama_stack_client/resources/routes.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast from typing_extensions import Literal import httpx @@ -54,7 +54,7 @@ def with_streaming_response(self) -> RoutesResourceWithStreamingResponse: def list( self, *, - api_filter: Literal["v1", "v1alpha", "v1beta", "deprecated"] | Omit = omit, + api_filter: Optional[Literal["v1", "v1alpha", "v1beta", "deprecated"]] | 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, @@ -62,17 +62,12 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RouteListResponse: - """List routes. + """ + List routes. - List all available API routes with their methods and implementing - providers. + List all available API routes with their methods and implementing providers. Args: - api_filter: Optional filter to control which routes are returned. Can be an API level ('v1', - 'v1alpha', 'v1beta') to show non-deprecated routes at that level, or - 'deprecated' to show deprecated routes across all levels. If not specified, - returns all non-deprecated routes. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -118,7 +113,7 @@ def with_streaming_response(self) -> AsyncRoutesResourceWithStreamingResponse: async def list( self, *, - api_filter: Literal["v1", "v1alpha", "v1beta", "deprecated"] | Omit = omit, + api_filter: Optional[Literal["v1", "v1alpha", "v1beta", "deprecated"]] | 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, @@ -126,17 +121,12 @@ async def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RouteListResponse: - """List routes. + """ + List routes. - List all available API routes with their methods and implementing - providers. + List all available API routes with their methods and implementing providers. Args: - api_filter: Optional filter to control which routes are returned. Can be an API level ('v1', - 'v1alpha', 'v1beta') to show non-deprecated routes at that level, or - 'deprecated' to show deprecated routes across all levels. If not specified, - returns all non-deprecated routes. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/llama_stack_client/resources/safety.py b/src/llama_stack_client/resources/safety.py index 77972161..c40b8026 100644 --- a/src/llama_stack_client/resources/safety.py +++ b/src/llama_stack_client/resources/safety.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Iterable import httpx @@ -53,7 +53,7 @@ def run_shield( self, *, messages: Iterable[safety_run_shield_params.Message], - params: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + params: Dict[str, object], shield_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. @@ -62,17 +62,12 @@ def run_shield( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RunShieldResponse: - """Run shield. + """ + Run shield. Run a shield. Args: - messages: The messages to run the shield on. - - params: The parameters of the shield. - - shield_id: The identifier of the shield to run. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -122,7 +117,7 @@ async def run_shield( self, *, messages: Iterable[safety_run_shield_params.Message], - params: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + params: Dict[str, object], shield_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. @@ -131,17 +126,12 @@ async def run_shield( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RunShieldResponse: - """Run shield. + """ + Run shield. Run a shield. Args: - messages: The messages to run the shield on. - - params: The parameters of the shield. - - shield_id: The identifier of the shield to run. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/llama_stack_client/resources/scoring.py b/src/llama_stack_client/resources/scoring.py index 171cabaf..1a4a2dbf 100644 --- a/src/llama_stack_client/resources/scoring.py +++ b/src/llama_stack_client/resources/scoring.py @@ -8,12 +8,12 @@ from __future__ import annotations -from typing import Dict, Union, Iterable, Optional +from typing import Dict, Iterable, Optional import httpx from ..types import scoring_score_params, scoring_score_batch_params -from .._types import Body, Query, Headers, NotGiven, not_given +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource @@ -25,7 +25,6 @@ ) 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"] @@ -54,8 +53,8 @@ def with_streaming_response(self) -> ScoringResourceWithStreamingResponse: def score( self, *, - input_rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], - scoring_functions: Dict[str, Optional[ScoringFnParamsParam]], + input_rows: Iterable[Dict[str, object]], + scoring_functions: Dict[str, Optional[scoring_score_params.ScoringFunctions]], # 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, @@ -67,10 +66,6 @@ def score( Score a list of rows. Args: - input_rows: The rows to score. - - scoring_functions: The scoring functions to use for the scoring. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -98,8 +93,8 @@ def score_batch( self, *, dataset_id: str, - save_results_dataset: bool, - scoring_functions: Dict[str, Optional[ScoringFnParamsParam]], + scoring_functions: Dict[str, Optional[scoring_score_batch_params.ScoringFunctions]], + save_results_dataset: bool | 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, @@ -111,12 +106,6 @@ def score_batch( Score a batch of rows. Args: - dataset_id: The ID of the dataset to score. - - save_results_dataset: Whether to save the results to a dataset. - - scoring_functions: The scoring functions to use for the scoring. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -130,8 +119,8 @@ def score_batch( body=maybe_transform( { "dataset_id": dataset_id, - "save_results_dataset": save_results_dataset, "scoring_functions": scoring_functions, + "save_results_dataset": save_results_dataset, }, scoring_score_batch_params.ScoringScoreBatchParams, ), @@ -165,8 +154,8 @@ def with_streaming_response(self) -> AsyncScoringResourceWithStreamingResponse: async def score( self, *, - input_rows: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]], - scoring_functions: Dict[str, Optional[ScoringFnParamsParam]], + input_rows: Iterable[Dict[str, object]], + scoring_functions: Dict[str, Optional[scoring_score_params.ScoringFunctions]], # 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, @@ -178,10 +167,6 @@ async def score( Score a list of rows. Args: - input_rows: The rows to score. - - scoring_functions: The scoring functions to use for the scoring. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -209,8 +194,8 @@ async def score_batch( self, *, dataset_id: str, - save_results_dataset: bool, - scoring_functions: Dict[str, Optional[ScoringFnParamsParam]], + scoring_functions: Dict[str, Optional[scoring_score_batch_params.ScoringFunctions]], + save_results_dataset: bool | 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, @@ -222,12 +207,6 @@ async def score_batch( Score a batch of rows. Args: - dataset_id: The ID of the dataset to score. - - save_results_dataset: Whether to save the results to a dataset. - - scoring_functions: The scoring functions to use for the scoring. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -241,8 +220,8 @@ async def score_batch( body=await async_maybe_transform( { "dataset_id": dataset_id, - "save_results_dataset": save_results_dataset, "scoring_functions": scoring_functions, + "save_results_dataset": save_results_dataset, }, scoring_score_batch_params.ScoringScoreBatchParams, ), diff --git a/src/llama_stack_client/resources/scoring_functions.py b/src/llama_stack_client/resources/scoring_functions.py index 2a391a4f..ed341614 100644 --- a/src/llama_stack_client/resources/scoring_functions.py +++ b/src/llama_stack_client/resources/scoring_functions.py @@ -27,7 +27,6 @@ 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.scoring_function_list_response import ScoringFunctionListResponse __all__ = ["ScoringFunctionsResource", "AsyncScoringFunctionsResource"] @@ -113,12 +112,12 @@ def list( def register( self, *, - description: str, - return_type: scoring_function_register_params.ReturnType, - scoring_fn_id: str, - params: ScoringFnParamsParam | Omit = omit, - provider_id: str | Omit = omit, - provider_scoring_fn_id: str | Omit = omit, + description: object, + return_type: object, + scoring_fn_id: object, + params: object | Omit = omit, + provider_id: object | Omit = omit, + provider_scoring_fn_id: object | 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, @@ -130,17 +129,6 @@ def register( Register a scoring function. Args: - description: The description of the scoring function. - - scoring_fn_id: The ID of the scoring function to register. - - params: The parameters for the scoring function for benchmark eval, these can be - overridden for app eval. - - provider_id: The ID of the provider to use for the scoring function. - - provider_scoring_fn_id: The ID of the provider scoring function to use for the scoring function. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -169,6 +157,41 @@ def register( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") + def unregister( + self, + scoring_fn_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: + """ + Unregister a scoring function. + + 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 scoring_fn_id: + raise ValueError(f"Expected a non-empty value for `scoring_fn_id` but received {scoring_fn_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return self._delete( + f"/v1/scoring-functions/{scoring_fn_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + class AsyncScoringFunctionsResource(AsyncAPIResource): @cached_property @@ -250,12 +273,12 @@ async def list( async def register( self, *, - description: str, - return_type: scoring_function_register_params.ReturnType, - scoring_fn_id: str, - params: ScoringFnParamsParam | Omit = omit, - provider_id: str | Omit = omit, - provider_scoring_fn_id: str | Omit = omit, + description: object, + return_type: object, + scoring_fn_id: object, + params: object | Omit = omit, + provider_id: object | Omit = omit, + provider_scoring_fn_id: object | 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, @@ -267,17 +290,6 @@ async def register( Register a scoring function. Args: - description: The description of the scoring function. - - scoring_fn_id: The ID of the scoring function to register. - - params: The parameters for the scoring function for benchmark eval, these can be - overridden for app eval. - - provider_id: The ID of the provider to use for the scoring function. - - provider_scoring_fn_id: The ID of the provider scoring function to use for the scoring function. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -306,6 +318,41 @@ async def register( cast_to=NoneType, ) + @typing_extensions.deprecated("deprecated") + async def unregister( + self, + scoring_fn_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: + """ + Unregister a scoring function. + + 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 scoring_fn_id: + raise ValueError(f"Expected a non-empty value for `scoring_fn_id` but received {scoring_fn_id!r}") + extra_headers = {"Accept": "*/*", **(extra_headers or {})} + return await self._delete( + f"/v1/scoring-functions/{scoring_fn_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=NoneType, + ) + class ScoringFunctionsResourceWithRawResponse: def __init__(self, scoring_functions: ScoringFunctionsResource) -> None: @@ -322,6 +369,11 @@ def __init__(self, scoring_functions: ScoringFunctionsResource) -> None: scoring_functions.register, # pyright: ignore[reportDeprecated], ) ) + self.unregister = ( # pyright: ignore[reportDeprecated] + to_raw_response_wrapper( + scoring_functions.unregister, # pyright: ignore[reportDeprecated], + ) + ) class AsyncScoringFunctionsResourceWithRawResponse: @@ -339,6 +391,11 @@ def __init__(self, scoring_functions: AsyncScoringFunctionsResource) -> None: scoring_functions.register, # pyright: ignore[reportDeprecated], ) ) + self.unregister = ( # pyright: ignore[reportDeprecated] + async_to_raw_response_wrapper( + scoring_functions.unregister, # pyright: ignore[reportDeprecated], + ) + ) class ScoringFunctionsResourceWithStreamingResponse: @@ -356,6 +413,11 @@ def __init__(self, scoring_functions: ScoringFunctionsResource) -> None: scoring_functions.register, # pyright: ignore[reportDeprecated], ) ) + self.unregister = ( # pyright: ignore[reportDeprecated] + to_streamed_response_wrapper( + scoring_functions.unregister, # pyright: ignore[reportDeprecated], + ) + ) class AsyncScoringFunctionsResourceWithStreamingResponse: @@ -373,3 +435,8 @@ def __init__(self, scoring_functions: AsyncScoringFunctionsResource) -> None: scoring_functions.register, # pyright: ignore[reportDeprecated], ) ) + self.unregister = ( # pyright: ignore[reportDeprecated] + async_to_streamed_response_wrapper( + scoring_functions.unregister, # pyright: ignore[reportDeprecated], + ) + ) diff --git a/src/llama_stack_client/resources/shields.py b/src/llama_stack_client/resources/shields.py index ee548579..a1fe320c 100644 --- a/src/llama_stack_client/resources/shields.py +++ b/src/llama_stack_client/resources/shields.py @@ -9,7 +9,7 @@ from __future__ import annotations import typing_extensions -from typing import Dict, Type, Union, Iterable, cast +from typing import Dict, Type, Optional, cast import httpx @@ -148,9 +148,9 @@ def register( self, *, shield_id: str, - params: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - provider_id: str | Omit = omit, - provider_shield_id: str | Omit = omit, + params: Optional[Dict[str, object]] | Omit = omit, + provider_id: Optional[str] | Omit = omit, + provider_shield_id: Optional[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, @@ -162,14 +162,6 @@ def register( Register a shield. Args: - shield_id: The identifier of the shield to register. - - params: The parameters of the shield. - - provider_id: The identifier of the provider. - - provider_shield_id: The identifier of the shield in the provider. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -312,9 +304,9 @@ async def register( self, *, shield_id: str, - params: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - provider_id: str | Omit = omit, - provider_shield_id: str | Omit = omit, + params: Optional[Dict[str, object]] | Omit = omit, + provider_id: Optional[str] | Omit = omit, + provider_shield_id: Optional[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, @@ -326,14 +318,6 @@ async def register( Register a shield. Args: - shield_id: The identifier of the shield to register. - - params: The parameters of the shield. - - provider_id: The identifier of the provider. - - provider_shield_id: The identifier of the shield in the provider. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/llama_stack_client/resources/tool_runtime/tool_runtime.py b/src/llama_stack_client/resources/tool_runtime.py similarity index 82% rename from src/llama_stack_client/resources/tool_runtime/tool_runtime.py rename to src/llama_stack_client/resources/tool_runtime.py index 4acc4e96..cd510071 100644 --- a/src/llama_stack_client/resources/tool_runtime/tool_runtime.py +++ b/src/llama_stack_client/resources/tool_runtime.py @@ -8,25 +8,25 @@ from __future__ import annotations -from typing import Dict, Type, Union, Iterable, cast +from typing import Dict, Type, Optional, cast import httpx -from ...types import tool_runtime_list_tools_params, tool_runtime_invoke_tool_params -from ..._types import Body, Omit, Query, Headers, 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 ( +from ..types import tool_runtime_list_tools_params, tool_runtime_invoke_tool_params +from .._types import Body, Omit, Query, Headers, 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 ..._wrappers import DataWrapper -from ..._base_client import make_request_options -from ...types.tool_invocation_result import ToolInvocationResult -from ...types.tool_runtime_list_tools_response import ToolRuntimeListToolsResponse +from .._wrappers import DataWrapper +from .._base_client import make_request_options +from ..types.tool_invocation_result import ToolInvocationResult +from ..types.tool_runtime_list_tools_response import ToolRuntimeListToolsResponse __all__ = ["ToolRuntimeResource", "AsyncToolRuntimeResource"] @@ -54,9 +54,9 @@ def with_streaming_response(self) -> ToolRuntimeResourceWithStreamingResponse: def invoke_tool( self, *, - kwargs: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + kwargs: Dict[str, object], tool_name: str, - authorization: str | Omit = omit, + authorization: Optional[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, @@ -68,12 +68,6 @@ def invoke_tool( Run a tool with the given arguments. Args: - kwargs: A dictionary of arguments to pass to the tool. - - tool_name: The name of the tool to invoke. - - authorization: (Optional) OAuth access token for authenticating with the MCP server. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -101,9 +95,9 @@ def invoke_tool( def list_tools( self, *, - authorization: str | Omit = omit, - mcp_endpoint: tool_runtime_list_tools_params.McpEndpoint | Omit = omit, - tool_group_id: str | Omit = omit, + authorization: Optional[str] | Omit = omit, + mcp_endpoint: Optional[tool_runtime_list_tools_params.McpEndpoint] | Omit = omit, + tool_group_id: Optional[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, @@ -115,11 +109,7 @@ def list_tools( List all tools in the runtime. Args: - authorization: (Optional) OAuth access token for authenticating with the MCP server. - - mcp_endpoint: The MCP endpoint to use for the tool group. - - tool_group_id: The ID of the tool group to list tools for. + mcp_endpoint: A URL reference to external content. extra_headers: Send extra headers @@ -173,9 +163,9 @@ def with_streaming_response(self) -> AsyncToolRuntimeResourceWithStreamingRespon async def invoke_tool( self, *, - kwargs: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + kwargs: Dict[str, object], tool_name: str, - authorization: str | Omit = omit, + authorization: Optional[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, @@ -187,12 +177,6 @@ async def invoke_tool( Run a tool with the given arguments. Args: - kwargs: A dictionary of arguments to pass to the tool. - - tool_name: The name of the tool to invoke. - - authorization: (Optional) OAuth access token for authenticating with the MCP server. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -220,9 +204,9 @@ async def invoke_tool( async def list_tools( self, *, - authorization: str | Omit = omit, - mcp_endpoint: tool_runtime_list_tools_params.McpEndpoint | Omit = omit, - tool_group_id: str | Omit = omit, + authorization: Optional[str] | Omit = omit, + mcp_endpoint: Optional[tool_runtime_list_tools_params.McpEndpoint] | Omit = omit, + tool_group_id: Optional[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, @@ -234,11 +218,7 @@ async def list_tools( List all tools in the runtime. Args: - authorization: (Optional) OAuth access token for authenticating with the MCP server. - - mcp_endpoint: The MCP endpoint to use for the tool group. - - tool_group_id: The ID of the tool group to list tools for. + mcp_endpoint: A URL reference to external content. extra_headers: Send extra headers diff --git a/src/llama_stack_client/resources/tool_runtime/__init__.py b/src/llama_stack_client/resources/tool_runtime/__init__.py deleted file mode 100644 index f1af9e74..00000000 --- a/src/llama_stack_client/resources/tool_runtime/__init__.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 .tool_runtime import ( - ToolRuntimeResource, - AsyncToolRuntimeResource, - ToolRuntimeResourceWithRawResponse, - AsyncToolRuntimeResourceWithRawResponse, - ToolRuntimeResourceWithStreamingResponse, - AsyncToolRuntimeResourceWithStreamingResponse, -) - -__all__ = [ - "ToolRuntimeResource", - "AsyncToolRuntimeResource", - "ToolRuntimeResourceWithRawResponse", - "AsyncToolRuntimeResourceWithRawResponse", - "ToolRuntimeResourceWithStreamingResponse", - "AsyncToolRuntimeResourceWithStreamingResponse", -] diff --git a/src/llama_stack_client/resources/toolgroups.py b/src/llama_stack_client/resources/toolgroups.py index 41e3ca42..14a7a0bd 100644 --- a/src/llama_stack_client/resources/toolgroups.py +++ b/src/llama_stack_client/resources/toolgroups.py @@ -9,7 +9,7 @@ from __future__ import annotations import typing_extensions -from typing import Dict, Type, Union, Iterable, cast +from typing import Dict, Type, Optional, cast import httpx @@ -114,8 +114,8 @@ def register( *, provider_id: str, toolgroup_id: str, - args: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - mcp_endpoint: toolgroup_register_params.McpEndpoint | Omit = omit, + args: Optional[Dict[str, object]] | Omit = omit, + mcp_endpoint: Optional[toolgroup_register_params.McpEndpoint] | 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, @@ -127,13 +127,7 @@ def register( Register a tool group. Args: - provider_id: The ID of the provider to use for the tool group. - - toolgroup_id: The ID of the tool group to register. - - args: A dictionary of arguments to pass to the tool group. - - mcp_endpoint: The MCP endpoint to use for the tool group. + mcp_endpoint: A URL reference to external content. extra_headers: Send extra headers @@ -279,8 +273,8 @@ async def register( *, provider_id: str, toolgroup_id: str, - args: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - mcp_endpoint: toolgroup_register_params.McpEndpoint | Omit = omit, + args: Optional[Dict[str, object]] | Omit = omit, + mcp_endpoint: Optional[toolgroup_register_params.McpEndpoint] | 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, @@ -292,13 +286,7 @@ async def register( Register a tool group. Args: - provider_id: The ID of the provider to use for the tool group. - - toolgroup_id: The ID of the tool group to register. - - args: A dictionary of arguments to pass to the tool group. - - mcp_endpoint: The MCP endpoint to use for the tool group. + mcp_endpoint: A URL reference to external content. extra_headers: Send extra headers diff --git a/src/llama_stack_client/resources/tools.py b/src/llama_stack_client/resources/tools.py index e1a159eb..9da425b7 100644 --- a/src/llama_stack_client/resources/tools.py +++ b/src/llama_stack_client/resources/tools.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Type, cast +from typing import Type, Optional, cast import httpx @@ -54,7 +54,7 @@ def with_streaming_response(self) -> ToolsResourceWithStreamingResponse: def list( self, *, - toolgroup_id: str | Omit = omit, + toolgroup_id: Optional[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, @@ -66,8 +66,6 @@ def list( List tools with optional tool group. Args: - toolgroup_id: The ID of the tool group to list tools for. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -146,7 +144,7 @@ def with_streaming_response(self) -> AsyncToolsResourceWithStreamingResponse: async def list( self, *, - toolgroup_id: str | Omit = omit, + toolgroup_id: Optional[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, @@ -158,8 +156,6 @@ async def list( List tools with optional tool group. Args: - toolgroup_id: The ID of the tool group to list tools for. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/llama_stack_client/resources/vector_io.py b/src/llama_stack_client/resources/vector_io.py index dda04f33..d0938243 100644 --- a/src/llama_stack_client/resources/vector_io.py +++ b/src/llama_stack_client/resources/vector_io.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Iterable, Optional import httpx @@ -25,7 +25,6 @@ ) from .._base_client import make_request_options from ..types.query_chunks_response import QueryChunksResponse -from ..types.shared_params.interleaved_content import InterleavedContent __all__ = ["VectorIoResource", "AsyncVectorIoResource"] @@ -55,7 +54,7 @@ def insert( *, chunks: Iterable[vector_io_insert_params.Chunk], vector_store_id: str, - ttl_seconds: int | Omit = omit, + ttl_seconds: Optional[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, @@ -63,21 +62,10 @@ def insert( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Insert chunks into a vector database. + """ + Insert chunks into a vector database. Args: - chunks: The chunks to insert. - - Each `Chunk` should contain content which can be - interleaved text, images, or other types. `metadata`: `dict[str, Any]` and - `embedding`: `List[float]` are optional. If `metadata` is provided, you - configure how Llama Stack formats the chunk during generation. If `embedding` is - not provided, it will be computed later. - - vector_store_id: The identifier of the vector database to insert the chunks into. - - ttl_seconds: The time to live of the chunks. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -106,9 +94,9 @@ def insert( def query( self, *, - query: InterleavedContent, + query: vector_io_query_params.Query, vector_store_id: str, - params: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, + params: Optional[Dict[str, object]] | 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, @@ -120,11 +108,7 @@ def query( Query chunks from a vector database. Args: - query: The query to search for. - - vector_store_id: The identifier of the vector database to query. - - params: The parameters of the query. + query: A image content item extra_headers: Send extra headers @@ -176,7 +160,7 @@ async def insert( *, chunks: Iterable[vector_io_insert_params.Chunk], vector_store_id: str, - ttl_seconds: int | Omit = omit, + ttl_seconds: Optional[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, @@ -184,21 +168,10 @@ async def insert( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> None: - """Insert chunks into a vector database. + """ + Insert chunks into a vector database. Args: - chunks: The chunks to insert. - - Each `Chunk` should contain content which can be - interleaved text, images, or other types. `metadata`: `dict[str, Any]` and - `embedding`: `List[float]` are optional. If `metadata` is provided, you - configure how Llama Stack formats the chunk during generation. If `embedding` is - not provided, it will be computed later. - - vector_store_id: The identifier of the vector database to insert the chunks into. - - ttl_seconds: The time to live of the chunks. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -227,9 +200,9 @@ async def insert( async def query( self, *, - query: InterleavedContent, + query: vector_io_query_params.Query, vector_store_id: str, - params: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, + params: Optional[Dict[str, object]] | 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, @@ -241,11 +214,7 @@ async def query( Query chunks from a vector database. Args: - query: The query to search for. - - vector_store_id: The identifier of the vector database to query. - - params: The parameters of the query. + query: A image content item extra_headers: Send extra headers diff --git a/src/llama_stack_client/resources/vector_stores/file_batches.py b/src/llama_stack_client/resources/vector_stores/file_batches.py index adf80ccc..2ec2caa4 100644 --- a/src/llama_stack_client/resources/vector_stores/file_batches.py +++ b/src/llama_stack_client/resources/vector_stores/file_batches.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Optional import httpx @@ -56,8 +56,8 @@ def create( vector_store_id: str, *, file_ids: SequenceNotStr[str], - attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - chunking_strategy: file_batch_create_params.ChunkingStrategy | Omit = omit, + attributes: Optional[Dict[str, object]] | Omit = omit, + chunking_strategy: Optional[file_batch_create_params.ChunkingStrategy] | 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, @@ -65,17 +65,14 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VectorStoreFileBatches: - """Create a vector store file batch. + """ + Create a vector store file batch. - Generate an OpenAI-compatible vector store - file batch for the given vector store. + Generate an OpenAI-compatible vector store file batch for the given vector + store. Args: - file_ids: A list of File IDs that the vector store should use - - attributes: (Optional) Key-value attributes to store with the files - - chunking_strategy: (Optional) The chunking strategy used to chunk the file(s). Defaults to auto + chunking_strategy: Automatic chunking strategy for vector store files. extra_headers: Send extra headers @@ -180,11 +177,11 @@ def list_files( batch_id: str, *, vector_store_id: str, - after: str | Omit = omit, - before: str | Omit = omit, - filter: str | Omit = omit, - limit: int | Omit = omit, - order: str | Omit = omit, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + filter: Optional[str] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[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, @@ -196,20 +193,6 @@ def list_files( Returns a list of vector store files in a batch. Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. - - filter: Filter by file status. One of in_progress, completed, failed, cancelled. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -270,8 +253,8 @@ async def create( vector_store_id: str, *, file_ids: SequenceNotStr[str], - attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - chunking_strategy: file_batch_create_params.ChunkingStrategy | Omit = omit, + attributes: Optional[Dict[str, object]] | Omit = omit, + chunking_strategy: Optional[file_batch_create_params.ChunkingStrategy] | 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, @@ -279,17 +262,14 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VectorStoreFileBatches: - """Create a vector store file batch. + """ + Create a vector store file batch. - Generate an OpenAI-compatible vector store - file batch for the given vector store. + Generate an OpenAI-compatible vector store file batch for the given vector + store. Args: - file_ids: A list of File IDs that the vector store should use - - attributes: (Optional) Key-value attributes to store with the files - - chunking_strategy: (Optional) The chunking strategy used to chunk the file(s). Defaults to auto + chunking_strategy: Automatic chunking strategy for vector store files. extra_headers: Send extra headers @@ -394,11 +374,11 @@ def list_files( batch_id: str, *, vector_store_id: str, - after: str | Omit = omit, - before: str | Omit = omit, - filter: str | Omit = omit, - limit: int | Omit = omit, - order: str | Omit = omit, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + filter: Optional[str] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[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, @@ -410,20 +390,6 @@ def list_files( Returns a list of vector store files in a batch. Args: - after: A cursor for use in pagination. `after` is an object ID that defines your place - in the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. - - filter: Filter by file status. One of in_progress, completed, failed, cancelled. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/llama_stack_client/resources/vector_stores/files.py b/src/llama_stack_client/resources/vector_stores/files.py index d5d16e2c..82cf7308 100644 --- a/src/llama_stack_client/resources/vector_stores/files.py +++ b/src/llama_stack_client/resources/vector_stores/files.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Optional from typing_extensions import Literal import httpx @@ -58,8 +58,8 @@ def create( vector_store_id: str, *, file_id: str, - attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - chunking_strategy: file_create_params.ChunkingStrategy | Omit = omit, + attributes: Optional[Dict[str, object]] | Omit = omit, + chunking_strategy: Optional[file_create_params.ChunkingStrategy] | 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, @@ -71,11 +71,7 @@ def create( Attach a file to a vector store. Args: - file_id: The ID of the file to attach to the vector store. - - attributes: The key-value attributes stored with the file, which can be used for filtering. - - chunking_strategy: The chunking strategy to use for the file. + chunking_strategy: Automatic chunking strategy for vector store files. extra_headers: Send extra headers @@ -144,7 +140,7 @@ def update( file_id: str, *, vector_store_id: str, - attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + attributes: Dict[str, object], # 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, @@ -156,8 +152,6 @@ def update( Updates a vector store file. Args: - attributes: The updated key-value attributes to store with the file. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -183,11 +177,11 @@ def list( self, vector_store_id: str, *, - after: str | Omit = omit, - before: str | Omit = omit, - filter: Literal["completed", "in_progress", "cancelled", "failed"] | Omit = omit, - limit: int | Omit = omit, - order: str | Omit = omit, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + filter: Optional[Literal["completed", "in_progress", "cancelled", "failed"]] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[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, @@ -199,20 +193,6 @@ def list( List files in a vector store. Args: - after: (Optional) A cursor for use in pagination. `after` is an object ID that defines - your place in the list. - - before: (Optional) A cursor for use in pagination. `before` is an object ID that defines - your place in the list. - - filter: (Optional) Filter by file status to only return files with the specified status. - - limit: (Optional) A limit on the number of objects to be returned. Limit can range - between 1 and 100, and the default is 20. - - order: (Optional) Sort order by the `created_at` timestamp of the objects. `asc` for - ascending order and `desc` for descending order. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -286,8 +266,8 @@ def content( file_id: str, *, vector_store_id: str, - include_embeddings: bool | Omit = omit, - include_metadata: bool | Omit = omit, + include_embeddings: Optional[bool] | Omit = omit, + include_metadata: Optional[bool] | 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, @@ -299,10 +279,6 @@ def content( Retrieves the contents of a vector store file. Args: - include_embeddings: Whether to include embedding vectors in the response. - - include_metadata: Whether to include chunk metadata in the response. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -359,8 +335,8 @@ async def create( vector_store_id: str, *, file_id: str, - attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - chunking_strategy: file_create_params.ChunkingStrategy | Omit = omit, + attributes: Optional[Dict[str, object]] | Omit = omit, + chunking_strategy: Optional[file_create_params.ChunkingStrategy] | 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, @@ -372,11 +348,7 @@ async def create( Attach a file to a vector store. Args: - file_id: The ID of the file to attach to the vector store. - - attributes: The key-value attributes stored with the file, which can be used for filtering. - - chunking_strategy: The chunking strategy to use for the file. + chunking_strategy: Automatic chunking strategy for vector store files. extra_headers: Send extra headers @@ -445,7 +417,7 @@ async def update( file_id: str, *, vector_store_id: str, - attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]], + attributes: Dict[str, object], # 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, @@ -457,8 +429,6 @@ async def update( Updates a vector store file. Args: - attributes: The updated key-value attributes to store with the file. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -484,11 +454,11 @@ def list( self, vector_store_id: str, *, - after: str | Omit = omit, - before: str | Omit = omit, - filter: Literal["completed", "in_progress", "cancelled", "failed"] | Omit = omit, - limit: int | Omit = omit, - order: str | Omit = omit, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + filter: Optional[Literal["completed", "in_progress", "cancelled", "failed"]] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[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, @@ -500,20 +470,6 @@ def list( List files in a vector store. Args: - after: (Optional) A cursor for use in pagination. `after` is an object ID that defines - your place in the list. - - before: (Optional) A cursor for use in pagination. `before` is an object ID that defines - your place in the list. - - filter: (Optional) Filter by file status to only return files with the specified status. - - limit: (Optional) A limit on the number of objects to be returned. Limit can range - between 1 and 100, and the default is 20. - - order: (Optional) Sort order by the `created_at` timestamp of the objects. `asc` for - ascending order and `desc` for descending order. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -587,8 +543,8 @@ async def content( file_id: str, *, vector_store_id: str, - include_embeddings: bool | Omit = omit, - include_metadata: bool | Omit = omit, + include_embeddings: Optional[bool] | Omit = omit, + include_metadata: Optional[bool] | 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, @@ -600,10 +556,6 @@ async def content( Retrieves the contents of a vector store file. Args: - include_embeddings: Whether to include embedding vectors in the response. - - include_metadata: Whether to include chunk metadata in the response. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request diff --git a/src/llama_stack_client/resources/vector_stores/vector_stores.py b/src/llama_stack_client/resources/vector_stores/vector_stores.py index f324ccd0..03efa38d 100644 --- a/src/llama_stack_client/resources/vector_stores/vector_stores.py +++ b/src/llama_stack_client/resources/vector_stores/vector_stores.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Optional import httpx @@ -84,11 +84,11 @@ def with_streaming_response(self) -> VectorStoresResourceWithStreamingResponse: def create( self, *, - chunking_strategy: vector_store_create_params.ChunkingStrategy | Omit = omit, - expires_after: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - file_ids: SequenceNotStr[str] | Omit = omit, - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - name: str | Omit = omit, + chunking_strategy: Optional[vector_store_create_params.ChunkingStrategy] | Omit = omit, + expires_after: Optional[Dict[str, object]] | Omit = omit, + file_ids: Optional[SequenceNotStr[str]] | Omit = omit, + metadata: Optional[Dict[str, object]] | Omit = omit, + name: Optional[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, @@ -96,21 +96,13 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VectorStore: - """Creates a vector store. + """ + Creates a vector store. - Generate an OpenAI-compatible vector store with the - given parameters. + Generate an OpenAI-compatible vector store with the given parameters. Args: - chunking_strategy: (Optional) Strategy for splitting files into chunks - - expires_after: (Optional) Expiration policy for the vector store - - file_ids: List of file IDs to include in the vector store - - metadata: Set of key-value pairs that can be attached to the vector store - - name: (Optional) A name for the vector store + chunking_strategy: Automatic chunking strategy for vector store files. extra_headers: Send extra headers @@ -175,9 +167,9 @@ def update( self, vector_store_id: str, *, - expires_after: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - name: str | Omit = omit, + expires_after: Optional[Dict[str, object]] | Omit = omit, + metadata: Optional[Dict[str, object]] | Omit = omit, + name: Optional[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, @@ -189,12 +181,6 @@ def update( Updates a vector store. Args: - expires_after: The expiration policy for a vector store. - - metadata: Set of 16 key-value pairs that can be attached to an object. - - name: The name of the vector store. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -224,10 +210,10 @@ def update( def list( self, *, - after: str | Omit = omit, - before: str | Omit = omit, - limit: int | Omit = omit, - order: str | Omit = omit, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[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, @@ -235,23 +221,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOpenAICursorPage[VectorStore]: - """Returns a list of vector stores. + """ + Returns a list of vector stores. Args: - after: A cursor for use in pagination. - - `after` is an object ID that defines your place - in the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -319,11 +292,11 @@ def search( vector_store_id: str, *, query: Union[str, SequenceNotStr[str]], - filters: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - max_num_results: int | Omit = omit, - ranking_options: vector_store_search_params.RankingOptions | Omit = omit, - rewrite_query: bool | Omit = omit, - search_mode: str | Omit = omit, + filters: Optional[Dict[str, object]] | Omit = omit, + max_num_results: Optional[int] | Omit = omit, + ranking_options: Optional[vector_store_search_params.RankingOptions] | Omit = omit, + rewrite_query: Optional[bool] | Omit = omit, + search_mode: Optional[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, @@ -331,23 +304,14 @@ def search( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VectorStoreSearchResponse: - """Search for chunks in a vector store. + """ + Search for chunks in a vector store. - Searches a vector store for relevant chunks - based on a query and optional file attribute filters. + Searches a vector store for relevant chunks based on a query and optional file + attribute filters. Args: - query: The query string or array for performing the search. - - filters: Filters based on file attributes to narrow the search results. - - max_num_results: Maximum number of results to return (1 to 50 inclusive, default 10). - - ranking_options: Ranking options for fine-tuning the search results. - - rewrite_query: Whether to rewrite the natural language query for vector search (default false) - - search_mode: The search mode to use - "keyword", "vector", or "hybrid" (default "vector") + ranking_options: Options for ranking and filtering search results. extra_headers: Send extra headers @@ -410,11 +374,11 @@ def with_streaming_response(self) -> AsyncVectorStoresResourceWithStreamingRespo async def create( self, *, - chunking_strategy: vector_store_create_params.ChunkingStrategy | Omit = omit, - expires_after: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - file_ids: SequenceNotStr[str] | Omit = omit, - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - name: str | Omit = omit, + chunking_strategy: Optional[vector_store_create_params.ChunkingStrategy] | Omit = omit, + expires_after: Optional[Dict[str, object]] | Omit = omit, + file_ids: Optional[SequenceNotStr[str]] | Omit = omit, + metadata: Optional[Dict[str, object]] | Omit = omit, + name: Optional[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, @@ -422,21 +386,13 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VectorStore: - """Creates a vector store. + """ + Creates a vector store. - Generate an OpenAI-compatible vector store with the - given parameters. + Generate an OpenAI-compatible vector store with the given parameters. Args: - chunking_strategy: (Optional) Strategy for splitting files into chunks - - expires_after: (Optional) Expiration policy for the vector store - - file_ids: List of file IDs to include in the vector store - - metadata: Set of key-value pairs that can be attached to the vector store - - name: (Optional) A name for the vector store + chunking_strategy: Automatic chunking strategy for vector store files. extra_headers: Send extra headers @@ -501,9 +457,9 @@ async def update( self, vector_store_id: str, *, - expires_after: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - name: str | Omit = omit, + expires_after: Optional[Dict[str, object]] | Omit = omit, + metadata: Optional[Dict[str, object]] | Omit = omit, + name: Optional[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, @@ -515,12 +471,6 @@ async def update( Updates a vector store. Args: - expires_after: The expiration policy for a vector store. - - metadata: Set of 16 key-value pairs that can be attached to an object. - - name: The name of the vector store. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -550,10 +500,10 @@ async def update( def list( self, *, - after: str | Omit = omit, - before: str | Omit = omit, - limit: int | Omit = omit, - order: str | Omit = omit, + after: Optional[str] | Omit = omit, + before: Optional[str] | Omit = omit, + limit: Optional[int] | Omit = omit, + order: Optional[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, @@ -561,23 +511,10 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[VectorStore, AsyncOpenAICursorPage[VectorStore]]: - """Returns a list of vector stores. + """ + Returns a list of vector stores. Args: - after: A cursor for use in pagination. - - `after` is an object ID that defines your place - in the list. - - before: A cursor for use in pagination. `before` is an object ID that defines your place - in the list. - - limit: A limit on the number of objects to be returned. Limit can range between 1 and - 100, and the default is 20. - - order: Sort order by the `created_at` timestamp of the objects. `asc` for ascending - order and `desc` for descending order. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -645,11 +582,11 @@ async def search( vector_store_id: str, *, query: Union[str, SequenceNotStr[str]], - filters: Dict[str, Union[bool, float, str, Iterable[object], object, None]] | Omit = omit, - max_num_results: int | Omit = omit, - ranking_options: vector_store_search_params.RankingOptions | Omit = omit, - rewrite_query: bool | Omit = omit, - search_mode: str | Omit = omit, + filters: Optional[Dict[str, object]] | Omit = omit, + max_num_results: Optional[int] | Omit = omit, + ranking_options: Optional[vector_store_search_params.RankingOptions] | Omit = omit, + rewrite_query: Optional[bool] | Omit = omit, + search_mode: Optional[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, @@ -657,23 +594,14 @@ async def search( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> VectorStoreSearchResponse: - """Search for chunks in a vector store. + """ + Search for chunks in a vector store. - Searches a vector store for relevant chunks - based on a query and optional file attribute filters. + Searches a vector store for relevant chunks based on a query and optional file + attribute filters. Args: - query: The query string or array for performing the search. - - filters: Filters based on file attributes to narrow the search results. - - max_num_results: Maximum number of results to return (1 to 50 inclusive, default 10). - - ranking_options: Ranking options for fine-tuning the search results. - - rewrite_query: Whether to rewrite the natural language query for vector search (default false) - - search_mode: The search mode to use - "keyword", "vector", or "hybrid" (default "vector") + ranking_options: Options for ranking and filtering search results. extra_headers: Send extra headers diff --git a/src/llama_stack_client/types/__init__.py b/src/llama_stack_client/types/__init__.py index 26f7f9a0..8cad8216 100644 --- a/src/llama_stack_client/types/__init__.py +++ b/src/llama_stack_client/types/__init__.py @@ -33,10 +33,12 @@ from .response_object import ResponseObject as ResponseObject from .file_list_params import FileListParams as FileListParams from .tool_list_params import ToolListParams as ToolListParams +from .batch_list_params import BatchListParams as BatchListParams from .route_list_params import RouteListParams as RouteListParams -from .scoring_fn_params import ScoringFnParams as ScoringFnParams from .file_create_params import FileCreateParams as FileCreateParams from .tool_list_response import ToolListResponse as ToolListResponse +from .batch_create_params import BatchCreateParams as BatchCreateParams +from .batch_list_response import BatchListResponse as BatchListResponse from .conversation_object import ConversationObject as ConversationObject from .list_files_response import ListFilesResponse as ListFilesResponse from .model_list_response import ModelListResponse as ModelListResponse @@ -51,6 +53,8 @@ from .response_list_params import ResponseListParams as ResponseListParams from .scoring_score_params import ScoringScoreParams as ScoringScoreParams from .shield_list_response import ShieldListResponse as ShieldListResponse +from .batch_cancel_response import BatchCancelResponse as BatchCancelResponse +from .batch_create_response import BatchCreateResponse as BatchCreateResponse from .chat_completion_chunk import ChatCompletionChunk as ChatCompletionChunk from .list_prompts_response import ListPromptsResponse as ListPromptsResponse from .list_shields_response import ListShieldsResponse as ListShieldsResponse @@ -65,11 +69,11 @@ from .shield_register_params import ShieldRegisterParams as ShieldRegisterParams from .tool_invocation_result import ToolInvocationResult as ToolInvocationResult from .vector_io_query_params import VectorIoQueryParams as VectorIoQueryParams +from .batch_retrieve_response import BatchRetrieveResponse as BatchRetrieveResponse from .embedding_create_params import EmbeddingCreateParams as EmbeddingCreateParams from .list_providers_response import ListProvidersResponse as ListProvidersResponse from .model_register_response import ModelRegisterResponse as ModelRegisterResponse from .model_retrieve_response import ModelRetrieveResponse as ModelRetrieveResponse -from .scoring_fn_params_param import ScoringFnParamsParam as ScoringFnParamsParam from .toolgroup_list_response import ToolgroupListResponse as ToolgroupListResponse from .vector_io_insert_params import VectorIoInsertParams as VectorIoInsertParams from .completion_create_params import CompletionCreateParams as CompletionCreateParams diff --git a/src/llama_stack_client/types/alpha/__init__.py b/src/llama_stack_client/types/alpha/__init__.py index 74487539..42e0ba8e 100644 --- a/src/llama_stack_client/types/alpha/__init__.py +++ b/src/llama_stack_client/types/alpha/__init__.py @@ -13,7 +13,6 @@ from .evaluate_response import EvaluateResponse as EvaluateResponse from .post_training_job import PostTrainingJob as PostTrainingJob from .eval_run_eval_params import EvalRunEvalParams as EvalRunEvalParams -from .algorithm_config_param import AlgorithmConfigParam as AlgorithmConfigParam from .benchmark_config_param import BenchmarkConfigParam as BenchmarkConfigParam from .benchmark_list_response import BenchmarkListResponse as BenchmarkListResponse from .inference_rerank_params import InferenceRerankParams as InferenceRerankParams diff --git a/src/llama_stack_client/types/alpha/algorithm_config_param.py b/src/llama_stack_client/types/alpha/algorithm_config_param.py deleted file mode 100644 index bf3b7d0b..00000000 --- a/src/llama_stack_client/types/alpha/algorithm_config_param.py +++ /dev/null @@ -1,56 +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 -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -from ..._types import SequenceNotStr - -__all__ = ["AlgorithmConfigParam", "LoraFinetuningConfig", "QatFinetuningConfig"] - - -class LoraFinetuningConfig(TypedDict, total=False): - alpha: Required[int] - """LoRA scaling parameter that controls adaptation strength""" - - apply_lora_to_mlp: Required[bool] - """Whether to apply LoRA to MLP layers""" - - apply_lora_to_output: Required[bool] - """Whether to apply LoRA to output projection layers""" - - lora_attn_modules: Required[SequenceNotStr[str]] - """List of attention module names to apply LoRA to""" - - rank: Required[int] - """Rank of the LoRA adaptation (lower rank = fewer parameters)""" - - type: Required[Literal["LoRA"]] - """Algorithm type identifier, always "LoRA" """ - - quantize_base: bool - """(Optional) Whether to quantize the base model weights""" - - use_dora: bool - """(Optional) Whether to use DoRA (Weight-Decomposed Low-Rank Adaptation)""" - - -class QatFinetuningConfig(TypedDict, total=False): - group_size: Required[int] - """Size of groups for grouped quantization""" - - quantizer_name: Required[str] - """Name of the quantization algorithm to use""" - - type: Required[Literal["QAT"]] - """Algorithm type identifier, always "QAT" """ - - -AlgorithmConfigParam: TypeAlias = Union[LoraFinetuningConfig, QatFinetuningConfig] diff --git a/src/llama_stack_client/types/alpha/benchmark.py b/src/llama_stack_client/types/alpha/benchmark.py index b70c8f28..6bd5e222 100644 --- a/src/llama_stack_client/types/alpha/benchmark.py +++ b/src/llama_stack_client/types/alpha/benchmark.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, List, Optional from typing_extensions import Literal from ..._models import BaseModel @@ -16,19 +16,19 @@ class Benchmark(BaseModel): dataset_id: str - """Identifier of the dataset to use for the benchmark evaluation""" identifier: str - - metadata: Dict[str, Union[bool, float, str, List[object], object, None]] - """Metadata for this evaluation task""" + """Unique identifier for this resource in llama stack""" provider_id: str + """ID of the provider that owns this resource""" scoring_functions: List[str] - """List of scoring function identifiers to apply during evaluation""" - type: Literal["benchmark"] - """The resource type, always benchmark""" + metadata: Optional[Dict[str, object]] = None + """Metadata for this evaluation task""" provider_resource_id: Optional[str] = None + """Unique identifier for this resource in the provider""" + + type: Optional[Literal["benchmark"]] = None 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 5927c248..3de48d88 100644 --- a/src/llama_stack_client/types/alpha/benchmark_config_param.py +++ b/src/llama_stack_client/types/alpha/benchmark_config_param.py @@ -8,41 +8,83 @@ from __future__ import annotations -from typing import Dict -from typing_extensions import Literal, Required, TypedDict +from typing import Dict, List, Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from ..scoring_fn_params_param import ScoringFnParamsParam +from ..._types import SequenceNotStr from ..shared_params.system_message import SystemMessage from ..shared_params.sampling_params import SamplingParams -__all__ = ["BenchmarkConfigParam", "EvalCandidate"] +__all__ = [ + "BenchmarkConfigParam", + "EvalCandidate", + "ScoringParams", + "ScoringParamsLlmAsJudgeScoringFnParams", + "ScoringParamsRegexParserScoringFnParams", + "ScoringParamsBasicScoringFnParams", +] class EvalCandidate(TypedDict, total=False): model: Required[str] - """The model ID to evaluate.""" sampling_params: Required[SamplingParams] - """The sampling parameters for the model.""" + """Sampling parameters.""" - type: Required[Literal["model"]] + system_message: Optional[SystemMessage] + """A system message providing instructions or context to the model.""" - system_message: SystemMessage - """(Optional) The system message providing instructions or context to the model.""" + type: Literal["model"] + + +class ScoringParamsLlmAsJudgeScoringFnParams(TypedDict, total=False): + judge_model: Required[str] + + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + judge_score_regexes: SequenceNotStr[str] + """Regexes to extract the answer from generated response""" + + prompt_template: Optional[str] + + type: Literal["llm_as_judge"] + + +class ScoringParamsRegexParserScoringFnParams(TypedDict, total=False): + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + parsing_regexes: SequenceNotStr[str] + """Regex to extract the answer from generated response""" + + type: Literal["regex_parser"] + + +class ScoringParamsBasicScoringFnParams(TypedDict, total=False): + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + type: Literal["basic"] + + +ScoringParams: TypeAlias = Union[ + ScoringParamsLlmAsJudgeScoringFnParams, ScoringParamsRegexParserScoringFnParams, ScoringParamsBasicScoringFnParams +] class BenchmarkConfigParam(TypedDict, total=False): eval_candidate: Required[EvalCandidate] - """The candidate to evaluate.""" + """A model candidate for evaluation.""" - scoring_params: Required[Dict[str, ScoringFnParamsParam]] + num_examples: Optional[int] """ - Map between scoring function id and parameters for each scoring function you - want to run + Number of examples to evaluate (useful for testing), if not provided, all + examples in the dataset will be evaluated """ - num_examples: int - """(Optional) The number of examples to evaluate. - - If not provided, all examples in the dataset will be evaluated + scoring_params: Dict[str, ScoringParams] + """ + Map between scoring function id and parameters for each scoring function you + want to run """ diff --git a/src/llama_stack_client/types/alpha/benchmark_register_params.py b/src/llama_stack_client/types/alpha/benchmark_register_params.py index 84be3786..344570d7 100644 --- a/src/llama_stack_client/types/alpha/benchmark_register_params.py +++ b/src/llama_stack_client/types/alpha/benchmark_register_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Optional from typing_extensions import Required, TypedDict from ..._types import SequenceNotStr @@ -18,19 +18,13 @@ class BenchmarkRegisterParams(TypedDict, total=False): benchmark_id: Required[str] - """The ID of the benchmark to register.""" dataset_id: Required[str] - """The ID of the dataset to use for the benchmark.""" scoring_functions: Required[SequenceNotStr[str]] - """The scoring functions to use for the benchmark.""" - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """The metadata to use for the benchmark.""" + metadata: Optional[Dict[str, object]] - provider_benchmark_id: str - """The ID of the provider benchmark to use for the benchmark.""" + provider_benchmark_id: Optional[str] - provider_id: str - """The ID of the provider to use for the benchmark.""" + provider_id: Optional[str] diff --git a/src/llama_stack_client/types/alpha/eval_evaluate_rows_alpha_params.py b/src/llama_stack_client/types/alpha/eval_evaluate_rows_alpha_params.py index 36036ff9..34c0e28b 100644 --- a/src/llama_stack_client/types/alpha/eval_evaluate_rows_alpha_params.py +++ b/src/llama_stack_client/types/alpha/eval_evaluate_rows_alpha_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Iterable from typing_extensions import Required, TypedDict from ..._types import SequenceNotStr @@ -19,10 +19,8 @@ class EvalEvaluateRowsAlphaParams(TypedDict, total=False): benchmark_config: Required[BenchmarkConfigParam] - """The configuration for the benchmark.""" + """A benchmark configuration for evaluation.""" - input_rows: Required[Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]] - """The rows to evaluate.""" + input_rows: Required[Iterable[Dict[str, object]]] scoring_functions: Required[SequenceNotStr[str]] - """The scoring functions to use for the evaluation.""" diff --git a/src/llama_stack_client/types/alpha/eval_evaluate_rows_params.py b/src/llama_stack_client/types/alpha/eval_evaluate_rows_params.py index 3aba96a2..5b1ab8c9 100644 --- a/src/llama_stack_client/types/alpha/eval_evaluate_rows_params.py +++ b/src/llama_stack_client/types/alpha/eval_evaluate_rows_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Iterable from typing_extensions import Required, TypedDict from ..._types import SequenceNotStr @@ -19,10 +19,8 @@ class EvalEvaluateRowsParams(TypedDict, total=False): benchmark_config: Required[BenchmarkConfigParam] - """The configuration for the benchmark.""" + """A benchmark configuration for evaluation.""" - input_rows: Required[Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]] - """The rows to evaluate.""" + input_rows: Required[Iterable[Dict[str, object]]] scoring_functions: Required[SequenceNotStr[str]] - """The scoring functions to use for the evaluation.""" diff --git a/src/llama_stack_client/types/alpha/eval_run_eval_alpha_params.py b/src/llama_stack_client/types/alpha/eval_run_eval_alpha_params.py index 760f9dc6..658ee047 100644 --- a/src/llama_stack_client/types/alpha/eval_run_eval_alpha_params.py +++ b/src/llama_stack_client/types/alpha/eval_run_eval_alpha_params.py @@ -8,13 +8,83 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Dict, List, Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .benchmark_config_param import BenchmarkConfigParam +from ..._types import SequenceNotStr +from ..shared_params.system_message import SystemMessage +from ..shared_params.sampling_params import SamplingParams -__all__ = ["EvalRunEvalAlphaParams"] +__all__ = [ + "EvalRunEvalAlphaParams", + "EvalCandidate", + "ScoringParams", + "ScoringParamsLlmAsJudgeScoringFnParams", + "ScoringParamsRegexParserScoringFnParams", + "ScoringParamsBasicScoringFnParams", +] class EvalRunEvalAlphaParams(TypedDict, total=False): - benchmark_config: Required[BenchmarkConfigParam] - """The configuration for the benchmark.""" + eval_candidate: Required[EvalCandidate] + """A model candidate for evaluation.""" + + num_examples: Optional[int] + """ + Number of examples to evaluate (useful for testing), if not provided, all + examples in the dataset will be evaluated + """ + + scoring_params: Dict[str, ScoringParams] + """ + Map between scoring function id and parameters for each scoring function you + want to run + """ + + +class EvalCandidate(TypedDict, total=False): + model: Required[str] + + sampling_params: Required[SamplingParams] + """Sampling parameters.""" + + system_message: Optional[SystemMessage] + """A system message providing instructions or context to the model.""" + + type: Literal["model"] + + +class ScoringParamsLlmAsJudgeScoringFnParams(TypedDict, total=False): + judge_model: Required[str] + + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + judge_score_regexes: SequenceNotStr[str] + """Regexes to extract the answer from generated response""" + + prompt_template: Optional[str] + + type: Literal["llm_as_judge"] + + +class ScoringParamsRegexParserScoringFnParams(TypedDict, total=False): + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + parsing_regexes: SequenceNotStr[str] + """Regex to extract the answer from generated response""" + + type: Literal["regex_parser"] + + +class ScoringParamsBasicScoringFnParams(TypedDict, total=False): + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + type: Literal["basic"] + + +ScoringParams: TypeAlias = Union[ + ScoringParamsLlmAsJudgeScoringFnParams, ScoringParamsRegexParserScoringFnParams, ScoringParamsBasicScoringFnParams +] diff --git a/src/llama_stack_client/types/alpha/eval_run_eval_params.py b/src/llama_stack_client/types/alpha/eval_run_eval_params.py index bb166ba3..46f5f5e6 100644 --- a/src/llama_stack_client/types/alpha/eval_run_eval_params.py +++ b/src/llama_stack_client/types/alpha/eval_run_eval_params.py @@ -8,13 +8,83 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Dict, List, Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .benchmark_config_param import BenchmarkConfigParam +from ..._types import SequenceNotStr +from ..shared_params.system_message import SystemMessage +from ..shared_params.sampling_params import SamplingParams -__all__ = ["EvalRunEvalParams"] +__all__ = [ + "EvalRunEvalParams", + "EvalCandidate", + "ScoringParams", + "ScoringParamsLlmAsJudgeScoringFnParams", + "ScoringParamsRegexParserScoringFnParams", + "ScoringParamsBasicScoringFnParams", +] class EvalRunEvalParams(TypedDict, total=False): - benchmark_config: Required[BenchmarkConfigParam] - """The configuration for the benchmark.""" + eval_candidate: Required[EvalCandidate] + """A model candidate for evaluation.""" + + num_examples: Optional[int] + """ + Number of examples to evaluate (useful for testing), if not provided, all + examples in the dataset will be evaluated + """ + + scoring_params: Dict[str, ScoringParams] + """ + Map between scoring function id and parameters for each scoring function you + want to run + """ + + +class EvalCandidate(TypedDict, total=False): + model: Required[str] + + sampling_params: Required[SamplingParams] + """Sampling parameters.""" + + system_message: Optional[SystemMessage] + """A system message providing instructions or context to the model.""" + + type: Literal["model"] + + +class ScoringParamsLlmAsJudgeScoringFnParams(TypedDict, total=False): + judge_model: Required[str] + + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + judge_score_regexes: SequenceNotStr[str] + """Regexes to extract the answer from generated response""" + + prompt_template: Optional[str] + + type: Literal["llm_as_judge"] + + +class ScoringParamsRegexParserScoringFnParams(TypedDict, total=False): + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + parsing_regexes: SequenceNotStr[str] + """Regex to extract the answer from generated response""" + + type: Literal["regex_parser"] + + +class ScoringParamsBasicScoringFnParams(TypedDict, total=False): + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + type: Literal["basic"] + + +ScoringParams: TypeAlias = Union[ + ScoringParamsLlmAsJudgeScoringFnParams, ScoringParamsRegexParserScoringFnParams, ScoringParamsBasicScoringFnParams +] diff --git a/src/llama_stack_client/types/alpha/evaluate_response.py b/src/llama_stack_client/types/alpha/evaluate_response.py index 69d310ef..4e4c453c 100644 --- a/src/llama_stack_client/types/alpha/evaluate_response.py +++ b/src/llama_stack_client/types/alpha/evaluate_response.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union +from typing import Dict, List from ..._models import BaseModel from ..shared.scoring_result import ScoringResult @@ -15,8 +15,6 @@ class EvaluateResponse(BaseModel): - generations: List[Dict[str, Union[bool, float, str, List[object], object, None]]] - """The generations from the evaluation.""" + generations: List[Dict[str, object]] scores: Dict[str, ScoringResult] - """The scores from the evaluation.""" diff --git a/src/llama_stack_client/types/alpha/inference_rerank_params.py b/src/llama_stack_client/types/alpha/inference_rerank_params.py index 6502c3d4..d668c2b7 100644 --- a/src/llama_stack_client/types/alpha/inference_rerank_params.py +++ b/src/llama_stack_client/types/alpha/inference_rerank_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr @@ -28,51 +28,32 @@ class InferenceRerankParams(TypedDict, total=False): items: Required[SequenceNotStr[Item]] - """List of items to rerank. - - Each item can be a string, text content part, or image content part. Each input - must not exceed the model's max input token length. - """ model: Required[str] - """The identifier of the reranking model to use.""" query: Required[Query] - """The search query to rank items against. - - Can be a string, text content part, or image content part. The input must not - exceed the model's max input token length. - """ + """Text content part for OpenAI-compatible chat completion messages.""" - max_num_results: int - """(Optional) Maximum number of results to return. Default: returns all.""" + max_num_results: Optional[int] class ItemOpenAIChatCompletionContentPartTextParam(TypedDict, total=False): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] class ItemOpenAIChatCompletionContentPartImageParamImageURL(TypedDict, total=False): url: Required[str] - """URL of the image to include in the message""" - detail: str - """(Optional) Level of detail for image processing. - - Can be "low", "high", or "auto" - """ + detail: Optional[str] class ItemOpenAIChatCompletionContentPartImageParam(TypedDict, total=False): image_url: Required[ItemOpenAIChatCompletionContentPartImageParamImageURL] - """Image URL specification and processing details""" + """Image URL specification for OpenAI-compatible chat completion messages.""" - type: Required[Literal["image_url"]] - """Must be "image_url" to identify this as image content""" + type: Literal["image_url"] Item: TypeAlias = Union[ @@ -82,29 +63,21 @@ class ItemOpenAIChatCompletionContentPartImageParam(TypedDict, total=False): class QueryOpenAIChatCompletionContentPartTextParam(TypedDict, total=False): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] class QueryOpenAIChatCompletionContentPartImageParamImageURL(TypedDict, total=False): url: Required[str] - """URL of the image to include in the message""" - - detail: str - """(Optional) Level of detail for image processing. - Can be "low", "high", or "auto" - """ + detail: Optional[str] class QueryOpenAIChatCompletionContentPartImageParam(TypedDict, total=False): image_url: Required[QueryOpenAIChatCompletionContentPartImageParamImageURL] - """Image URL specification and processing details""" + """Image URL specification for OpenAI-compatible chat completion messages.""" - type: Required[Literal["image_url"]] - """Must be "image_url" to identify this as image content""" + type: Literal["image_url"] Query: TypeAlias = Union[ diff --git a/src/llama_stack_client/types/alpha/inference_rerank_response.py b/src/llama_stack_client/types/alpha/inference_rerank_response.py index f2cd133c..c1221c2e 100644 --- a/src/llama_stack_client/types/alpha/inference_rerank_response.py +++ b/src/llama_stack_client/types/alpha/inference_rerank_response.py @@ -16,14 +16,8 @@ class InferenceRerankResponseItem(BaseModel): index: int - """The original index of the document in the input list""" relevance_score: float - """The relevance score from the model output. - - Values are inverted when applicable so that higher scores indicate greater - relevance. - """ InferenceRerankResponse: TypeAlias = List[InferenceRerankResponseItem] diff --git a/src/llama_stack_client/types/alpha/job.py b/src/llama_stack_client/types/alpha/job.py index 696eba85..8aace3cc 100644 --- a/src/llama_stack_client/types/alpha/job.py +++ b/src/llama_stack_client/types/alpha/job.py @@ -15,7 +15,6 @@ class Job(BaseModel): job_id: str - """Unique identifier for the job""" status: Literal["completed", "in_progress", "failed", "scheduled", "cancelled"] - """Current execution status of the job""" + """Status of a job execution.""" diff --git a/src/llama_stack_client/types/alpha/post_training/job_artifacts_params.py b/src/llama_stack_client/types/alpha/post_training/job_artifacts_params.py index e18e76e0..c9e89a4e 100644 --- a/src/llama_stack_client/types/alpha/post_training/job_artifacts_params.py +++ b/src/llama_stack_client/types/alpha/post_training/job_artifacts_params.py @@ -15,4 +15,3 @@ class JobArtifactsParams(TypedDict, total=False): job_uuid: Required[str] - """The UUID of the job to get the artifacts of.""" diff --git a/src/llama_stack_client/types/alpha/post_training/job_artifacts_response.py b/src/llama_stack_client/types/alpha/post_training/job_artifacts_response.py index 508ba75d..3f6b8296 100644 --- a/src/llama_stack_client/types/alpha/post_training/job_artifacts_response.py +++ b/src/llama_stack_client/types/alpha/post_training/job_artifacts_response.py @@ -16,41 +16,30 @@ class CheckpointTrainingMetrics(BaseModel): epoch: int - """Training epoch number""" perplexity: float - """Perplexity metric indicating model confidence""" train_loss: float - """Loss value on the training dataset""" validation_loss: float - """Loss value on the validation dataset""" class Checkpoint(BaseModel): created_at: datetime - """Timestamp when the checkpoint was created""" epoch: int - """Training epoch when the checkpoint was saved""" identifier: str - """Unique identifier for the checkpoint""" path: str - """File system path where the checkpoint is stored""" post_training_job_id: str - """Identifier of the training job that created this checkpoint""" training_metrics: Optional[CheckpointTrainingMetrics] = None - """(Optional) Training metrics associated with this checkpoint""" + """Training metrics captured during post-training jobs.""" class JobArtifactsResponse(BaseModel): - checkpoints: List[Checkpoint] - """List of model checkpoints created during training""" - job_uuid: str - """Unique identifier for the training job""" + + checkpoints: Optional[List[Checkpoint]] = None diff --git a/src/llama_stack_client/types/alpha/post_training/job_cancel_params.py b/src/llama_stack_client/types/alpha/post_training/job_cancel_params.py index fc1f9a32..035cbfb6 100644 --- a/src/llama_stack_client/types/alpha/post_training/job_cancel_params.py +++ b/src/llama_stack_client/types/alpha/post_training/job_cancel_params.py @@ -15,4 +15,3 @@ class JobCancelParams(TypedDict, total=False): job_uuid: Required[str] - """The UUID of the job to cancel.""" diff --git a/src/llama_stack_client/types/alpha/post_training/job_list_response.py b/src/llama_stack_client/types/alpha/post_training/job_list_response.py index 95b5d7c5..2d47e18d 100644 --- a/src/llama_stack_client/types/alpha/post_training/job_list_response.py +++ b/src/llama_stack_client/types/alpha/post_training/job_list_response.py @@ -9,13 +9,8 @@ from typing import List from typing_extensions import TypeAlias -from ...._models import BaseModel +from ..post_training_job import PostTrainingJob -__all__ = ["JobListResponse", "JobListResponseItem"] +__all__ = ["JobListResponse"] - -class JobListResponseItem(BaseModel): - job_uuid: str - - -JobListResponse: TypeAlias = List[JobListResponseItem] +JobListResponse: TypeAlias = List[PostTrainingJob] diff --git a/src/llama_stack_client/types/alpha/post_training/job_status_params.py b/src/llama_stack_client/types/alpha/post_training/job_status_params.py index 5b832347..8bd28ddb 100644 --- a/src/llama_stack_client/types/alpha/post_training/job_status_params.py +++ b/src/llama_stack_client/types/alpha/post_training/job_status_params.py @@ -15,4 +15,3 @@ class JobStatusParams(TypedDict, total=False): job_uuid: Required[str] - """The UUID of the job to get the status of.""" diff --git a/src/llama_stack_client/types/alpha/post_training/job_status_response.py b/src/llama_stack_client/types/alpha/post_training/job_status_response.py index cfe9d54f..816a9bf1 100644 --- a/src/llama_stack_client/types/alpha/post_training/job_status_response.py +++ b/src/llama_stack_client/types/alpha/post_training/job_status_response.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, List, Optional from datetime import datetime from typing_extensions import Literal @@ -17,56 +17,41 @@ class CheckpointTrainingMetrics(BaseModel): epoch: int - """Training epoch number""" perplexity: float - """Perplexity metric indicating model confidence""" train_loss: float - """Loss value on the training dataset""" validation_loss: float - """Loss value on the validation dataset""" class Checkpoint(BaseModel): created_at: datetime - """Timestamp when the checkpoint was created""" epoch: int - """Training epoch when the checkpoint was saved""" identifier: str - """Unique identifier for the checkpoint""" path: str - """File system path where the checkpoint is stored""" post_training_job_id: str - """Identifier of the training job that created this checkpoint""" training_metrics: Optional[CheckpointTrainingMetrics] = None - """(Optional) Training metrics associated with this checkpoint""" + """Training metrics captured during post-training jobs.""" class JobStatusResponse(BaseModel): - checkpoints: List[Checkpoint] - """List of model checkpoints created during training""" - job_uuid: str - """Unique identifier for the training job""" status: Literal["completed", "in_progress", "failed", "scheduled", "cancelled"] - """Current status of the training job""" + """Status of a job execution.""" + + checkpoints: Optional[List[Checkpoint]] = None completed_at: Optional[datetime] = None - """(Optional) Timestamp when the job finished, if completed""" - resources_allocated: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) Information about computational resources allocated to the job""" + resources_allocated: Optional[Dict[str, object]] = None scheduled_at: Optional[datetime] = None - """(Optional) Timestamp when the job was scheduled""" started_at: Optional[datetime] = None - """(Optional) Timestamp when the job execution began""" diff --git a/src/llama_stack_client/types/alpha/post_training_preference_optimize_params.py b/src/llama_stack_client/types/alpha/post_training_preference_optimize_params.py index 35c9e023..2fbebaa2 100644 --- a/src/llama_stack_client/types/alpha/post_training_preference_optimize_params.py +++ b/src/llama_stack_client/types/alpha/post_training_preference_optimize_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict __all__ = [ @@ -23,107 +23,80 @@ class PostTrainingPreferenceOptimizeParams(TypedDict, total=False): algorithm_config: Required[AlgorithmConfig] - """The algorithm configuration.""" + """Configuration for Direct Preference Optimization (DPO) alignment.""" finetuned_model: Required[str] - """The model to fine-tune.""" - hyperparam_search_config: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """The hyperparam search configuration.""" + hyperparam_search_config: Required[Dict[str, object]] job_uuid: Required[str] - """The UUID of the job to create.""" - logger_config: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """The logger configuration.""" + logger_config: Required[Dict[str, object]] training_config: Required[TrainingConfig] - """The training configuration.""" + """Comprehensive configuration for the training process.""" class AlgorithmConfig(TypedDict, total=False): beta: Required[float] - """Temperature parameter for the DPO loss""" - loss_type: Required[Literal["sigmoid", "hinge", "ipo", "kto_pair"]] - """The type of loss function to use for DPO""" + loss_type: Literal["sigmoid", "hinge", "ipo", "kto_pair"] class TrainingConfigDataConfig(TypedDict, total=False): batch_size: Required[int] - """Number of samples per training batch""" data_format: Required[Literal["instruct", "dialog"]] - """Format of the dataset (instruct or dialog)""" + """Format of the training dataset.""" dataset_id: Required[str] - """Unique identifier for the training dataset""" shuffle: Required[bool] - """Whether to shuffle the dataset during training""" - packed: bool - """ - (Optional) Whether to pack multiple samples into a single sequence for - efficiency - """ + packed: Optional[bool] - train_on_input: bool - """(Optional) Whether to compute loss on input tokens as well as output tokens""" + train_on_input: Optional[bool] - validation_dataset_id: str - """(Optional) Unique identifier for the validation dataset""" + validation_dataset_id: Optional[str] class TrainingConfigEfficiencyConfig(TypedDict, total=False): - enable_activation_checkpointing: bool - """(Optional) Whether to use activation checkpointing to reduce memory usage""" + enable_activation_checkpointing: Optional[bool] - enable_activation_offloading: bool - """(Optional) Whether to offload activations to CPU to save GPU memory""" + enable_activation_offloading: Optional[bool] - fsdp_cpu_offload: bool - """(Optional) Whether to offload FSDP parameters to CPU""" + fsdp_cpu_offload: Optional[bool] - memory_efficient_fsdp_wrap: bool - """(Optional) Whether to use memory-efficient FSDP wrapping""" + memory_efficient_fsdp_wrap: Optional[bool] class TrainingConfigOptimizerConfig(TypedDict, total=False): lr: Required[float] - """Learning rate for the optimizer""" num_warmup_steps: Required[int] - """Number of steps for learning rate warmup""" optimizer_type: Required[Literal["adam", "adamw", "sgd"]] - """Type of optimizer to use (adam, adamw, or sgd)""" + """Available optimizer algorithms for training.""" weight_decay: Required[float] - """Weight decay coefficient for regularization""" class TrainingConfig(TypedDict, total=False): - gradient_accumulation_steps: Required[int] - """Number of steps to accumulate gradients before updating""" + n_epochs: Required[int] - max_steps_per_epoch: Required[int] - """Maximum number of steps to run per epoch""" + data_config: Optional[TrainingConfigDataConfig] + """Configuration for training data and data loading.""" - n_epochs: Required[int] - """Number of training epochs to run""" + dtype: Optional[str] - data_config: TrainingConfigDataConfig - """(Optional) Configuration for data loading and formatting""" + efficiency_config: Optional[TrainingConfigEfficiencyConfig] + """Configuration for memory and compute efficiency optimizations.""" - dtype: str - """(Optional) Data type for model parameters (bf16, fp16, fp32)""" + gradient_accumulation_steps: int - efficiency_config: TrainingConfigEfficiencyConfig - """(Optional) Configuration for memory and compute optimizations""" + max_steps_per_epoch: int - max_validation_steps: int - """(Optional) Maximum number of validation steps per epoch""" + max_validation_steps: Optional[int] - optimizer_config: TrainingConfigOptimizerConfig - """(Optional) Configuration for the optimization algorithm""" + optimizer_config: Optional[TrainingConfigOptimizerConfig] + """Configuration parameters for the optimization algorithm.""" diff --git a/src/llama_stack_client/types/alpha/post_training_supervised_fine_tune_params.py b/src/llama_stack_client/types/alpha/post_training_supervised_fine_tune_params.py index dfdc68e8..dacc50aa 100644 --- a/src/llama_stack_client/types/alpha/post_training_supervised_fine_tune_params.py +++ b/src/llama_stack_client/types/alpha/post_training_supervised_fine_tune_params.py @@ -8,10 +8,10 @@ from __future__ import annotations -from typing import Dict, Union, Iterable -from typing_extensions import Literal, Required, TypedDict +from typing import Dict, Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .algorithm_config_param import AlgorithmConfigParam +from ..._types import SequenceNotStr __all__ = [ "PostTrainingSupervisedFineTuneParams", @@ -19,107 +19,114 @@ "TrainingConfigDataConfig", "TrainingConfigEfficiencyConfig", "TrainingConfigOptimizerConfig", + "AlgorithmConfig", + "AlgorithmConfigLoraFinetuningConfig", + "AlgorithmConfigQatFinetuningConfig", ] class PostTrainingSupervisedFineTuneParams(TypedDict, total=False): - hyperparam_search_config: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """The hyperparam search configuration.""" + hyperparam_search_config: Required[Dict[str, object]] job_uuid: Required[str] - """The UUID of the job to create.""" - logger_config: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """The logger configuration.""" + logger_config: Required[Dict[str, object]] training_config: Required[TrainingConfig] - """The training configuration.""" + """Comprehensive configuration for the training process.""" - algorithm_config: AlgorithmConfigParam - """The algorithm configuration.""" + algorithm_config: Optional[AlgorithmConfig] + """Configuration for Low-Rank Adaptation (LoRA) fine-tuning.""" - checkpoint_dir: str - """The directory to save checkpoint(s) to.""" + checkpoint_dir: Optional[str] - model: str - """The model to fine-tune.""" + model: Optional[str] + """Model descriptor for training if not in provider config`""" class TrainingConfigDataConfig(TypedDict, total=False): batch_size: Required[int] - """Number of samples per training batch""" data_format: Required[Literal["instruct", "dialog"]] - """Format of the dataset (instruct or dialog)""" + """Format of the training dataset.""" dataset_id: Required[str] - """Unique identifier for the training dataset""" shuffle: Required[bool] - """Whether to shuffle the dataset during training""" - packed: bool - """ - (Optional) Whether to pack multiple samples into a single sequence for - efficiency - """ + packed: Optional[bool] - train_on_input: bool - """(Optional) Whether to compute loss on input tokens as well as output tokens""" + train_on_input: Optional[bool] - validation_dataset_id: str - """(Optional) Unique identifier for the validation dataset""" + validation_dataset_id: Optional[str] class TrainingConfigEfficiencyConfig(TypedDict, total=False): - enable_activation_checkpointing: bool - """(Optional) Whether to use activation checkpointing to reduce memory usage""" + enable_activation_checkpointing: Optional[bool] - enable_activation_offloading: bool - """(Optional) Whether to offload activations to CPU to save GPU memory""" + enable_activation_offloading: Optional[bool] - fsdp_cpu_offload: bool - """(Optional) Whether to offload FSDP parameters to CPU""" + fsdp_cpu_offload: Optional[bool] - memory_efficient_fsdp_wrap: bool - """(Optional) Whether to use memory-efficient FSDP wrapping""" + memory_efficient_fsdp_wrap: Optional[bool] class TrainingConfigOptimizerConfig(TypedDict, total=False): lr: Required[float] - """Learning rate for the optimizer""" num_warmup_steps: Required[int] - """Number of steps for learning rate warmup""" optimizer_type: Required[Literal["adam", "adamw", "sgd"]] - """Type of optimizer to use (adam, adamw, or sgd)""" + """Available optimizer algorithms for training.""" weight_decay: Required[float] - """Weight decay coefficient for regularization""" class TrainingConfig(TypedDict, total=False): - gradient_accumulation_steps: Required[int] - """Number of steps to accumulate gradients before updating""" + n_epochs: Required[int] - max_steps_per_epoch: Required[int] - """Maximum number of steps to run per epoch""" + data_config: Optional[TrainingConfigDataConfig] + """Configuration for training data and data loading.""" + + dtype: Optional[str] + + efficiency_config: Optional[TrainingConfigEfficiencyConfig] + """Configuration for memory and compute efficiency optimizations.""" + + gradient_accumulation_steps: int + + max_steps_per_epoch: int + + max_validation_steps: Optional[int] + + optimizer_config: Optional[TrainingConfigOptimizerConfig] + """Configuration parameters for the optimization algorithm.""" + + +class AlgorithmConfigLoraFinetuningConfig(TypedDict, total=False): + alpha: Required[int] + + apply_lora_to_mlp: Required[bool] + + apply_lora_to_output: Required[bool] + + lora_attn_modules: Required[SequenceNotStr[str]] + + rank: Required[int] + + quantize_base: Optional[bool] + + type: Literal["LoRA"] + + use_dora: Optional[bool] - n_epochs: Required[int] - """Number of training epochs to run""" - data_config: TrainingConfigDataConfig - """(Optional) Configuration for data loading and formatting""" +class AlgorithmConfigQatFinetuningConfig(TypedDict, total=False): + group_size: Required[int] - dtype: str - """(Optional) Data type for model parameters (bf16, fp16, fp32)""" + quantizer_name: Required[str] - efficiency_config: TrainingConfigEfficiencyConfig - """(Optional) Configuration for memory and compute optimizations""" + type: Literal["QAT"] - max_validation_steps: int - """(Optional) Maximum number of validation steps per epoch""" - optimizer_config: TrainingConfigOptimizerConfig - """(Optional) Configuration for the optimization algorithm""" +AlgorithmConfig: TypeAlias = Union[AlgorithmConfigLoraFinetuningConfig, AlgorithmConfigQatFinetuningConfig] diff --git a/src/llama_stack_client/types/batch_cancel_response.py b/src/llama_stack_client/types/batch_cancel_response.py new file mode 100644 index 00000000..2408eaa5 --- /dev/null +++ b/src/llama_stack_client/types/batch_cancel_response.py @@ -0,0 +1,195 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import builtins +from typing import TYPE_CHECKING, Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = [ + "BatchCancelResponse", + "Errors", + "ErrorsData", + "RequestCounts", + "Usage", + "UsageInputTokensDetails", + "UsageOutputTokensDetails", +] + + +class ErrorsData(BaseModel): + code: Optional[str] = None + + line: Optional[int] = None + + message: Optional[str] = None + + param: Optional[str] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class Errors(BaseModel): + data: Optional[List[ErrorsData]] = None + + object: Optional[str] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, builtins.object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> builtins.object: ... + else: + __pydantic_extra__: Dict[str, builtins.object] + + +class RequestCounts(BaseModel): + completed: int + + failed: int + + total: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class UsageInputTokensDetails(BaseModel): + cached_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class UsageOutputTokensDetails(BaseModel): + reasoning_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class Usage(BaseModel): + input_tokens: int + + input_tokens_details: UsageInputTokensDetails + + output_tokens: int + + output_tokens_details: UsageOutputTokensDetails + + total_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class BatchCancelResponse(BaseModel): + id: str + + completion_window: str + + created_at: int + + endpoint: str + + input_file_id: str + + object: Literal["batch"] + + status: Literal[ + "validating", "failed", "in_progress", "finalizing", "completed", "expired", "cancelling", "cancelled" + ] + + cancelled_at: Optional[int] = None + + cancelling_at: Optional[int] = None + + completed_at: Optional[int] = None + + error_file_id: Optional[str] = None + + errors: Optional[Errors] = None + + expired_at: Optional[int] = None + + expires_at: Optional[int] = None + + failed_at: Optional[int] = None + + finalizing_at: Optional[int] = None + + in_progress_at: Optional[int] = None + + metadata: Optional[Dict[str, str]] = None + + model: Optional[str] = None + + output_file_id: Optional[str] = None + + request_counts: Optional[RequestCounts] = None + + usage: Optional[Usage] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, builtins.object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> builtins.object: ... + else: + __pydantic_extra__: Dict[str, builtins.object] diff --git a/src/llama_stack_client/types/batch_create_params.py b/src/llama_stack_client/types/batch_create_params.py new file mode 100644 index 00000000..b22d9cad --- /dev/null +++ b/src/llama_stack_client/types/batch_create_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BatchCreateParams"] + + +class BatchCreateParams(TypedDict, total=False): + completion_window: Required[Literal["24h"]] + + endpoint: Required[str] + + input_file_id: Required[str] + + idempotency_key: Optional[str] + + metadata: Optional[Dict[str, str]] diff --git a/src/llama_stack_client/types/batch_create_response.py b/src/llama_stack_client/types/batch_create_response.py new file mode 100644 index 00000000..c1255f93 --- /dev/null +++ b/src/llama_stack_client/types/batch_create_response.py @@ -0,0 +1,195 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import builtins +from typing import TYPE_CHECKING, Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = [ + "BatchCreateResponse", + "Errors", + "ErrorsData", + "RequestCounts", + "Usage", + "UsageInputTokensDetails", + "UsageOutputTokensDetails", +] + + +class ErrorsData(BaseModel): + code: Optional[str] = None + + line: Optional[int] = None + + message: Optional[str] = None + + param: Optional[str] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class Errors(BaseModel): + data: Optional[List[ErrorsData]] = None + + object: Optional[str] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, builtins.object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> builtins.object: ... + else: + __pydantic_extra__: Dict[str, builtins.object] + + +class RequestCounts(BaseModel): + completed: int + + failed: int + + total: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class UsageInputTokensDetails(BaseModel): + cached_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class UsageOutputTokensDetails(BaseModel): + reasoning_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class Usage(BaseModel): + input_tokens: int + + input_tokens_details: UsageInputTokensDetails + + output_tokens: int + + output_tokens_details: UsageOutputTokensDetails + + total_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class BatchCreateResponse(BaseModel): + id: str + + completion_window: str + + created_at: int + + endpoint: str + + input_file_id: str + + object: Literal["batch"] + + status: Literal[ + "validating", "failed", "in_progress", "finalizing", "completed", "expired", "cancelling", "cancelled" + ] + + cancelled_at: Optional[int] = None + + cancelling_at: Optional[int] = None + + completed_at: Optional[int] = None + + error_file_id: Optional[str] = None + + errors: Optional[Errors] = None + + expired_at: Optional[int] = None + + expires_at: Optional[int] = None + + failed_at: Optional[int] = None + + finalizing_at: Optional[int] = None + + in_progress_at: Optional[int] = None + + metadata: Optional[Dict[str, str]] = None + + model: Optional[str] = None + + output_file_id: Optional[str] = None + + request_counts: Optional[RequestCounts] = None + + usage: Optional[Usage] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, builtins.object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> builtins.object: ... + else: + __pydantic_extra__: Dict[str, builtins.object] diff --git a/src/llama_stack_client/types/batch_list_params.py b/src/llama_stack_client/types/batch_list_params.py new file mode 100644 index 00000000..c5aecbec --- /dev/null +++ b/src/llama_stack_client/types/batch_list_params.py @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import TypedDict + +__all__ = ["BatchListParams"] + + +class BatchListParams(TypedDict, total=False): + after: Optional[str] + + limit: int diff --git a/src/llama_stack_client/types/batch_list_response.py b/src/llama_stack_client/types/batch_list_response.py new file mode 100644 index 00000000..5064ef18 --- /dev/null +++ b/src/llama_stack_client/types/batch_list_response.py @@ -0,0 +1,195 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import builtins +from typing import TYPE_CHECKING, Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = [ + "BatchListResponse", + "Errors", + "ErrorsData", + "RequestCounts", + "Usage", + "UsageInputTokensDetails", + "UsageOutputTokensDetails", +] + + +class ErrorsData(BaseModel): + code: Optional[str] = None + + line: Optional[int] = None + + message: Optional[str] = None + + param: Optional[str] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class Errors(BaseModel): + data: Optional[List[ErrorsData]] = None + + object: Optional[str] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, builtins.object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> builtins.object: ... + else: + __pydantic_extra__: Dict[str, builtins.object] + + +class RequestCounts(BaseModel): + completed: int + + failed: int + + total: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class UsageInputTokensDetails(BaseModel): + cached_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class UsageOutputTokensDetails(BaseModel): + reasoning_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class Usage(BaseModel): + input_tokens: int + + input_tokens_details: UsageInputTokensDetails + + output_tokens: int + + output_tokens_details: UsageOutputTokensDetails + + total_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class BatchListResponse(BaseModel): + id: str + + completion_window: str + + created_at: int + + endpoint: str + + input_file_id: str + + object: Literal["batch"] + + status: Literal[ + "validating", "failed", "in_progress", "finalizing", "completed", "expired", "cancelling", "cancelled" + ] + + cancelled_at: Optional[int] = None + + cancelling_at: Optional[int] = None + + completed_at: Optional[int] = None + + error_file_id: Optional[str] = None + + errors: Optional[Errors] = None + + expired_at: Optional[int] = None + + expires_at: Optional[int] = None + + failed_at: Optional[int] = None + + finalizing_at: Optional[int] = None + + in_progress_at: Optional[int] = None + + metadata: Optional[Dict[str, str]] = None + + model: Optional[str] = None + + output_file_id: Optional[str] = None + + request_counts: Optional[RequestCounts] = None + + usage: Optional[Usage] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, builtins.object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> builtins.object: ... + else: + __pydantic_extra__: Dict[str, builtins.object] diff --git a/src/llama_stack_client/types/batch_retrieve_response.py b/src/llama_stack_client/types/batch_retrieve_response.py new file mode 100644 index 00000000..b866a740 --- /dev/null +++ b/src/llama_stack_client/types/batch_retrieve_response.py @@ -0,0 +1,195 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import builtins +from typing import TYPE_CHECKING, Dict, List, Optional +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = [ + "BatchRetrieveResponse", + "Errors", + "ErrorsData", + "RequestCounts", + "Usage", + "UsageInputTokensDetails", + "UsageOutputTokensDetails", +] + + +class ErrorsData(BaseModel): + code: Optional[str] = None + + line: Optional[int] = None + + message: Optional[str] = None + + param: Optional[str] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class Errors(BaseModel): + data: Optional[List[ErrorsData]] = None + + object: Optional[str] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, builtins.object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> builtins.object: ... + else: + __pydantic_extra__: Dict[str, builtins.object] + + +class RequestCounts(BaseModel): + completed: int + + failed: int + + total: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class UsageInputTokensDetails(BaseModel): + cached_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class UsageOutputTokensDetails(BaseModel): + reasoning_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class Usage(BaseModel): + input_tokens: int + + input_tokens_details: UsageInputTokensDetails + + output_tokens: int + + output_tokens_details: UsageOutputTokensDetails + + total_tokens: int + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class BatchRetrieveResponse(BaseModel): + id: str + + completion_window: str + + created_at: int + + endpoint: str + + input_file_id: str + + object: Literal["batch"] + + status: Literal[ + "validating", "failed", "in_progress", "finalizing", "completed", "expired", "cancelling", "cancelled" + ] + + cancelled_at: Optional[int] = None + + cancelling_at: Optional[int] = None + + completed_at: Optional[int] = None + + error_file_id: Optional[str] = None + + errors: Optional[Errors] = None + + expired_at: Optional[int] = None + + expires_at: Optional[int] = None + + failed_at: Optional[int] = None + + finalizing_at: Optional[int] = None + + in_progress_at: Optional[int] = None + + metadata: Optional[Dict[str, str]] = None + + model: Optional[str] = None + + output_file_id: Optional[str] = None + + request_counts: Optional[RequestCounts] = None + + usage: Optional[Usage] = None + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, builtins.object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> builtins.object: ... + else: + __pydantic_extra__: Dict[str, builtins.object] diff --git a/src/llama_stack_client/types/beta/dataset_appendrows_params.py b/src/llama_stack_client/types/beta/dataset_appendrows_params.py index b929d790..828241f3 100644 --- a/src/llama_stack_client/types/beta/dataset_appendrows_params.py +++ b/src/llama_stack_client/types/beta/dataset_appendrows_params.py @@ -8,12 +8,11 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Iterable from typing_extensions import Required, TypedDict __all__ = ["DatasetAppendrowsParams"] class DatasetAppendrowsParams(TypedDict, total=False): - rows: Required[Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]] - """The rows to append to the dataset.""" + rows: Required[Iterable[Dict[str, object]]] diff --git a/src/llama_stack_client/types/beta/dataset_iterrows_params.py b/src/llama_stack_client/types/beta/dataset_iterrows_params.py index 262e0e3f..48282120 100644 --- a/src/llama_stack_client/types/beta/dataset_iterrows_params.py +++ b/src/llama_stack_client/types/beta/dataset_iterrows_params.py @@ -8,14 +8,13 @@ from __future__ import annotations +from typing import Optional from typing_extensions import TypedDict __all__ = ["DatasetIterrowsParams"] class DatasetIterrowsParams(TypedDict, total=False): - limit: int - """The number of rows to get.""" + limit: Optional[int] - start_index: int - """Index into dataset for the first row to get. Get all rows if None.""" + start_index: Optional[int] diff --git a/src/llama_stack_client/types/beta/dataset_iterrows_response.py b/src/llama_stack_client/types/beta/dataset_iterrows_response.py index 5b23d46d..72ae28ed 100644 --- a/src/llama_stack_client/types/beta/dataset_iterrows_response.py +++ b/src/llama_stack_client/types/beta/dataset_iterrows_response.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, List, Optional from ..._models import BaseModel @@ -14,11 +14,8 @@ class DatasetIterrowsResponse(BaseModel): - data: List[Dict[str, Union[bool, float, str, List[object], object, None]]] - """The list of items for the current page""" + data: List[Dict[str, object]] 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/beta/dataset_list_response.py b/src/llama_stack_client/types/beta/dataset_list_response.py index 7e6c1141..13669ca1 100644 --- a/src/llama_stack_client/types/beta/dataset_list_response.py +++ b/src/llama_stack_client/types/beta/dataset_list_response.py @@ -22,25 +22,15 @@ class DatasetListResponseItemSourceUriDataSource(BaseModel): - type: Literal["uri"] - uri: str - """The dataset can be obtained from a URI. - E.g. - "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" - - "data:csv;base64,{base64_content}" - """ + type: Optional[Literal["uri"]] = None class DatasetListResponseItemSourceRowsDataSource(BaseModel): - rows: List[Dict[str, Union[bool, float, str, List[object], object, None]]] - """The dataset is stored in rows. - - E.g. - [ {"messages": [{"role": "user", "content": "Hello, world!"}, {"role": - "assistant", "content": "Hello, world!"}]} ] - """ + rows: List[Dict[str, object]] - type: Literal["rows"] + type: Optional[Literal["rows"]] = None DatasetListResponseItemSource: TypeAlias = Annotated[ @@ -51,22 +41,24 @@ class DatasetListResponseItemSourceRowsDataSource(BaseModel): class DatasetListResponseItem(BaseModel): identifier: str - - metadata: Dict[str, Union[bool, float, str, List[object], object, None]] - """Additional metadata for the dataset""" + """Unique identifier for this resource in llama stack""" provider_id: str + """ID of the provider that owns this resource""" purpose: Literal["post-training/messages", "eval/question-answer", "eval/messages-answer"] - """Purpose of the dataset indicating its intended use""" + """Purpose of the dataset. Each purpose has a required input data schema.""" source: DatasetListResponseItemSource - """Data source configuration for the dataset""" + """A dataset that can be obtained from a URI.""" - type: Literal["dataset"] - """Type of resource, always 'dataset' for datasets""" + metadata: Optional[Dict[str, object]] = None + """Any additional metadata for this dataset""" provider_resource_id: Optional[str] = None + """Unique identifier for this resource in the provider""" + + type: Optional[Literal["dataset"]] = None DatasetListResponse: TypeAlias = List[DatasetListResponseItem] diff --git a/src/llama_stack_client/types/beta/dataset_register_params.py b/src/llama_stack_client/types/beta/dataset_register_params.py index 75803a8a..6192f3e0 100644 --- a/src/llama_stack_client/types/beta/dataset_register_params.py +++ b/src/llama_stack_client/types/beta/dataset_register_params.py @@ -8,68 +8,16 @@ from __future__ import annotations -from typing import Dict, Union, Iterable -from typing_extensions import Literal, Required, TypeAlias, TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["DatasetRegisterParams", "Source", "SourceUriDataSource", "SourceRowsDataSource"] +__all__ = ["DatasetRegisterParams"] class DatasetRegisterParams(TypedDict, total=False): - purpose: Required[Literal["post-training/messages", "eval/question-answer", "eval/messages-answer"]] - """The purpose of the dataset. + purpose: Required[object] - One of: - "post-training/messages": The dataset contains a messages column with - list of messages for post-training. { "messages": [ {"role": "user", "content": - "Hello, world!"}, {"role": "assistant", "content": "Hello, world!"}, ] } - - "eval/question-answer": The dataset contains a question column and an answer - column for evaluation. { "question": "What is the capital of France?", "answer": - "Paris" } - "eval/messages-answer": The dataset contains a messages column with - list of messages and an answer column for evaluation. { "messages": [ {"role": - "user", "content": "Hello, my name is John Doe."}, {"role": "assistant", - "content": "Hello, John Doe. How can I help you today?"}, {"role": "user", - "content": "What's my name?"}, ], "answer": "John Doe" } - """ + source: Required[object] - source: Required[Source] - """The data source of the dataset. + dataset_id: object - Ensure that the data source schema is compatible with the purpose of the - dataset. Examples: - { "type": "uri", "uri": - "https://mywebsite.com/mydata.jsonl" } - { "type": "uri", "uri": - "lsfs://mydata.jsonl" } - { "type": "uri", "uri": - "data:csv;base64,{base64_content}" } - { "type": "uri", "uri": - "huggingface://llamastack/simpleqa?split=train" } - { "type": "rows", "rows": [ - { "messages": [ {"role": "user", "content": "Hello, world!"}, {"role": - "assistant", "content": "Hello, world!"}, ] } ] } - """ - - dataset_id: str - """The ID of the dataset. If not provided, an ID will be generated.""" - - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """The metadata for the dataset. - E.g. {"description": "My dataset"}.""" - - -class SourceUriDataSource(TypedDict, total=False): - type: Required[Literal["uri"]] - - uri: Required[str] - """The dataset can be obtained from a URI. - - E.g. - "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" - - "data:csv;base64,{base64_content}" - """ - - -class SourceRowsDataSource(TypedDict, total=False): - rows: Required[Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]] - """The dataset is stored in rows. - - E.g. - [ {"messages": [{"role": "user", "content": "Hello, world!"}, {"role": - "assistant", "content": "Hello, world!"}]} ] - """ - - type: Required[Literal["rows"]] - - -Source: TypeAlias = Union[SourceUriDataSource, SourceRowsDataSource] + metadata: object diff --git a/src/llama_stack_client/types/beta/dataset_register_response.py b/src/llama_stack_client/types/beta/dataset_register_response.py index e9bb82d2..92b64afe 100644 --- a/src/llama_stack_client/types/beta/dataset_register_response.py +++ b/src/llama_stack_client/types/beta/dataset_register_response.py @@ -16,25 +16,15 @@ class SourceUriDataSource(BaseModel): - type: Literal["uri"] - uri: str - """The dataset can be obtained from a URI. - E.g. - "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" - - "data:csv;base64,{base64_content}" - """ + type: Optional[Literal["uri"]] = None class SourceRowsDataSource(BaseModel): - rows: List[Dict[str, Union[bool, float, str, List[object], object, None]]] - """The dataset is stored in rows. - - E.g. - [ {"messages": [{"role": "user", "content": "Hello, world!"}, {"role": - "assistant", "content": "Hello, world!"}]} ] - """ + rows: List[Dict[str, object]] - type: Literal["rows"] + type: Optional[Literal["rows"]] = None Source: TypeAlias = Annotated[Union[SourceUriDataSource, SourceRowsDataSource], PropertyInfo(discriminator="type")] @@ -42,19 +32,21 @@ class SourceRowsDataSource(BaseModel): class DatasetRegisterResponse(BaseModel): identifier: str - - metadata: Dict[str, Union[bool, float, str, List[object], object, None]] - """Additional metadata for the dataset""" + """Unique identifier for this resource in llama stack""" provider_id: str + """ID of the provider that owns this resource""" purpose: Literal["post-training/messages", "eval/question-answer", "eval/messages-answer"] - """Purpose of the dataset indicating its intended use""" + """Purpose of the dataset. Each purpose has a required input data schema.""" source: Source - """Data source configuration for the dataset""" + """A dataset that can be obtained from a URI.""" - type: Literal["dataset"] - """Type of resource, always 'dataset' for datasets""" + metadata: Optional[Dict[str, object]] = None + """Any additional metadata for this dataset""" provider_resource_id: Optional[str] = None + """Unique identifier for this resource in the provider""" + + type: Optional[Literal["dataset"]] = None diff --git a/src/llama_stack_client/types/beta/dataset_retrieve_response.py b/src/llama_stack_client/types/beta/dataset_retrieve_response.py index 3358288d..452042d2 100644 --- a/src/llama_stack_client/types/beta/dataset_retrieve_response.py +++ b/src/llama_stack_client/types/beta/dataset_retrieve_response.py @@ -16,25 +16,15 @@ class SourceUriDataSource(BaseModel): - type: Literal["uri"] - uri: str - """The dataset can be obtained from a URI. - E.g. - "https://mywebsite.com/mydata.jsonl" - "lsfs://mydata.jsonl" - - "data:csv;base64,{base64_content}" - """ + type: Optional[Literal["uri"]] = None class SourceRowsDataSource(BaseModel): - rows: List[Dict[str, Union[bool, float, str, List[object], object, None]]] - """The dataset is stored in rows. - - E.g. - [ {"messages": [{"role": "user", "content": "Hello, world!"}, {"role": - "assistant", "content": "Hello, world!"}]} ] - """ + rows: List[Dict[str, object]] - type: Literal["rows"] + type: Optional[Literal["rows"]] = None Source: TypeAlias = Annotated[Union[SourceUriDataSource, SourceRowsDataSource], PropertyInfo(discriminator="type")] @@ -42,19 +32,21 @@ class SourceRowsDataSource(BaseModel): class DatasetRetrieveResponse(BaseModel): identifier: str - - metadata: Dict[str, Union[bool, float, str, List[object], object, None]] - """Additional metadata for the dataset""" + """Unique identifier for this resource in llama stack""" provider_id: str + """ID of the provider that owns this resource""" purpose: Literal["post-training/messages", "eval/question-answer", "eval/messages-answer"] - """Purpose of the dataset indicating its intended use""" + """Purpose of the dataset. Each purpose has a required input data schema.""" source: Source - """Data source configuration for the dataset""" + """A dataset that can be obtained from a URI.""" - type: Literal["dataset"] - """Type of resource, always 'dataset' for datasets""" + metadata: Optional[Dict[str, object]] = None + """Any additional metadata for this dataset""" provider_resource_id: Optional[str] = None + """Unique identifier for this resource in the provider""" + + type: Optional[Literal["dataset"]] = None diff --git a/src/llama_stack_client/types/beta/list_datasets_response.py b/src/llama_stack_client/types/beta/list_datasets_response.py index 4f71ae16..a5f09b69 100644 --- a/src/llama_stack_client/types/beta/list_datasets_response.py +++ b/src/llama_stack_client/types/beta/list_datasets_response.py @@ -14,4 +14,3 @@ class ListDatasetsResponse(BaseModel): data: DatasetListResponse - """List of datasets""" diff --git a/src/llama_stack_client/types/chat/completion_create_params.py b/src/llama_stack_client/types/chat/completion_create_params.py index fb188ac1..21f63f3c 100644 --- a/src/llama_stack_client/types/chat/completion_create_params.py +++ b/src/llama_stack_client/types/chat/completion_create_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr @@ -16,23 +16,23 @@ __all__ = [ "CompletionCreateParamsBase", "Message", - "MessageOpenAIUserMessageParam", - "MessageOpenAIUserMessageParamContentUnionMember1", - "MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam", - "MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam", - "MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL", - "MessageOpenAIUserMessageParamContentUnionMember1OpenAIFile", - "MessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile", + "MessageOpenAIUserMessageParamInput", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile", "MessageOpenAISystemMessageParam", - "MessageOpenAISystemMessageParamContentUnionMember1", - "MessageOpenAIAssistantMessageParam", - "MessageOpenAIAssistantMessageParamContentUnionMember1", - "MessageOpenAIAssistantMessageParamToolCall", - "MessageOpenAIAssistantMessageParamToolCallFunction", + "MessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "MessageOpenAIAssistantMessageParamInput", + "MessageOpenAIAssistantMessageParamInputContentListOpenAIChatCompletionContentPartTextParam", + "MessageOpenAIAssistantMessageParamInputToolCall", + "MessageOpenAIAssistantMessageParamInputToolCallFunction", "MessageOpenAIToolMessageParam", - "MessageOpenAIToolMessageParamContentUnionMember1", + "MessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam", "MessageOpenAIDeveloperMessageParam", - "MessageOpenAIDeveloperMessageParamContentUnionMember1", + "MessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam", "ResponseFormat", "ResponseFormatOpenAIResponseFormatText", "ResponseFormatOpenAIResponseFormatJsonSchema", @@ -45,284 +45,237 @@ class CompletionCreateParamsBase(TypedDict, total=False): messages: Required[Iterable[Message]] - """List of messages in the conversation.""" model: Required[str] - """The identifier of the model to use. - The model must be registered with Llama Stack and available via the /models - endpoint. - """ + frequency_penalty: Optional[float] - frequency_penalty: float - """(Optional) The penalty for repeated tokens.""" + function_call: Union[str, Dict[str, object], None] - function_call: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """(Optional) The function call to use.""" + functions: Optional[Iterable[Dict[str, object]]] - functions: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """(Optional) List of functions to use.""" + logit_bias: Optional[Dict[str, float]] - logit_bias: Dict[str, float] - """(Optional) The logit bias to use.""" + logprobs: Optional[bool] - logprobs: bool - """(Optional) The log probabilities to use.""" + max_completion_tokens: Optional[int] - max_completion_tokens: int - """(Optional) The maximum number of tokens to generate.""" + max_tokens: Optional[int] - max_tokens: int - """(Optional) The maximum number of tokens to generate.""" + n: Optional[int] - n: int - """(Optional) The number of completions to generate.""" + parallel_tool_calls: Optional[bool] - parallel_tool_calls: bool - """(Optional) Whether to parallelize tool calls.""" + presence_penalty: Optional[float] - presence_penalty: float - """(Optional) The penalty for repeated tokens.""" + response_format: Optional[ResponseFormat] + """Text response format for OpenAI-compatible chat completion requests.""" - response_format: ResponseFormat - """(Optional) The response format to use.""" + seed: Optional[int] - seed: int - """(Optional) The seed to use.""" + stop: Union[str, SequenceNotStr[str], None] - stop: Union[str, SequenceNotStr[str]] - """(Optional) The stop tokens to use.""" + stream_options: Optional[Dict[str, object]] - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) The stream options to use.""" + temperature: Optional[float] - temperature: float - """(Optional) The temperature to use.""" + tool_choice: Union[str, Dict[str, object], None] - tool_choice: Union[str, Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """(Optional) The tool choice to use.""" + tools: Optional[Iterable[Dict[str, object]]] - tools: Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """(Optional) The tools to use.""" + top_logprobs: Optional[int] - top_logprobs: int - """(Optional) The top log probabilities to use.""" + top_p: Optional[float] - top_p: float - """(Optional) The top p to use.""" + user: Optional[str] - user: str - """(Optional) The user to use.""" - -class MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam(TypedDict, total=False): +class MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam( + TypedDict, total=False +): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] -class MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL( +class MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL( TypedDict, total=False ): url: Required[str] - """URL of the image to include in the message""" - - detail: str - """(Optional) Level of detail for image processing. - Can be "low", "high", or "auto" - """ + detail: Optional[str] -class MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam(TypedDict, total=False): +class MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam( + TypedDict, total=False +): image_url: Required[ - MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL ] - """Image URL specification and processing details""" + """Image URL specification for OpenAI-compatible chat completion messages.""" - type: Required[Literal["image_url"]] - """Must be "image_url" to identify this as image content""" + type: Literal["image_url"] -class MessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile(TypedDict, total=False): - file_data: str +class MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile( + TypedDict, total=False +): + file_data: Optional[str] - file_id: str + file_id: Optional[str] - filename: str + filename: Optional[str] -class MessageOpenAIUserMessageParamContentUnionMember1OpenAIFile(TypedDict, total=False): - file: Required[MessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile] +class MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile( + TypedDict, total=False +): + file: Required[ + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile + ] - type: Required[Literal["file"]] + type: Literal["file"] -MessageOpenAIUserMessageParamContentUnionMember1: TypeAlias = Union[ - MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam, - MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam, - MessageOpenAIUserMessageParamContentUnionMember1OpenAIFile, +MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile: TypeAlias = Union[ + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam, + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam, + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile, ] -class MessageOpenAIUserMessageParam(TypedDict, total=False): - content: Required[Union[str, Iterable[MessageOpenAIUserMessageParamContentUnionMember1]]] - """The content of the message, which can include text and other media""" +class MessageOpenAIUserMessageParamInput(TypedDict, total=False): + content: Required[ + Union[ + str, + Iterable[ + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile + ], + ] + ] - role: Required[Literal["user"]] - """Must be "user" to identify this as a user message""" + name: Optional[str] - name: str - """(Optional) The name of the user message participant.""" + role: Literal["user"] -class MessageOpenAISystemMessageParamContentUnionMember1(TypedDict, total=False): +class MessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam(TypedDict, total=False): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] class MessageOpenAISystemMessageParam(TypedDict, total=False): - content: Required[Union[str, Iterable[MessageOpenAISystemMessageParamContentUnionMember1]]] - """The content of the "system prompt". - - If multiple system messages are provided, they are concatenated. The underlying - Llama Stack code may also add other system messages (for example, for formatting - tool definitions). - """ + content: Required[ + Union[str, Iterable[MessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam]] + ] - role: Required[Literal["system"]] - """Must be "system" to identify this as a system message""" + name: Optional[str] - name: str - """(Optional) The name of the system message participant.""" + role: Literal["system"] -class MessageOpenAIAssistantMessageParamContentUnionMember1(TypedDict, total=False): +class MessageOpenAIAssistantMessageParamInputContentListOpenAIChatCompletionContentPartTextParam( + TypedDict, total=False +): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] -class MessageOpenAIAssistantMessageParamToolCallFunction(TypedDict, total=False): - arguments: str - """(Optional) Arguments to pass to the function as a JSON string""" +class MessageOpenAIAssistantMessageParamInputToolCallFunction(TypedDict, total=False): + arguments: Optional[str] - name: str - """(Optional) Name of the function to call""" + name: Optional[str] -class MessageOpenAIAssistantMessageParamToolCall(TypedDict, total=False): - type: Required[Literal["function"]] - """Must be "function" to identify this as a function call""" +class MessageOpenAIAssistantMessageParamInputToolCall(TypedDict, total=False): + id: Optional[str] - id: str - """(Optional) Unique identifier for the tool call""" + function: Optional[MessageOpenAIAssistantMessageParamInputToolCallFunction] + """Function call details for OpenAI-compatible tool calls.""" - function: MessageOpenAIAssistantMessageParamToolCallFunction - """(Optional) Function call details""" + index: Optional[int] - index: int - """(Optional) Index of the tool call in the list""" + type: Literal["function"] -class MessageOpenAIAssistantMessageParam(TypedDict, total=False): - role: Required[Literal["assistant"]] - """Must be "assistant" to identify this as the model's response""" +class MessageOpenAIAssistantMessageParamInput(TypedDict, total=False): + content: Union[ + str, Iterable[MessageOpenAIAssistantMessageParamInputContentListOpenAIChatCompletionContentPartTextParam], None + ] - content: Union[str, Iterable[MessageOpenAIAssistantMessageParamContentUnionMember1]] - """The content of the model's response""" + name: Optional[str] - name: str - """(Optional) The name of the assistant message participant.""" + role: Literal["assistant"] - tool_calls: Iterable[MessageOpenAIAssistantMessageParamToolCall] - """List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.""" + tool_calls: Optional[Iterable[MessageOpenAIAssistantMessageParamInputToolCall]] -class MessageOpenAIToolMessageParamContentUnionMember1(TypedDict, total=False): +class MessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam(TypedDict, total=False): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] class MessageOpenAIToolMessageParam(TypedDict, total=False): - content: Required[Union[str, Iterable[MessageOpenAIToolMessageParamContentUnionMember1]]] - """The response content from the tool""" - - role: Required[Literal["tool"]] - """Must be "tool" to identify this as a tool response""" + content: Required[ + Union[str, Iterable[MessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam]] + ] tool_call_id: Required[str] - """Unique identifier for the tool call this response is for""" + + role: Literal["tool"] -class MessageOpenAIDeveloperMessageParamContentUnionMember1(TypedDict, total=False): +class MessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam(TypedDict, total=False): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] class MessageOpenAIDeveloperMessageParam(TypedDict, total=False): - content: Required[Union[str, Iterable[MessageOpenAIDeveloperMessageParamContentUnionMember1]]] - """The content of the developer message""" + content: Required[ + Union[str, Iterable[MessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam]] + ] - role: Required[Literal["developer"]] - """Must be "developer" to identify this as a developer message""" + name: Optional[str] - name: str - """(Optional) The name of the developer message participant.""" + role: Literal["developer"] Message: TypeAlias = Union[ - MessageOpenAIUserMessageParam, + MessageOpenAIUserMessageParamInput, MessageOpenAISystemMessageParam, - MessageOpenAIAssistantMessageParam, + MessageOpenAIAssistantMessageParamInput, MessageOpenAIToolMessageParam, MessageOpenAIDeveloperMessageParam, ] class ResponseFormatOpenAIResponseFormatText(TypedDict, total=False): - type: Required[Literal["text"]] - """Must be "text" to indicate plain text response format""" + type: Literal["text"] class ResponseFormatOpenAIResponseFormatJsonSchemaJsonSchema(TypedDict, total=False): - name: Required[str] - """Name of the schema""" + description: Optional[str] - description: str - """(Optional) Description of the schema""" + name: str - schema: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) The JSON schema definition""" + schema: Optional[Dict[str, object]] - strict: bool - """(Optional) Whether to enforce strict adherence to the schema""" + strict: Optional[bool] class ResponseFormatOpenAIResponseFormatJsonSchema(TypedDict, total=False): json_schema: Required[ResponseFormatOpenAIResponseFormatJsonSchemaJsonSchema] - """The JSON schema specification for the response""" + """JSON schema specification for OpenAI-compatible structured response format.""" - type: Required[Literal["json_schema"]] - """Must be "json_schema" to indicate structured JSON response format""" + type: Literal["json_schema"] class ResponseFormatOpenAIResponseFormatJsonObject(TypedDict, total=False): - type: Required[Literal["json_object"]] - """Must be "json_object" to indicate generic JSON object response format""" + type: Literal["json_object"] ResponseFormat: TypeAlias = Union[ @@ -333,13 +286,11 @@ class ResponseFormatOpenAIResponseFormatJsonObject(TypedDict, total=False): class CompletionCreateParamsNonStreaming(CompletionCreateParamsBase, total=False): - stream: Literal[False] - """(Optional) Whether to stream the response.""" + stream: Optional[Literal[False]] class CompletionCreateParamsStreaming(CompletionCreateParamsBase): stream: Required[Literal[True]] - """(Optional) Whether to stream the response.""" CompletionCreateParams = Union[CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming] diff --git a/src/llama_stack_client/types/chat/completion_create_response.py b/src/llama_stack_client/types/chat/completion_create_response.py index 1aa5dc17..0a56bfb0 100644 --- a/src/llama_stack_client/types/chat/completion_create_response.py +++ b/src/llama_stack_client/types/chat/completion_create_response.py @@ -11,75 +11,67 @@ from ..._utils import PropertyInfo from ..._models import BaseModel -from ..chat_completion_chunk import ChatCompletionChunk __all__ = [ "CompletionCreateResponse", - "OpenAIChatCompletion", - "OpenAIChatCompletionChoice", - "OpenAIChatCompletionChoiceMessage", - "OpenAIChatCompletionChoiceMessageOpenAIUserMessageParam", - "OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1", - "OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam", - "OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam", - "OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL", - "OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile", - "OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile", - "OpenAIChatCompletionChoiceMessageOpenAISystemMessageParam", - "OpenAIChatCompletionChoiceMessageOpenAISystemMessageParamContentUnionMember1", - "OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParam", - "OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParamContentUnionMember1", - "OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParamToolCall", - "OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParamToolCallFunction", - "OpenAIChatCompletionChoiceMessageOpenAIToolMessageParam", - "OpenAIChatCompletionChoiceMessageOpenAIToolMessageParamContentUnionMember1", - "OpenAIChatCompletionChoiceMessageOpenAIDeveloperMessageParam", - "OpenAIChatCompletionChoiceMessageOpenAIDeveloperMessageParamContentUnionMember1", - "OpenAIChatCompletionChoiceLogprobs", - "OpenAIChatCompletionChoiceLogprobsContent", - "OpenAIChatCompletionChoiceLogprobsContentTopLogprob", - "OpenAIChatCompletionChoiceLogprobsRefusal", - "OpenAIChatCompletionChoiceLogprobsRefusalTopLogprob", - "OpenAIChatCompletionUsage", - "OpenAIChatCompletionUsageCompletionTokensDetails", - "OpenAIChatCompletionUsagePromptTokensDetails", + "Choice", + "ChoiceMessage", + "ChoiceMessageOpenAIUserMessageParamOutput", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile", + "ChoiceMessageOpenAISystemMessageParam", + "ChoiceMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "ChoiceMessageOpenAIAssistantMessageParamOutput", + "ChoiceMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam", + "ChoiceMessageOpenAIAssistantMessageParamOutputToolCall", + "ChoiceMessageOpenAIAssistantMessageParamOutputToolCallFunction", + "ChoiceMessageOpenAIToolMessageParam", + "ChoiceMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "ChoiceMessageOpenAIDeveloperMessageParam", + "ChoiceMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "ChoiceLogprobs", + "ChoiceLogprobsContent", + "ChoiceLogprobsContentTopLogprob", + "ChoiceLogprobsRefusal", + "ChoiceLogprobsRefusalTopLogprob", + "Usage", + "UsageCompletionTokensDetails", + "UsagePromptTokensDetails", ] -class OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam( +class ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam( BaseModel ): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None -class OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL( +class ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL( BaseModel ): url: str - """URL of the image to include in the message""" detail: Optional[str] = None - """(Optional) Level of detail for image processing. - - Can be "low", "high", or "auto" - """ -class OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam( +class ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam( BaseModel ): - image_url: OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL - """Image URL specification and processing details""" + image_url: ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL + """Image URL specification for OpenAI-compatible chat completion messages.""" - type: Literal["image_url"] - """Must be "image_url" to identify this as image content""" + type: Optional[Literal["image_url"]] = None -class OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile(BaseModel): +class ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile( + BaseModel +): file_data: Optional[str] = None file_id: Optional[str] = None @@ -87,154 +79,131 @@ class OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1 filename: Optional[str] = None -class OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile(BaseModel): - file: OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile +class ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile( + BaseModel +): + file: ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile - type: Literal["file"] + type: Optional[Literal["file"]] = None -OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1: TypeAlias = Annotated[ +ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile: TypeAlias = Annotated[ Union[ - OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam, - OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam, - OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile, + ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam, + ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam, + ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile, ], PropertyInfo(discriminator="type"), ] -class OpenAIChatCompletionChoiceMessageOpenAIUserMessageParam(BaseModel): - content: Union[str, List[OpenAIChatCompletionChoiceMessageOpenAIUserMessageParamContentUnionMember1]] - """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""" +class ChoiceMessageOpenAIUserMessageParamOutput(BaseModel): + content: Union[ + str, + List[ + ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile + ], + ] name: Optional[str] = None - """(Optional) The name of the user message participant.""" - -class OpenAIChatCompletionChoiceMessageOpenAISystemMessageParamContentUnionMember1(BaseModel): - text: str - """The text content of the message""" + role: Optional[Literal["user"]] = None - type: Literal["text"] - """Must be "text" to identify this as text content""" +class ChoiceMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): + text: str -class OpenAIChatCompletionChoiceMessageOpenAISystemMessageParam(BaseModel): - content: Union[str, List[OpenAIChatCompletionChoiceMessageOpenAISystemMessageParamContentUnionMember1]] - """The content of the "system prompt". + type: Optional[Literal["text"]] = None - If multiple system messages are provided, they are concatenated. The underlying - Llama Stack code may also add other system messages (for example, for formatting - tool definitions). - """ - role: Literal["system"] - """Must be "system" to identify this as a system message""" +class ChoiceMessageOpenAISystemMessageParam(BaseModel): + content: Union[str, List[ChoiceMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam]] name: Optional[str] = None - """(Optional) The name of the system message participant.""" + role: Optional[Literal["system"]] = None -class OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParamContentUnionMember1(BaseModel): + +class ChoiceMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam(BaseModel): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None -class OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParamToolCallFunction(BaseModel): +class ChoiceMessageOpenAIAssistantMessageParamOutputToolCallFunction(BaseModel): arguments: Optional[str] = None - """(Optional) Arguments to pass to the function as a JSON string""" name: Optional[str] = None - """(Optional) Name of the function to call""" - -class OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParamToolCall(BaseModel): - type: Literal["function"] - """Must be "function" to identify this as a function call""" +class ChoiceMessageOpenAIAssistantMessageParamOutputToolCall(BaseModel): id: Optional[str] = None - """(Optional) Unique identifier for the tool call""" - function: Optional[OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParamToolCallFunction] = None - """(Optional) Function call details""" + function: Optional[ChoiceMessageOpenAIAssistantMessageParamOutputToolCallFunction] = None + """Function call details for OpenAI-compatible tool calls.""" index: Optional[int] = None - """(Optional) Index of the tool call in the list""" + type: Optional[Literal["function"]] = None -class OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParam(BaseModel): - role: Literal["assistant"] - """Must be "assistant" to identify this as the model's response""" - content: Union[str, List[OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParamContentUnionMember1], None] = ( - None - ) - """The content of the model's response""" +class ChoiceMessageOpenAIAssistantMessageParamOutput(BaseModel): + content: Union[ + str, + List[ChoiceMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam], + None, + ] = None name: Optional[str] = None - """(Optional) The name of the assistant message participant.""" - tool_calls: Optional[List[OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParamToolCall]] = None - """List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.""" + role: Optional[Literal["assistant"]] = None + tool_calls: Optional[List[ChoiceMessageOpenAIAssistantMessageParamOutputToolCall]] = None -class OpenAIChatCompletionChoiceMessageOpenAIToolMessageParamContentUnionMember1(BaseModel): - text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" +class ChoiceMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): + text: str + type: Optional[Literal["text"]] = None -class OpenAIChatCompletionChoiceMessageOpenAIToolMessageParam(BaseModel): - content: Union[str, List[OpenAIChatCompletionChoiceMessageOpenAIToolMessageParamContentUnionMember1]] - """The response content from the tool""" - role: Literal["tool"] - """Must be "tool" to identify this as a tool response""" +class ChoiceMessageOpenAIToolMessageParam(BaseModel): + content: Union[str, List[ChoiceMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam]] tool_call_id: str - """Unique identifier for the tool call this response is for""" + role: Optional[Literal["tool"]] = None -class OpenAIChatCompletionChoiceMessageOpenAIDeveloperMessageParamContentUnionMember1(BaseModel): - text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" +class ChoiceMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): + text: str + type: Optional[Literal["text"]] = None -class OpenAIChatCompletionChoiceMessageOpenAIDeveloperMessageParam(BaseModel): - content: Union[str, List[OpenAIChatCompletionChoiceMessageOpenAIDeveloperMessageParamContentUnionMember1]] - """The content of the developer message""" - role: Literal["developer"] - """Must be "developer" to identify this as a developer message""" +class ChoiceMessageOpenAIDeveloperMessageParam(BaseModel): + content: Union[ + str, List[ChoiceMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam] + ] name: Optional[str] = None - """(Optional) The name of the developer message participant.""" + role: Optional[Literal["developer"]] = None -OpenAIChatCompletionChoiceMessage: TypeAlias = Annotated[ + +ChoiceMessage: TypeAlias = Annotated[ Union[ - OpenAIChatCompletionChoiceMessageOpenAIUserMessageParam, - OpenAIChatCompletionChoiceMessageOpenAISystemMessageParam, - OpenAIChatCompletionChoiceMessageOpenAIAssistantMessageParam, - OpenAIChatCompletionChoiceMessageOpenAIToolMessageParam, - OpenAIChatCompletionChoiceMessageOpenAIDeveloperMessageParam, + ChoiceMessageOpenAIUserMessageParamOutput, + ChoiceMessageOpenAISystemMessageParam, + ChoiceMessageOpenAIAssistantMessageParamOutput, + ChoiceMessageOpenAIToolMessageParam, + ChoiceMessageOpenAIDeveloperMessageParam, ], PropertyInfo(discriminator="role"), ] -class OpenAIChatCompletionChoiceLogprobsContentTopLogprob(BaseModel): +class ChoiceLogprobsContentTopLogprob(BaseModel): token: str logprob: float @@ -242,17 +211,17 @@ class OpenAIChatCompletionChoiceLogprobsContentTopLogprob(BaseModel): bytes: Optional[List[int]] = None -class OpenAIChatCompletionChoiceLogprobsContent(BaseModel): +class ChoiceLogprobsContent(BaseModel): token: str logprob: float - top_logprobs: List[OpenAIChatCompletionChoiceLogprobsContentTopLogprob] + top_logprobs: List[ChoiceLogprobsContentTopLogprob] bytes: Optional[List[int]] = None -class OpenAIChatCompletionChoiceLogprobsRefusalTopLogprob(BaseModel): +class ChoiceLogprobsRefusalTopLogprob(BaseModel): token: str logprob: float @@ -260,83 +229,69 @@ class OpenAIChatCompletionChoiceLogprobsRefusalTopLogprob(BaseModel): bytes: Optional[List[int]] = None -class OpenAIChatCompletionChoiceLogprobsRefusal(BaseModel): +class ChoiceLogprobsRefusal(BaseModel): token: str logprob: float - top_logprobs: List[OpenAIChatCompletionChoiceLogprobsRefusalTopLogprob] + top_logprobs: List[ChoiceLogprobsRefusalTopLogprob] bytes: Optional[List[int]] = None -class OpenAIChatCompletionChoiceLogprobs(BaseModel): - content: Optional[List[OpenAIChatCompletionChoiceLogprobsContent]] = None - """(Optional) The log probabilities for the tokens in the message""" +class ChoiceLogprobs(BaseModel): + content: Optional[List[ChoiceLogprobsContent]] = None - refusal: Optional[List[OpenAIChatCompletionChoiceLogprobsRefusal]] = None - """(Optional) The log probabilities for the tokens in the message""" + refusal: Optional[List[ChoiceLogprobsRefusal]] = None -class OpenAIChatCompletionChoice(BaseModel): +class Choice(BaseModel): finish_reason: str - """The reason the model stopped generating""" index: int - """The index of the choice""" - message: OpenAIChatCompletionChoiceMessage - """The message from the model""" + message: ChoiceMessage + """A message from the user in an OpenAI-compatible chat completion request.""" - logprobs: Optional[OpenAIChatCompletionChoiceLogprobs] = None - """(Optional) The log probabilities for the tokens in the message""" + logprobs: Optional[ChoiceLogprobs] = None + """ + The log probabilities for the tokens in the message from an OpenAI-compatible + chat completion response. + """ -class OpenAIChatCompletionUsageCompletionTokensDetails(BaseModel): +class UsageCompletionTokensDetails(BaseModel): reasoning_tokens: Optional[int] = None - """Number of tokens used for reasoning (o1/o3 models)""" -class OpenAIChatCompletionUsagePromptTokensDetails(BaseModel): +class UsagePromptTokensDetails(BaseModel): cached_tokens: Optional[int] = None - """Number of tokens retrieved from cache""" -class OpenAIChatCompletionUsage(BaseModel): +class Usage(BaseModel): completion_tokens: int - """Number of tokens in the completion""" prompt_tokens: int - """Number of tokens in the prompt""" total_tokens: int - """Total tokens used (prompt + completion)""" - completion_tokens_details: Optional[OpenAIChatCompletionUsageCompletionTokensDetails] = None + completion_tokens_details: Optional[UsageCompletionTokensDetails] = None """Token details for output tokens in OpenAI chat completion usage.""" - prompt_tokens_details: Optional[OpenAIChatCompletionUsagePromptTokensDetails] = None + prompt_tokens_details: Optional[UsagePromptTokensDetails] = None """Token details for prompt tokens in OpenAI chat completion usage.""" -class OpenAIChatCompletion(BaseModel): +class CompletionCreateResponse(BaseModel): id: str - """The ID of the chat completion""" - choices: List[OpenAIChatCompletionChoice] - """List of choices""" + choices: List[Choice] created: int - """The Unix timestamp in seconds when the chat completion was created""" model: str - """The model that was used to generate the chat completion""" - - object: Literal["chat.completion"] - """The object type, which will be "chat.completion" """ - - usage: Optional[OpenAIChatCompletionUsage] = None - """Token usage information for the completion""" + object: Optional[Literal["chat.completion"]] = None -CompletionCreateResponse: TypeAlias = Union[OpenAIChatCompletion, ChatCompletionChunk] + usage: Optional[Usage] = None + """Usage information for OpenAI chat completion.""" diff --git a/src/llama_stack_client/types/chat/completion_list_params.py b/src/llama_stack_client/types/chat/completion_list_params.py index 71f77f90..a4d45011 100644 --- a/src/llama_stack_client/types/chat/completion_list_params.py +++ b/src/llama_stack_client/types/chat/completion_list_params.py @@ -8,20 +8,18 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Literal, TypedDict __all__ = ["CompletionListParams"] class CompletionListParams(TypedDict, total=False): - after: str - """The ID of the last chat completion to return.""" + after: Optional[str] - limit: int - """The maximum number of chat completions to return.""" + limit: Optional[int] - model: str - """The model to filter by.""" + model: Optional[str] - order: Literal["asc", "desc"] - """The order to sort the chat completions by: "asc" or "desc". Defaults to "desc".""" + order: Optional[Literal["asc", "desc"]] + """Sort order for paginated responses.""" diff --git a/src/llama_stack_client/types/chat/completion_list_response.py b/src/llama_stack_client/types/chat/completion_list_response.py index 059c89c0..ba9cd127 100644 --- a/src/llama_stack_client/types/chat/completion_list_response.py +++ b/src/llama_stack_client/types/chat/completion_list_response.py @@ -14,84 +14,83 @@ __all__ = [ "CompletionListResponse", - "Choice", - "ChoiceMessage", - "ChoiceMessageOpenAIUserMessageParam", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile", - "ChoiceMessageOpenAISystemMessageParam", - "ChoiceMessageOpenAISystemMessageParamContentUnionMember1", - "ChoiceMessageOpenAIAssistantMessageParam", - "ChoiceMessageOpenAIAssistantMessageParamContentUnionMember1", - "ChoiceMessageOpenAIAssistantMessageParamToolCall", - "ChoiceMessageOpenAIAssistantMessageParamToolCallFunction", - "ChoiceMessageOpenAIToolMessageParam", - "ChoiceMessageOpenAIToolMessageParamContentUnionMember1", - "ChoiceMessageOpenAIDeveloperMessageParam", - "ChoiceMessageOpenAIDeveloperMessageParamContentUnionMember1", - "ChoiceLogprobs", - "ChoiceLogprobsContent", - "ChoiceLogprobsContentTopLogprob", - "ChoiceLogprobsRefusal", - "ChoiceLogprobsRefusalTopLogprob", - "InputMessage", - "InputMessageOpenAIUserMessageParam", - "InputMessageOpenAIUserMessageParamContentUnionMember1", - "InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam", - "InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam", - "InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL", - "InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile", - "InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile", - "InputMessageOpenAISystemMessageParam", - "InputMessageOpenAISystemMessageParamContentUnionMember1", - "InputMessageOpenAIAssistantMessageParam", - "InputMessageOpenAIAssistantMessageParamContentUnionMember1", - "InputMessageOpenAIAssistantMessageParamToolCall", - "InputMessageOpenAIAssistantMessageParamToolCallFunction", - "InputMessageOpenAIToolMessageParam", - "InputMessageOpenAIToolMessageParamContentUnionMember1", - "InputMessageOpenAIDeveloperMessageParam", - "InputMessageOpenAIDeveloperMessageParamContentUnionMember1", - "Usage", - "UsageCompletionTokensDetails", - "UsagePromptTokensDetails", + "Data", + "DataChoice", + "DataChoiceMessage", + "DataChoiceMessageOpenAIUserMessageParamOutput", + "DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile", + "DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam", + "DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam", + "DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL", + "DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile", + "DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile", + "DataChoiceMessageOpenAISystemMessageParam", + "DataChoiceMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "DataChoiceMessageOpenAIAssistantMessageParamOutput", + "DataChoiceMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam", + "DataChoiceMessageOpenAIAssistantMessageParamOutputToolCall", + "DataChoiceMessageOpenAIAssistantMessageParamOutputToolCallFunction", + "DataChoiceMessageOpenAIToolMessageParam", + "DataChoiceMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "DataChoiceMessageOpenAIDeveloperMessageParam", + "DataChoiceMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "DataChoiceLogprobs", + "DataChoiceLogprobsContent", + "DataChoiceLogprobsContentTopLogprob", + "DataChoiceLogprobsRefusal", + "DataChoiceLogprobsRefusalTopLogprob", + "DataInputMessage", + "DataInputMessageOpenAIUserMessageParamOutput", + "DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile", + "DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam", + "DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam", + "DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL", + "DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile", + "DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile", + "DataInputMessageOpenAISystemMessageParam", + "DataInputMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "DataInputMessageOpenAIAssistantMessageParamOutput", + "DataInputMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam", + "DataInputMessageOpenAIAssistantMessageParamOutputToolCall", + "DataInputMessageOpenAIAssistantMessageParamOutputToolCallFunction", + "DataInputMessageOpenAIToolMessageParam", + "DataInputMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "DataInputMessageOpenAIDeveloperMessageParam", + "DataInputMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "DataUsage", + "DataUsageCompletionTokensDetails", + "DataUsagePromptTokensDetails", ] -class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam(BaseModel): +class DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam( + BaseModel +): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None -class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL( +class DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL( BaseModel ): url: str - """URL of the image to include in the message""" detail: Optional[str] = None - """(Optional) Level of detail for image processing. - - Can be "low", "high", or "auto" - """ -class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam(BaseModel): - image_url: ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL - """Image URL specification and processing details""" +class DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam( + BaseModel +): + image_url: DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL + """Image URL specification for OpenAI-compatible chat completion messages.""" - type: Literal["image_url"] - """Must be "image_url" to identify this as image content""" + type: Optional[Literal["image_url"]] = None -class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile(BaseModel): +class DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile( + BaseModel +): file_data: Optional[str] = None file_id: Optional[str] = None @@ -99,152 +98,135 @@ class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile(BaseM filename: Optional[str] = None -class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile(BaseModel): - file: ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile +class DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile( + BaseModel +): + file: DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile - type: Literal["file"] + type: Optional[Literal["file"]] = None -ChoiceMessageOpenAIUserMessageParamContentUnionMember1: TypeAlias = Annotated[ +DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile: TypeAlias = Annotated[ Union[ - ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam, - ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam, - ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile, + DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam, + DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam, + DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile, ], PropertyInfo(discriminator="type"), ] -class ChoiceMessageOpenAIUserMessageParam(BaseModel): - content: Union[str, List[ChoiceMessageOpenAIUserMessageParamContentUnionMember1]] - """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""" +class DataChoiceMessageOpenAIUserMessageParamOutput(BaseModel): + content: Union[ + str, + List[ + DataChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile + ], + ] name: Optional[str] = None - """(Optional) The name of the user message participant.""" + role: Optional[Literal["user"]] = None -class ChoiceMessageOpenAISystemMessageParamContentUnionMember1(BaseModel): - text: str - """The text content of the message""" - - type: Literal["text"] - """Must be "text" to identify this as text content""" +class DataChoiceMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): + text: str -class ChoiceMessageOpenAISystemMessageParam(BaseModel): - content: Union[str, List[ChoiceMessageOpenAISystemMessageParamContentUnionMember1]] - """The content of the "system prompt". + type: Optional[Literal["text"]] = None - If multiple system messages are provided, they are concatenated. The underlying - Llama Stack code may also add other system messages (for example, for formatting - tool definitions). - """ - role: Literal["system"] - """Must be "system" to identify this as a system message""" +class DataChoiceMessageOpenAISystemMessageParam(BaseModel): + content: Union[ + str, List[DataChoiceMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam] + ] name: Optional[str] = None - """(Optional) The name of the system message participant.""" + + role: Optional[Literal["system"]] = None -class ChoiceMessageOpenAIAssistantMessageParamContentUnionMember1(BaseModel): +class DataChoiceMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam(BaseModel): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None -class ChoiceMessageOpenAIAssistantMessageParamToolCallFunction(BaseModel): +class DataChoiceMessageOpenAIAssistantMessageParamOutputToolCallFunction(BaseModel): arguments: Optional[str] = None - """(Optional) Arguments to pass to the function as a JSON string""" name: Optional[str] = None - """(Optional) Name of the function to call""" -class ChoiceMessageOpenAIAssistantMessageParamToolCall(BaseModel): - type: Literal["function"] - """Must be "function" to identify this as a function call""" - +class DataChoiceMessageOpenAIAssistantMessageParamOutputToolCall(BaseModel): id: Optional[str] = None - """(Optional) Unique identifier for the tool call""" - function: Optional[ChoiceMessageOpenAIAssistantMessageParamToolCallFunction] = None - """(Optional) Function call details""" + function: Optional[DataChoiceMessageOpenAIAssistantMessageParamOutputToolCallFunction] = None + """Function call details for OpenAI-compatible tool calls.""" index: Optional[int] = None - """(Optional) Index of the tool call in the list""" + type: Optional[Literal["function"]] = None -class ChoiceMessageOpenAIAssistantMessageParam(BaseModel): - role: Literal["assistant"] - """Must be "assistant" to identify this as the model's response""" - content: Union[str, List[ChoiceMessageOpenAIAssistantMessageParamContentUnionMember1], None] = None - """The content of the model's response""" +class DataChoiceMessageOpenAIAssistantMessageParamOutput(BaseModel): + content: Union[ + str, + List[DataChoiceMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam], + None, + ] = None name: Optional[str] = None - """(Optional) The name of the assistant message participant.""" - tool_calls: Optional[List[ChoiceMessageOpenAIAssistantMessageParamToolCall]] = None - """List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.""" + role: Optional[Literal["assistant"]] = None + tool_calls: Optional[List[DataChoiceMessageOpenAIAssistantMessageParamOutputToolCall]] = None -class ChoiceMessageOpenAIToolMessageParamContentUnionMember1(BaseModel): - text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" +class DataChoiceMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): + text: str + type: Optional[Literal["text"]] = None -class ChoiceMessageOpenAIToolMessageParam(BaseModel): - content: Union[str, List[ChoiceMessageOpenAIToolMessageParamContentUnionMember1]] - """The response content from the tool""" - role: Literal["tool"] - """Must be "tool" to identify this as a tool response""" +class DataChoiceMessageOpenAIToolMessageParam(BaseModel): + content: Union[ + str, List[DataChoiceMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam] + ] tool_call_id: str - """Unique identifier for the tool call this response is for""" + role: Optional[Literal["tool"]] = None -class ChoiceMessageOpenAIDeveloperMessageParamContentUnionMember1(BaseModel): - text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" +class DataChoiceMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): + text: str + type: Optional[Literal["text"]] = None -class ChoiceMessageOpenAIDeveloperMessageParam(BaseModel): - content: Union[str, List[ChoiceMessageOpenAIDeveloperMessageParamContentUnionMember1]] - """The content of the developer message""" - role: Literal["developer"] - """Must be "developer" to identify this as a developer message""" +class DataChoiceMessageOpenAIDeveloperMessageParam(BaseModel): + content: Union[ + str, List[DataChoiceMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam] + ] name: Optional[str] = None - """(Optional) The name of the developer message participant.""" + role: Optional[Literal["developer"]] = None -ChoiceMessage: TypeAlias = Annotated[ + +DataChoiceMessage: TypeAlias = Annotated[ Union[ - ChoiceMessageOpenAIUserMessageParam, - ChoiceMessageOpenAISystemMessageParam, - ChoiceMessageOpenAIAssistantMessageParam, - ChoiceMessageOpenAIToolMessageParam, - ChoiceMessageOpenAIDeveloperMessageParam, + DataChoiceMessageOpenAIUserMessageParamOutput, + DataChoiceMessageOpenAISystemMessageParam, + DataChoiceMessageOpenAIAssistantMessageParamOutput, + DataChoiceMessageOpenAIToolMessageParam, + DataChoiceMessageOpenAIDeveloperMessageParam, ], PropertyInfo(discriminator="role"), ] -class ChoiceLogprobsContentTopLogprob(BaseModel): +class DataChoiceLogprobsContentTopLogprob(BaseModel): token: str logprob: float @@ -252,17 +234,17 @@ class ChoiceLogprobsContentTopLogprob(BaseModel): bytes: Optional[List[int]] = None -class ChoiceLogprobsContent(BaseModel): +class DataChoiceLogprobsContent(BaseModel): token: str logprob: float - top_logprobs: List[ChoiceLogprobsContentTopLogprob] + top_logprobs: List[DataChoiceLogprobsContentTopLogprob] bytes: Optional[List[int]] = None -class ChoiceLogprobsRefusalTopLogprob(BaseModel): +class DataChoiceLogprobsRefusalTopLogprob(BaseModel): token: str logprob: float @@ -270,66 +252,65 @@ class ChoiceLogprobsRefusalTopLogprob(BaseModel): bytes: Optional[List[int]] = None -class ChoiceLogprobsRefusal(BaseModel): +class DataChoiceLogprobsRefusal(BaseModel): token: str logprob: float - top_logprobs: List[ChoiceLogprobsRefusalTopLogprob] + top_logprobs: List[DataChoiceLogprobsRefusalTopLogprob] bytes: Optional[List[int]] = None -class ChoiceLogprobs(BaseModel): - content: Optional[List[ChoiceLogprobsContent]] = None - """(Optional) The log probabilities for the tokens in the message""" +class DataChoiceLogprobs(BaseModel): + content: Optional[List[DataChoiceLogprobsContent]] = None - refusal: Optional[List[ChoiceLogprobsRefusal]] = None - """(Optional) The log probabilities for the tokens in the message""" + refusal: Optional[List[DataChoiceLogprobsRefusal]] = None -class Choice(BaseModel): +class DataChoice(BaseModel): finish_reason: str - """The reason the model stopped generating""" index: int - """The index of the choice""" - message: ChoiceMessage - """The message from the model""" + message: DataChoiceMessage + """A message from the user in an OpenAI-compatible chat completion request.""" - logprobs: Optional[ChoiceLogprobs] = None - """(Optional) The log probabilities for the tokens in the message""" + logprobs: Optional[DataChoiceLogprobs] = None + """ + The log probabilities for the tokens in the message from an OpenAI-compatible + chat completion response. + """ -class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam(BaseModel): +class DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam( + BaseModel +): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None -class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL(BaseModel): +class DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL( + BaseModel +): url: str - """URL of the image to include in the message""" detail: Optional[str] = None - """(Optional) Level of detail for image processing. - - Can be "low", "high", or "auto" - """ -class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam(BaseModel): - image_url: InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL - """Image URL specification and processing details""" +class DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam( + BaseModel +): + image_url: DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL + """Image URL specification for OpenAI-compatible chat completion messages.""" - type: Literal["image_url"] - """Must be "image_url" to identify this as image content""" + type: Optional[Literal["image_url"]] = None -class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile(BaseModel): +class DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile( + BaseModel +): file_data: Optional[str] = None file_id: Optional[str] = None @@ -337,195 +318,178 @@ class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile(BaseMo filename: Optional[str] = None -class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile(BaseModel): - file: InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile +class DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile( + BaseModel +): + file: DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile - type: Literal["file"] + type: Optional[Literal["file"]] = None -InputMessageOpenAIUserMessageParamContentUnionMember1: TypeAlias = Annotated[ +DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile: TypeAlias = Annotated[ Union[ - InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam, - InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam, - InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile, + DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam, + DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam, + DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile, ], PropertyInfo(discriminator="type"), ] -class InputMessageOpenAIUserMessageParam(BaseModel): - content: Union[str, List[InputMessageOpenAIUserMessageParamContentUnionMember1]] - """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""" +class DataInputMessageOpenAIUserMessageParamOutput(BaseModel): + content: Union[ + str, + List[ + DataInputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile + ], + ] name: Optional[str] = None - """(Optional) The name of the user message participant.""" + role: Optional[Literal["user"]] = None -class InputMessageOpenAISystemMessageParamContentUnionMember1(BaseModel): - text: str - """The text content of the message""" - - type: Literal["text"] - """Must be "text" to identify this as text content""" +class DataInputMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): + text: str -class InputMessageOpenAISystemMessageParam(BaseModel): - content: Union[str, List[InputMessageOpenAISystemMessageParamContentUnionMember1]] - """The content of the "system prompt". + type: Optional[Literal["text"]] = None - If multiple system messages are provided, they are concatenated. The underlying - Llama Stack code may also add other system messages (for example, for formatting - tool definitions). - """ - role: Literal["system"] - """Must be "system" to identify this as a system message""" +class DataInputMessageOpenAISystemMessageParam(BaseModel): + content: Union[ + str, List[DataInputMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam] + ] name: Optional[str] = None - """(Optional) The name of the system message participant.""" + + role: Optional[Literal["system"]] = None -class InputMessageOpenAIAssistantMessageParamContentUnionMember1(BaseModel): +class DataInputMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam(BaseModel): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None -class InputMessageOpenAIAssistantMessageParamToolCallFunction(BaseModel): +class DataInputMessageOpenAIAssistantMessageParamOutputToolCallFunction(BaseModel): arguments: Optional[str] = None - """(Optional) Arguments to pass to the function as a JSON string""" name: Optional[str] = None - """(Optional) Name of the function to call""" -class InputMessageOpenAIAssistantMessageParamToolCall(BaseModel): - type: Literal["function"] - """Must be "function" to identify this as a function call""" - +class DataInputMessageOpenAIAssistantMessageParamOutputToolCall(BaseModel): id: Optional[str] = None - """(Optional) Unique identifier for the tool call""" - function: Optional[InputMessageOpenAIAssistantMessageParamToolCallFunction] = None - """(Optional) Function call details""" + function: Optional[DataInputMessageOpenAIAssistantMessageParamOutputToolCallFunction] = None + """Function call details for OpenAI-compatible tool calls.""" index: Optional[int] = None - """(Optional) Index of the tool call in the list""" + type: Optional[Literal["function"]] = None -class InputMessageOpenAIAssistantMessageParam(BaseModel): - role: Literal["assistant"] - """Must be "assistant" to identify this as the model's response""" - content: Union[str, List[InputMessageOpenAIAssistantMessageParamContentUnionMember1], None] = None - """The content of the model's response""" +class DataInputMessageOpenAIAssistantMessageParamOutput(BaseModel): + content: Union[ + str, + List[DataInputMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam], + None, + ] = None name: Optional[str] = None - """(Optional) The name of the assistant message participant.""" - tool_calls: Optional[List[InputMessageOpenAIAssistantMessageParamToolCall]] = None - """List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.""" + role: Optional[Literal["assistant"]] = None + tool_calls: Optional[List[DataInputMessageOpenAIAssistantMessageParamOutputToolCall]] = None -class InputMessageOpenAIToolMessageParamContentUnionMember1(BaseModel): - text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" +class DataInputMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): + text: str + type: Optional[Literal["text"]] = None -class InputMessageOpenAIToolMessageParam(BaseModel): - content: Union[str, List[InputMessageOpenAIToolMessageParamContentUnionMember1]] - """The response content from the tool""" - role: Literal["tool"] - """Must be "tool" to identify this as a tool response""" +class DataInputMessageOpenAIToolMessageParam(BaseModel): + content: Union[str, List[DataInputMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam]] tool_call_id: str - """Unique identifier for the tool call this response is for""" + role: Optional[Literal["tool"]] = None -class InputMessageOpenAIDeveloperMessageParamContentUnionMember1(BaseModel): - text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" +class DataInputMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): + text: str + type: Optional[Literal["text"]] = None -class InputMessageOpenAIDeveloperMessageParam(BaseModel): - content: Union[str, List[InputMessageOpenAIDeveloperMessageParamContentUnionMember1]] - """The content of the developer message""" - role: Literal["developer"] - """Must be "developer" to identify this as a developer message""" +class DataInputMessageOpenAIDeveloperMessageParam(BaseModel): + content: Union[ + str, List[DataInputMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam] + ] name: Optional[str] = None - """(Optional) The name of the developer message participant.""" + + role: Optional[Literal["developer"]] = None -InputMessage: TypeAlias = Annotated[ +DataInputMessage: TypeAlias = Annotated[ Union[ - InputMessageOpenAIUserMessageParam, - InputMessageOpenAISystemMessageParam, - InputMessageOpenAIAssistantMessageParam, - InputMessageOpenAIToolMessageParam, - InputMessageOpenAIDeveloperMessageParam, + DataInputMessageOpenAIUserMessageParamOutput, + DataInputMessageOpenAISystemMessageParam, + DataInputMessageOpenAIAssistantMessageParamOutput, + DataInputMessageOpenAIToolMessageParam, + DataInputMessageOpenAIDeveloperMessageParam, ], PropertyInfo(discriminator="role"), ] -class UsageCompletionTokensDetails(BaseModel): +class DataUsageCompletionTokensDetails(BaseModel): reasoning_tokens: Optional[int] = None - """Number of tokens used for reasoning (o1/o3 models)""" -class UsagePromptTokensDetails(BaseModel): +class DataUsagePromptTokensDetails(BaseModel): cached_tokens: Optional[int] = None - """Number of tokens retrieved from cache""" -class Usage(BaseModel): +class DataUsage(BaseModel): completion_tokens: int - """Number of tokens in the completion""" prompt_tokens: int - """Number of tokens in the prompt""" total_tokens: int - """Total tokens used (prompt + completion)""" - completion_tokens_details: Optional[UsageCompletionTokensDetails] = None + completion_tokens_details: Optional[DataUsageCompletionTokensDetails] = None """Token details for output tokens in OpenAI chat completion usage.""" - prompt_tokens_details: Optional[UsagePromptTokensDetails] = None + prompt_tokens_details: Optional[DataUsagePromptTokensDetails] = None """Token details for prompt tokens in OpenAI chat completion usage.""" -class CompletionListResponse(BaseModel): +class Data(BaseModel): id: str - """The ID of the chat completion""" - choices: List[Choice] - """List of choices""" + choices: List[DataChoice] created: int - """The Unix timestamp in seconds when the chat completion was created""" - input_messages: List[InputMessage] + input_messages: List[DataInputMessage] model: str - """The model that was used to generate the chat completion""" - object: Literal["chat.completion"] - """The object type, which will be "chat.completion" """ + object: Optional[Literal["chat.completion"]] = None + + usage: Optional[DataUsage] = None + """Usage information for OpenAI chat completion.""" + + +class CompletionListResponse(BaseModel): + data: List[Data] + + first_id: str + + has_more: bool + + last_id: str - usage: Optional[Usage] = None - """Token usage information for the completion""" + object: Optional[Literal["list"]] = None diff --git a/src/llama_stack_client/types/chat/completion_retrieve_response.py b/src/llama_stack_client/types/chat/completion_retrieve_response.py index 19a03d7f..92de61bd 100644 --- a/src/llama_stack_client/types/chat/completion_retrieve_response.py +++ b/src/llama_stack_client/types/chat/completion_retrieve_response.py @@ -16,82 +16,80 @@ "CompletionRetrieveResponse", "Choice", "ChoiceMessage", - "ChoiceMessageOpenAIUserMessageParam", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile", - "ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile", + "ChoiceMessageOpenAIUserMessageParamOutput", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile", + "ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile", "ChoiceMessageOpenAISystemMessageParam", - "ChoiceMessageOpenAISystemMessageParamContentUnionMember1", - "ChoiceMessageOpenAIAssistantMessageParam", - "ChoiceMessageOpenAIAssistantMessageParamContentUnionMember1", - "ChoiceMessageOpenAIAssistantMessageParamToolCall", - "ChoiceMessageOpenAIAssistantMessageParamToolCallFunction", + "ChoiceMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "ChoiceMessageOpenAIAssistantMessageParamOutput", + "ChoiceMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam", + "ChoiceMessageOpenAIAssistantMessageParamOutputToolCall", + "ChoiceMessageOpenAIAssistantMessageParamOutputToolCallFunction", "ChoiceMessageOpenAIToolMessageParam", - "ChoiceMessageOpenAIToolMessageParamContentUnionMember1", + "ChoiceMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam", "ChoiceMessageOpenAIDeveloperMessageParam", - "ChoiceMessageOpenAIDeveloperMessageParamContentUnionMember1", + "ChoiceMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam", "ChoiceLogprobs", "ChoiceLogprobsContent", "ChoiceLogprobsContentTopLogprob", "ChoiceLogprobsRefusal", "ChoiceLogprobsRefusalTopLogprob", "InputMessage", - "InputMessageOpenAIUserMessageParam", - "InputMessageOpenAIUserMessageParamContentUnionMember1", - "InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam", - "InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam", - "InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL", - "InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile", - "InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile", + "InputMessageOpenAIUserMessageParamOutput", + "InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile", + "InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam", + "InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam", + "InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL", + "InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile", + "InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile", "InputMessageOpenAISystemMessageParam", - "InputMessageOpenAISystemMessageParamContentUnionMember1", - "InputMessageOpenAIAssistantMessageParam", - "InputMessageOpenAIAssistantMessageParamContentUnionMember1", - "InputMessageOpenAIAssistantMessageParamToolCall", - "InputMessageOpenAIAssistantMessageParamToolCallFunction", + "InputMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "InputMessageOpenAIAssistantMessageParamOutput", + "InputMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam", + "InputMessageOpenAIAssistantMessageParamOutputToolCall", + "InputMessageOpenAIAssistantMessageParamOutputToolCallFunction", "InputMessageOpenAIToolMessageParam", - "InputMessageOpenAIToolMessageParamContentUnionMember1", + "InputMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam", "InputMessageOpenAIDeveloperMessageParam", - "InputMessageOpenAIDeveloperMessageParamContentUnionMember1", + "InputMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam", "Usage", "UsageCompletionTokensDetails", "UsagePromptTokensDetails", ] -class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam(BaseModel): +class ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam( + BaseModel +): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None -class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL( +class ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL( BaseModel ): url: str - """URL of the image to include in the message""" detail: Optional[str] = None - """(Optional) Level of detail for image processing. - - Can be "low", "high", or "auto" - """ -class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam(BaseModel): - image_url: ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL - """Image URL specification and processing details""" +class ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam( + BaseModel +): + image_url: ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL + """Image URL specification for OpenAI-compatible chat completion messages.""" - type: Literal["image_url"] - """Must be "image_url" to identify this as image content""" + type: Optional[Literal["image_url"]] = None -class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile(BaseModel): +class ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile( + BaseModel +): file_data: Optional[str] = None file_id: Optional[str] = None @@ -99,144 +97,123 @@ class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile(BaseM filename: Optional[str] = None -class ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile(BaseModel): - file: ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile +class ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile( + BaseModel +): + file: ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile - type: Literal["file"] + type: Optional[Literal["file"]] = None -ChoiceMessageOpenAIUserMessageParamContentUnionMember1: TypeAlias = Annotated[ +ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile: TypeAlias = Annotated[ Union[ - ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam, - ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam, - ChoiceMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile, + ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam, + ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam, + ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile, ], PropertyInfo(discriminator="type"), ] -class ChoiceMessageOpenAIUserMessageParam(BaseModel): - content: Union[str, List[ChoiceMessageOpenAIUserMessageParamContentUnionMember1]] - """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""" +class ChoiceMessageOpenAIUserMessageParamOutput(BaseModel): + content: Union[ + str, + List[ + ChoiceMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile + ], + ] name: Optional[str] = None - """(Optional) The name of the user message participant.""" + + role: Optional[Literal["user"]] = None -class ChoiceMessageOpenAISystemMessageParamContentUnionMember1(BaseModel): +class ChoiceMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None class ChoiceMessageOpenAISystemMessageParam(BaseModel): - content: Union[str, List[ChoiceMessageOpenAISystemMessageParamContentUnionMember1]] - """The content of the "system prompt". - - If multiple system messages are provided, they are concatenated. The underlying - Llama Stack code may also add other system messages (for example, for formatting - tool definitions). - """ - - role: Literal["system"] - """Must be "system" to identify this as a system message""" + content: Union[str, List[ChoiceMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam]] name: Optional[str] = None - """(Optional) The name of the system message participant.""" + role: Optional[Literal["system"]] = None -class ChoiceMessageOpenAIAssistantMessageParamContentUnionMember1(BaseModel): + +class ChoiceMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam(BaseModel): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None -class ChoiceMessageOpenAIAssistantMessageParamToolCallFunction(BaseModel): +class ChoiceMessageOpenAIAssistantMessageParamOutputToolCallFunction(BaseModel): arguments: Optional[str] = None - """(Optional) Arguments to pass to the function as a JSON string""" name: Optional[str] = None - """(Optional) Name of the function to call""" - -class ChoiceMessageOpenAIAssistantMessageParamToolCall(BaseModel): - type: Literal["function"] - """Must be "function" to identify this as a function call""" +class ChoiceMessageOpenAIAssistantMessageParamOutputToolCall(BaseModel): id: Optional[str] = None - """(Optional) Unique identifier for the tool call""" - function: Optional[ChoiceMessageOpenAIAssistantMessageParamToolCallFunction] = None - """(Optional) Function call details""" + function: Optional[ChoiceMessageOpenAIAssistantMessageParamOutputToolCallFunction] = None + """Function call details for OpenAI-compatible tool calls.""" index: Optional[int] = None - """(Optional) Index of the tool call in the list""" + type: Optional[Literal["function"]] = None -class ChoiceMessageOpenAIAssistantMessageParam(BaseModel): - role: Literal["assistant"] - """Must be "assistant" to identify this as the model's response""" - content: Union[str, List[ChoiceMessageOpenAIAssistantMessageParamContentUnionMember1], None] = None - """The content of the model's response""" +class ChoiceMessageOpenAIAssistantMessageParamOutput(BaseModel): + content: Union[ + str, + List[ChoiceMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam], + None, + ] = None name: Optional[str] = None - """(Optional) The name of the assistant message participant.""" - tool_calls: Optional[List[ChoiceMessageOpenAIAssistantMessageParamToolCall]] = None - """List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.""" + role: Optional[Literal["assistant"]] = None + + tool_calls: Optional[List[ChoiceMessageOpenAIAssistantMessageParamOutputToolCall]] = None -class ChoiceMessageOpenAIToolMessageParamContentUnionMember1(BaseModel): +class ChoiceMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None class ChoiceMessageOpenAIToolMessageParam(BaseModel): - content: Union[str, List[ChoiceMessageOpenAIToolMessageParamContentUnionMember1]] - """The response content from the tool""" - - role: Literal["tool"] - """Must be "tool" to identify this as a tool response""" + content: Union[str, List[ChoiceMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam]] tool_call_id: str - """Unique identifier for the tool call this response is for""" + + role: Optional[Literal["tool"]] = None -class ChoiceMessageOpenAIDeveloperMessageParamContentUnionMember1(BaseModel): +class ChoiceMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None class ChoiceMessageOpenAIDeveloperMessageParam(BaseModel): - content: Union[str, List[ChoiceMessageOpenAIDeveloperMessageParamContentUnionMember1]] - """The content of the developer message""" - - role: Literal["developer"] - """Must be "developer" to identify this as a developer message""" + content: Union[ + str, List[ChoiceMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam] + ] name: Optional[str] = None - """(Optional) The name of the developer message participant.""" + + role: Optional[Literal["developer"]] = None ChoiceMessage: TypeAlias = Annotated[ Union[ - ChoiceMessageOpenAIUserMessageParam, + ChoiceMessageOpenAIUserMessageParamOutput, ChoiceMessageOpenAISystemMessageParam, - ChoiceMessageOpenAIAssistantMessageParam, + ChoiceMessageOpenAIAssistantMessageParamOutput, ChoiceMessageOpenAIToolMessageParam, ChoiceMessageOpenAIDeveloperMessageParam, ], @@ -282,54 +259,53 @@ class ChoiceLogprobsRefusal(BaseModel): class ChoiceLogprobs(BaseModel): content: Optional[List[ChoiceLogprobsContent]] = None - """(Optional) The log probabilities for the tokens in the message""" refusal: Optional[List[ChoiceLogprobsRefusal]] = None - """(Optional) The log probabilities for the tokens in the message""" class Choice(BaseModel): finish_reason: str - """The reason the model stopped generating""" index: int - """The index of the choice""" message: ChoiceMessage - """The message from the model""" + """A message from the user in an OpenAI-compatible chat completion request.""" logprobs: Optional[ChoiceLogprobs] = None - """(Optional) The log probabilities for the tokens in the message""" + """ + The log probabilities for the tokens in the message from an OpenAI-compatible + chat completion response. + """ -class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam(BaseModel): +class InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam( + BaseModel +): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None -class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL(BaseModel): +class InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL( + BaseModel +): url: str - """URL of the image to include in the message""" detail: Optional[str] = None - """(Optional) Level of detail for image processing. - - Can be "low", "high", or "auto" - """ -class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam(BaseModel): - image_url: InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL - """Image URL specification and processing details""" +class InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam( + BaseModel +): + image_url: InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL + """Image URL specification for OpenAI-compatible chat completion messages.""" - type: Literal["image_url"] - """Must be "image_url" to identify this as image content""" + type: Optional[Literal["image_url"]] = None -class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile(BaseModel): +class InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile( + BaseModel +): file_data: Optional[str] = None file_id: Optional[str] = None @@ -337,144 +313,123 @@ class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile(BaseMo filename: Optional[str] = None -class InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile(BaseModel): - file: InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile +class InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile( + BaseModel +): + file: InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile - type: Literal["file"] + type: Optional[Literal["file"]] = None -InputMessageOpenAIUserMessageParamContentUnionMember1: TypeAlias = Annotated[ +InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile: TypeAlias = Annotated[ Union[ - InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam, - InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam, - InputMessageOpenAIUserMessageParamContentUnionMember1OpenAIFile, + InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam, + InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam, + InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile, ], PropertyInfo(discriminator="type"), ] -class InputMessageOpenAIUserMessageParam(BaseModel): - content: Union[str, List[InputMessageOpenAIUserMessageParamContentUnionMember1]] - """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""" +class InputMessageOpenAIUserMessageParamOutput(BaseModel): + content: Union[ + str, + List[ + InputMessageOpenAIUserMessageParamOutputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile + ], + ] name: Optional[str] = None - """(Optional) The name of the user message participant.""" + + role: Optional[Literal["user"]] = None -class InputMessageOpenAISystemMessageParamContentUnionMember1(BaseModel): +class InputMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None class InputMessageOpenAISystemMessageParam(BaseModel): - content: Union[str, List[InputMessageOpenAISystemMessageParamContentUnionMember1]] - """The content of the "system prompt". - - If multiple system messages are provided, they are concatenated. The underlying - Llama Stack code may also add other system messages (for example, for formatting - tool definitions). - """ - - role: Literal["system"] - """Must be "system" to identify this as a system message""" + content: Union[str, List[InputMessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam]] name: Optional[str] = None - """(Optional) The name of the system message participant.""" + + role: Optional[Literal["system"]] = None -class InputMessageOpenAIAssistantMessageParamContentUnionMember1(BaseModel): +class InputMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam(BaseModel): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None -class InputMessageOpenAIAssistantMessageParamToolCallFunction(BaseModel): +class InputMessageOpenAIAssistantMessageParamOutputToolCallFunction(BaseModel): arguments: Optional[str] = None - """(Optional) Arguments to pass to the function as a JSON string""" name: Optional[str] = None - """(Optional) Name of the function to call""" -class InputMessageOpenAIAssistantMessageParamToolCall(BaseModel): - type: Literal["function"] - """Must be "function" to identify this as a function call""" - +class InputMessageOpenAIAssistantMessageParamOutputToolCall(BaseModel): id: Optional[str] = None - """(Optional) Unique identifier for the tool call""" - function: Optional[InputMessageOpenAIAssistantMessageParamToolCallFunction] = None - """(Optional) Function call details""" + function: Optional[InputMessageOpenAIAssistantMessageParamOutputToolCallFunction] = None + """Function call details for OpenAI-compatible tool calls.""" index: Optional[int] = None - """(Optional) Index of the tool call in the list""" + type: Optional[Literal["function"]] = None -class InputMessageOpenAIAssistantMessageParam(BaseModel): - role: Literal["assistant"] - """Must be "assistant" to identify this as the model's response""" - content: Union[str, List[InputMessageOpenAIAssistantMessageParamContentUnionMember1], None] = None - """The content of the model's response""" +class InputMessageOpenAIAssistantMessageParamOutput(BaseModel): + content: Union[ + str, + List[InputMessageOpenAIAssistantMessageParamOutputContentListOpenAIChatCompletionContentPartTextParam], + None, + ] = None name: Optional[str] = None - """(Optional) The name of the assistant message participant.""" - tool_calls: Optional[List[InputMessageOpenAIAssistantMessageParamToolCall]] = None - """List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.""" + role: Optional[Literal["assistant"]] = None + + tool_calls: Optional[List[InputMessageOpenAIAssistantMessageParamOutputToolCall]] = None -class InputMessageOpenAIToolMessageParamContentUnionMember1(BaseModel): +class InputMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None class InputMessageOpenAIToolMessageParam(BaseModel): - content: Union[str, List[InputMessageOpenAIToolMessageParamContentUnionMember1]] - """The response content from the tool""" - - role: Literal["tool"] - """Must be "tool" to identify this as a tool response""" + content: Union[str, List[InputMessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam]] tool_call_id: str - """Unique identifier for the tool call this response is for""" + role: Optional[Literal["tool"]] = None -class InputMessageOpenAIDeveloperMessageParamContentUnionMember1(BaseModel): + +class InputMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam(BaseModel): text: str - """The text content of the message""" - type: Literal["text"] - """Must be "text" to identify this as text content""" + type: Optional[Literal["text"]] = None class InputMessageOpenAIDeveloperMessageParam(BaseModel): - content: Union[str, List[InputMessageOpenAIDeveloperMessageParamContentUnionMember1]] - """The content of the developer message""" - - role: Literal["developer"] - """Must be "developer" to identify this as a developer message""" + content: Union[ + str, List[InputMessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam] + ] name: Optional[str] = None - """(Optional) The name of the developer message participant.""" + + role: Optional[Literal["developer"]] = None InputMessage: TypeAlias = Annotated[ Union[ - InputMessageOpenAIUserMessageParam, + InputMessageOpenAIUserMessageParamOutput, InputMessageOpenAISystemMessageParam, - InputMessageOpenAIAssistantMessageParam, + InputMessageOpenAIAssistantMessageParamOutput, InputMessageOpenAIToolMessageParam, InputMessageOpenAIDeveloperMessageParam, ], @@ -484,23 +439,18 @@ class InputMessageOpenAIDeveloperMessageParam(BaseModel): class UsageCompletionTokensDetails(BaseModel): reasoning_tokens: Optional[int] = None - """Number of tokens used for reasoning (o1/o3 models)""" class UsagePromptTokensDetails(BaseModel): cached_tokens: Optional[int] = None - """Number of tokens retrieved from cache""" class Usage(BaseModel): completion_tokens: int - """Number of tokens in the completion""" prompt_tokens: int - """Number of tokens in the prompt""" total_tokens: int - """Total tokens used (prompt + completion)""" completion_tokens_details: Optional[UsageCompletionTokensDetails] = None """Token details for output tokens in OpenAI chat completion usage.""" @@ -511,21 +461,16 @@ class Usage(BaseModel): class CompletionRetrieveResponse(BaseModel): id: str - """The ID of the chat completion""" choices: List[Choice] - """List of choices""" created: int - """The Unix timestamp in seconds when the chat completion was created""" input_messages: List[InputMessage] model: str - """The model that was used to generate the chat completion""" - object: Literal["chat.completion"] - """The object type, which will be "chat.completion" """ + object: Optional[Literal["chat.completion"]] = None usage: Optional[Usage] = None - """Token usage information for the completion""" + """Usage information for OpenAI chat completion.""" diff --git a/src/llama_stack_client/types/chat_completion_chunk.py b/src/llama_stack_client/types/chat_completion_chunk.py index 866601ca..90c10da2 100644 --- a/src/llama_stack_client/types/chat_completion_chunk.py +++ b/src/llama_stack_client/types/chat_completion_chunk.py @@ -30,43 +30,31 @@ class ChoiceDeltaToolCallFunction(BaseModel): arguments: Optional[str] = None - """(Optional) Arguments to pass to the function as a JSON string""" name: Optional[str] = None - """(Optional) Name of the function to call""" class ChoiceDeltaToolCall(BaseModel): - type: Literal["function"] - """Must be "function" to identify this as a function call""" - id: Optional[str] = None - """(Optional) Unique identifier for the tool call""" function: Optional[ChoiceDeltaToolCallFunction] = None - """(Optional) Function call details""" + """Function call details for OpenAI-compatible tool calls.""" index: Optional[int] = None - """(Optional) Index of the tool call in the list""" + + type: Optional[Literal["function"]] = None class ChoiceDelta(BaseModel): content: Optional[str] = None - """(Optional) The content of the delta""" reasoning_content: Optional[str] = None - """ - (Optional) The reasoning content from the model (non-standard, for o1/o3 models) - """ refusal: Optional[str] = None - """(Optional) The refusal of the delta""" role: Optional[str] = None - """(Optional) The role of the delta""" tool_calls: Optional[List[ChoiceDeltaToolCall]] = None - """(Optional) The tool calls of the delta""" class ChoiceLogprobsContentTopLogprob(BaseModel): @@ -107,45 +95,39 @@ class ChoiceLogprobsRefusal(BaseModel): class ChoiceLogprobs(BaseModel): content: Optional[List[ChoiceLogprobsContent]] = None - """(Optional) The log probabilities for the tokens in the message""" refusal: Optional[List[ChoiceLogprobsRefusal]] = None - """(Optional) The log probabilities for the tokens in the message""" class Choice(BaseModel): delta: ChoiceDelta - """The delta from the chunk""" + """A delta from an OpenAI-compatible chat completion streaming response.""" finish_reason: str - """The reason the model stopped generating""" index: int - """The index of the choice""" logprobs: Optional[ChoiceLogprobs] = None - """(Optional) The log probabilities for the tokens in the message""" + """ + The log probabilities for the tokens in the message from an OpenAI-compatible + chat completion response. + """ class UsageCompletionTokensDetails(BaseModel): reasoning_tokens: Optional[int] = None - """Number of tokens used for reasoning (o1/o3 models)""" class UsagePromptTokensDetails(BaseModel): cached_tokens: Optional[int] = None - """Number of tokens retrieved from cache""" class Usage(BaseModel): completion_tokens: int - """Number of tokens in the completion""" prompt_tokens: int - """Number of tokens in the prompt""" total_tokens: int - """Total tokens used (prompt + completion)""" completion_tokens_details: Optional[UsageCompletionTokensDetails] = None """Token details for output tokens in OpenAI chat completion usage.""" @@ -156,19 +138,14 @@ class Usage(BaseModel): class ChatCompletionChunk(BaseModel): id: str - """The ID of the chat completion""" choices: List[Choice] - """List of choices""" created: int - """The Unix timestamp in seconds when the chat completion was created""" model: str - """The model that was used to generate the chat completion""" - object: Literal["chat.completion.chunk"] - """The object type, which will be "chat.completion.chunk" """ + object: Optional[Literal["chat.completion.chunk"]] = None usage: Optional[Usage] = None - """Token usage information (typically included in final chunk with stream_options)""" + """Usage information for OpenAI chat completion.""" diff --git a/src/llama_stack_client/types/completion_create_params.py b/src/llama_stack_client/types/completion_create_params.py index 0a651fb6..c69d7bda 100644 --- a/src/llama_stack_client/types/completion_create_params.py +++ b/src/llama_stack_client/types/completion_create_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypedDict from .._types import SequenceNotStr @@ -18,69 +18,46 @@ class CompletionCreateParamsBase(TypedDict, total=False): model: Required[str] - """The identifier of the model to use. - - The model must be registered with Llama Stack and available via the /models - endpoint. - """ prompt: Required[Union[str, SequenceNotStr[str], Iterable[int], Iterable[Iterable[int]]]] - """The prompt to generate a completion for.""" - best_of: int - """(Optional) The number of completions to generate.""" + best_of: Optional[int] - echo: bool - """(Optional) Whether to echo the prompt.""" + echo: Optional[bool] - frequency_penalty: float - """(Optional) The penalty for repeated tokens.""" + frequency_penalty: Optional[float] - logit_bias: Dict[str, float] - """(Optional) The logit bias to use.""" + logit_bias: Optional[Dict[str, float]] - logprobs: bool - """(Optional) The log probabilities to use.""" + logprobs: Optional[bool] - max_tokens: int - """(Optional) The maximum number of tokens to generate.""" + max_tokens: Optional[int] - n: int - """(Optional) The number of completions to generate.""" + n: Optional[int] - presence_penalty: float - """(Optional) The penalty for repeated tokens.""" + presence_penalty: Optional[float] - seed: int - """(Optional) The seed to use.""" + seed: Optional[int] - stop: Union[str, SequenceNotStr[str]] - """(Optional) The stop tokens to use.""" + stop: Union[str, SequenceNotStr[str], None] - stream_options: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) The stream options to use.""" + stream_options: Optional[Dict[str, object]] - suffix: str - """(Optional) The suffix that should be appended to the completion.""" + suffix: Optional[str] - temperature: float - """(Optional) The temperature to use.""" + temperature: Optional[float] - top_p: float - """(Optional) The top p to use.""" + top_p: Optional[float] - user: str - """(Optional) The user to use.""" + user: Optional[str] class CompletionCreateParamsNonStreaming(CompletionCreateParamsBase, total=False): - stream: Literal[False] - """(Optional) Whether to stream the response.""" + stream: Optional[Literal[False]] class CompletionCreateParamsStreaming(CompletionCreateParamsBase): stream: Required[Literal[True]] - """(Optional) Whether to stream the response.""" CompletionCreateParams = Union[CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming] diff --git a/src/llama_stack_client/types/completion_create_response.py b/src/llama_stack_client/types/completion_create_response.py index fa88f12a..76ee47ba 100644 --- a/src/llama_stack_client/types/completion_create_response.py +++ b/src/llama_stack_client/types/completion_create_response.py @@ -60,10 +60,8 @@ class ChoiceLogprobsRefusal(BaseModel): class ChoiceLogprobs(BaseModel): content: Optional[List[ChoiceLogprobsContent]] = None - """(Optional) The log probabilities for the tokens in the message""" refusal: Optional[List[ChoiceLogprobsRefusal]] = None - """(Optional) The log probabilities for the tokens in the message""" class Choice(BaseModel): @@ -89,4 +87,4 @@ class CompletionCreateResponse(BaseModel): model: str - object: Literal["text_completion"] + object: Optional[Literal["text_completion"]] = None diff --git a/src/llama_stack_client/types/conversation_create_params.py b/src/llama_stack_client/types/conversation_create_params.py index 96fbb82e..5d3da45b 100644 --- a/src/llama_stack_client/types/conversation_create_params.py +++ b/src/llama_stack_client/types/conversation_create_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .._types import SequenceNotStr @@ -16,19 +16,19 @@ __all__ = [ "ConversationCreateParams", "Item", - "ItemOpenAIResponseMessage", - "ItemOpenAIResponseMessageContentUnionMember1", - "ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "ItemOpenAIResponseMessageContentUnionMember2", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", + "ItemOpenAIResponseMessageInput", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", "ItemOpenAIResponseOutputMessageWebSearchToolCall", "ItemOpenAIResponseOutputMessageFileSearchToolCall", "ItemOpenAIResponseOutputMessageFileSearchToolCallResult", @@ -43,95 +43,79 @@ class ConversationCreateParams(TypedDict, total=False): - items: Iterable[Item] - """Initial items to include in the conversation context.""" + items: Optional[Iterable[Item]] - metadata: Dict[str, str] - """Set of key-value pairs that can be attached to an object.""" + metadata: Optional[Dict[str, str]] -class ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText(TypedDict, total=False): +class ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( + TypedDict, total=False +): text: Required[str] - """The text content of the input message""" - type: Required[Literal["input_text"]] - """Content type identifier, always "input_text" """ + type: Literal["input_text"] -class ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage(TypedDict, total=False): - detail: Required[Literal["low", "high", "auto"]] - """Level of detail for image processing, can be "low", "high", or "auto" """ +class ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( + TypedDict, total=False +): + detail: Literal["low", "high", "auto"] - type: Required[Literal["input_image"]] - """Content type identifier, always "input_image" """ + file_id: Optional[str] - file_id: str - """(Optional) The ID of the file to be sent to the model.""" + image_url: Optional[str] - image_url: str - """(Optional) URL of the image content""" + type: Literal["input_image"] -class ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile(TypedDict, total=False): - type: Required[Literal["input_file"]] - """The type of the input item. Always `input_file`.""" +class ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( + TypedDict, total=False +): + file_data: Optional[str] - file_data: str - """The data of the file to be sent to the model.""" + file_id: Optional[str] - file_id: str - """(Optional) The ID of the file to be sent to the model.""" + file_url: Optional[str] - file_url: str - """The URL of the file to be sent to the model.""" + filename: Optional[str] - filename: str - """The name of the file to be sent to the model.""" + type: Literal["input_file"] -ItemOpenAIResponseMessageContentUnionMember1: TypeAlias = Union[ - ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, +ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Union[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( TypedDict, total=False ): file_id: Required[str] - """Unique identifier of the referenced file""" filename: Required[str] - """Name of the referenced file""" index: Required[int] - """Position index of the citation within the content""" - type: Required[Literal["file_citation"]] - """Annotation type identifier, always "file_citation" """ + type: Literal["file_citation"] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( TypedDict, total=False ): end_index: Required[int] - """End position of the citation span in the content""" start_index: Required[int] - """Start position of the citation span in the content""" title: Required[str] - """Title of the referenced web resource""" - - type: Required[Literal["url_citation"]] - """Annotation type identifier, always "url_citation" """ url: Required[str] - """URL of the referenced web resource""" + + type: Literal["url_citation"] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( TypedDict, total=False ): container_id: Required[str] @@ -144,132 +128,119 @@ class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageCon start_index: Required[int] - type: Required[Literal["container_file_citation"]] + type: Literal["container_file_citation"] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( TypedDict, total=False ): file_id: Required[str] index: Required[int] - type: Required[Literal["file_path"]] + type: Literal["file_path"] -ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Union[ - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, +ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Union[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText(TypedDict, total=False): - annotations: Required[ - Iterable[ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation] - ] - +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( + TypedDict, total=False +): text: Required[str] - type: Required[Literal["output_text"]] + annotations: Iterable[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + + type: Literal["output_text"] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal(TypedDict, total=False): +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( + TypedDict, total=False +): refusal: Required[str] - """Refusal text supplied by the model""" - type: Required[Literal["refusal"]] - """Content part type identifier, always "refusal" """ + type: Literal["refusal"] -ItemOpenAIResponseMessageContentUnionMember2: TypeAlias = Union[ - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, +ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Union[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ] -class ItemOpenAIResponseMessage(TypedDict, total=False): +class ItemOpenAIResponseMessageInput(TypedDict, total=False): content: Required[ Union[ str, - Iterable[ItemOpenAIResponseMessageContentUnionMember1], - Iterable[ItemOpenAIResponseMessageContentUnionMember2], + Iterable[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + Iterable[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal + ], ] ] role: Required[Literal["system", "developer", "user", "assistant"]] - type: Required[Literal["message"]] + id: Optional[str] - id: str + status: Optional[str] - status: str + type: Literal["message"] class ItemOpenAIResponseOutputMessageWebSearchToolCall(TypedDict, total=False): id: Required[str] - """Unique identifier for this tool call""" status: Required[str] - """Current status of the web search operation""" - type: Required[Literal["web_search_call"]] - """Tool call type identifier, always "web_search_call" """ + type: Literal["web_search_call"] class ItemOpenAIResponseOutputMessageFileSearchToolCallResult(TypedDict, total=False): - attributes: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """(Optional) Key-value attributes associated with the file""" + attributes: Required[Dict[str, object]] file_id: Required[str] - """Unique identifier of the file containing the result""" filename: Required[str] - """Name of the file containing the result""" score: Required[float] - """Relevance score for this search result (between 0 and 1)""" text: Required[str] - """Text content of the search result""" class ItemOpenAIResponseOutputMessageFileSearchToolCall(TypedDict, total=False): id: Required[str] - """Unique identifier for this tool call""" queries: Required[SequenceNotStr[str]] - """List of search queries executed""" status: Required[str] - """Current status of the file search operation""" - type: Required[Literal["file_search_call"]] - """Tool call type identifier, always "file_search_call" """ + results: Optional[Iterable[ItemOpenAIResponseOutputMessageFileSearchToolCallResult]] - results: Iterable[ItemOpenAIResponseOutputMessageFileSearchToolCallResult] - """(Optional) Search results returned by the file search operation""" + type: Literal["file_search_call"] class ItemOpenAIResponseOutputMessageFunctionToolCall(TypedDict, total=False): arguments: Required[str] - """JSON string containing the function arguments""" call_id: Required[str] - """Unique identifier for the function call""" name: Required[str] - """Name of the function being called""" - type: Required[Literal["function_call"]] - """Tool call type identifier, always "function_call" """ + id: Optional[str] - id: str - """(Optional) Additional identifier for the tool call""" + status: Optional[str] - status: str - """(Optional) Current status of the function call execution""" + type: Literal["function_call"] class ItemOpenAIResponseInputFunctionToolCallOutput(TypedDict, total=False): @@ -277,11 +248,11 @@ class ItemOpenAIResponseInputFunctionToolCallOutput(TypedDict, total=False): output: Required[str] - type: Required[Literal["function_call_output"]] + id: Optional[str] - id: str + status: Optional[str] - status: str + type: Literal["function_call_output"] class ItemOpenAIResponseMcpApprovalRequest(TypedDict, total=False): @@ -293,7 +264,7 @@ class ItemOpenAIResponseMcpApprovalRequest(TypedDict, total=False): server_label: Required[str] - type: Required[Literal["mcp_approval_request"]] + type: Literal["mcp_approval_request"] class ItemOpenAIResponseMcpApprovalResponse(TypedDict, total=False): @@ -301,63 +272,49 @@ class ItemOpenAIResponseMcpApprovalResponse(TypedDict, total=False): approve: Required[bool] - type: Required[Literal["mcp_approval_response"]] + id: Optional[str] - id: str + reason: Optional[str] - reason: str + type: Literal["mcp_approval_response"] class ItemOpenAIResponseOutputMessageMcpCall(TypedDict, total=False): id: Required[str] - """Unique identifier for this MCP call""" arguments: Required[str] - """JSON string containing the MCP call arguments""" name: Required[str] - """Name of the MCP method being called""" server_label: Required[str] - """Label identifying the MCP server handling the call""" - type: Required[Literal["mcp_call"]] - """Tool call type identifier, always "mcp_call" """ + error: Optional[str] - error: str - """(Optional) Error message if the MCP call failed""" + output: Optional[str] - output: str - """(Optional) Output result from the successful MCP call""" + type: Literal["mcp_call"] class ItemOpenAIResponseOutputMessageMcpListToolsTool(TypedDict, total=False): - input_schema: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """JSON schema defining the tool's input parameters""" + input_schema: Required[Dict[str, object]] name: Required[str] - """Name of the tool""" - description: str - """(Optional) Description of what the tool does""" + description: Optional[str] class ItemOpenAIResponseOutputMessageMcpListTools(TypedDict, total=False): id: Required[str] - """Unique identifier for this MCP list tools operation""" server_label: Required[str] - """Label identifying the MCP server providing the tools""" tools: Required[Iterable[ItemOpenAIResponseOutputMessageMcpListToolsTool]] - """List of available tools provided by the MCP server""" - type: Required[Literal["mcp_list_tools"]] - """Tool call type identifier, always "mcp_list_tools" """ + type: Literal["mcp_list_tools"] Item: TypeAlias = Union[ - ItemOpenAIResponseMessage, + ItemOpenAIResponseMessageInput, ItemOpenAIResponseOutputMessageWebSearchToolCall, ItemOpenAIResponseOutputMessageFileSearchToolCall, ItemOpenAIResponseOutputMessageFunctionToolCall, diff --git a/src/llama_stack_client/types/conversation_delete_response.py b/src/llama_stack_client/types/conversation_delete_response.py index 1deb8eaa..abf5b7c0 100644 --- a/src/llama_stack_client/types/conversation_delete_response.py +++ b/src/llama_stack_client/types/conversation_delete_response.py @@ -6,6 +6,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional + from .._models import BaseModel __all__ = ["ConversationDeleteResponse"] @@ -13,7 +15,10 @@ class ConversationDeleteResponse(BaseModel): id: str + """The deleted conversation identifier""" - deleted: bool + deleted: Optional[bool] = None + """Whether the object was deleted""" - object: str + object: Optional[str] = None + """Object type""" diff --git a/src/llama_stack_client/types/conversation_object.py b/src/llama_stack_client/types/conversation_object.py index e1167f9c..27a55d23 100644 --- a/src/llama_stack_client/types/conversation_object.py +++ b/src/llama_stack_client/types/conversation_object.py @@ -6,7 +6,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import builtins from typing import Dict, List, Optional from typing_extensions import Literal @@ -17,11 +16,26 @@ class ConversationObject(BaseModel): id: str + """The unique ID of the conversation.""" created_at: int + """ + The time at which the conversation was created, measured in seconds since the + Unix epoch. + """ - object: Literal["conversation"] + items: Optional[List[Dict[str, object]]] = None + """Initial items to include in the conversation context. - items: Optional[List[builtins.object]] = None + You may add up to 20 items at a time. + """ metadata: Optional[Dict[str, str]] = None + """Set of 16 key-value pairs that can be attached to an object. + + This can be useful for storing additional information about the object in a + structured format, and querying for objects via API or the dashboard. + """ + + object: Optional[Literal["conversation"]] = None + """The object type, which is always conversation.""" diff --git a/src/llama_stack_client/types/conversation_update_params.py b/src/llama_stack_client/types/conversation_update_params.py index d59a9d34..10b45995 100644 --- a/src/llama_stack_client/types/conversation_update_params.py +++ b/src/llama_stack_client/types/conversation_update_params.py @@ -16,4 +16,3 @@ class ConversationUpdateParams(TypedDict, total=False): metadata: Required[Dict[str, str]] - """Set of key-value pairs that can be attached to an object.""" diff --git a/src/llama_stack_client/types/conversations/__init__.py b/src/llama_stack_client/types/conversations/__init__.py index 4c6632e4..9c2b106e 100644 --- a/src/llama_stack_client/types/conversations/__init__.py +++ b/src/llama_stack_client/types/conversations/__init__.py @@ -13,3 +13,4 @@ from .item_create_params import ItemCreateParams as ItemCreateParams from .item_list_response import ItemListResponse as ItemListResponse from .item_create_response import ItemCreateResponse as ItemCreateResponse +from .item_delete_response import ItemDeleteResponse as ItemDeleteResponse diff --git a/src/llama_stack_client/types/conversations/item_create_params.py b/src/llama_stack_client/types/conversations/item_create_params.py index 111c39fb..7d3e9de9 100644 --- a/src/llama_stack_client/types/conversations/item_create_params.py +++ b/src/llama_stack_client/types/conversations/item_create_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr @@ -16,19 +16,19 @@ __all__ = [ "ItemCreateParams", "Item", - "ItemOpenAIResponseMessage", - "ItemOpenAIResponseMessageContentUnionMember1", - "ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "ItemOpenAIResponseMessageContentUnionMember2", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", + "ItemOpenAIResponseMessageInput", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", "ItemOpenAIResponseOutputMessageWebSearchToolCall", "ItemOpenAIResponseOutputMessageFileSearchToolCall", "ItemOpenAIResponseOutputMessageFileSearchToolCallResult", @@ -44,91 +44,76 @@ class ItemCreateParams(TypedDict, total=False): items: Required[Iterable[Item]] - """Items to include in the conversation context.""" -class ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText(TypedDict, total=False): +class ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( + TypedDict, total=False +): text: Required[str] - """The text content of the input message""" - type: Required[Literal["input_text"]] - """Content type identifier, always "input_text" """ + type: Literal["input_text"] -class ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage(TypedDict, total=False): - detail: Required[Literal["low", "high", "auto"]] - """Level of detail for image processing, can be "low", "high", or "auto" """ +class ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( + TypedDict, total=False +): + detail: Literal["low", "high", "auto"] - type: Required[Literal["input_image"]] - """Content type identifier, always "input_image" """ + file_id: Optional[str] - file_id: str - """(Optional) The ID of the file to be sent to the model.""" + image_url: Optional[str] - image_url: str - """(Optional) URL of the image content""" + type: Literal["input_image"] -class ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile(TypedDict, total=False): - type: Required[Literal["input_file"]] - """The type of the input item. Always `input_file`.""" +class ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( + TypedDict, total=False +): + file_data: Optional[str] - file_data: str - """The data of the file to be sent to the model.""" + file_id: Optional[str] - file_id: str - """(Optional) The ID of the file to be sent to the model.""" + file_url: Optional[str] - file_url: str - """The URL of the file to be sent to the model.""" + filename: Optional[str] - filename: str - """The name of the file to be sent to the model.""" + type: Literal["input_file"] -ItemOpenAIResponseMessageContentUnionMember1: TypeAlias = Union[ - ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - ItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, +ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Union[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( TypedDict, total=False ): file_id: Required[str] - """Unique identifier of the referenced file""" filename: Required[str] - """Name of the referenced file""" index: Required[int] - """Position index of the citation within the content""" - type: Required[Literal["file_citation"]] - """Annotation type identifier, always "file_citation" """ + type: Literal["file_citation"] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( TypedDict, total=False ): end_index: Required[int] - """End position of the citation span in the content""" start_index: Required[int] - """Start position of the citation span in the content""" title: Required[str] - """Title of the referenced web resource""" - - type: Required[Literal["url_citation"]] - """Annotation type identifier, always "url_citation" """ url: Required[str] - """URL of the referenced web resource""" + + type: Literal["url_citation"] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( TypedDict, total=False ): container_id: Required[str] @@ -141,132 +126,119 @@ class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageCon start_index: Required[int] - type: Required[Literal["container_file_citation"]] + type: Literal["container_file_citation"] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( TypedDict, total=False ): file_id: Required[str] index: Required[int] - type: Required[Literal["file_path"]] + type: Literal["file_path"] -ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Union[ - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, +ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Union[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText(TypedDict, total=False): - annotations: Required[ - Iterable[ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation] - ] - +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( + TypedDict, total=False +): text: Required[str] - type: Required[Literal["output_text"]] + annotations: Iterable[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + + type: Literal["output_text"] -class ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal(TypedDict, total=False): +class ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( + TypedDict, total=False +): refusal: Required[str] - """Refusal text supplied by the model""" - type: Required[Literal["refusal"]] - """Content part type identifier, always "refusal" """ + type: Literal["refusal"] -ItemOpenAIResponseMessageContentUnionMember2: TypeAlias = Union[ - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - ItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, +ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Union[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ] -class ItemOpenAIResponseMessage(TypedDict, total=False): +class ItemOpenAIResponseMessageInput(TypedDict, total=False): content: Required[ Union[ str, - Iterable[ItemOpenAIResponseMessageContentUnionMember1], - Iterable[ItemOpenAIResponseMessageContentUnionMember2], + Iterable[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + Iterable[ + ItemOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal + ], ] ] role: Required[Literal["system", "developer", "user", "assistant"]] - type: Required[Literal["message"]] + id: Optional[str] - id: str + status: Optional[str] - status: str + type: Literal["message"] class ItemOpenAIResponseOutputMessageWebSearchToolCall(TypedDict, total=False): id: Required[str] - """Unique identifier for this tool call""" status: Required[str] - """Current status of the web search operation""" - type: Required[Literal["web_search_call"]] - """Tool call type identifier, always "web_search_call" """ + type: Literal["web_search_call"] class ItemOpenAIResponseOutputMessageFileSearchToolCallResult(TypedDict, total=False): - attributes: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """(Optional) Key-value attributes associated with the file""" + attributes: Required[Dict[str, object]] file_id: Required[str] - """Unique identifier of the file containing the result""" filename: Required[str] - """Name of the file containing the result""" score: Required[float] - """Relevance score for this search result (between 0 and 1)""" text: Required[str] - """Text content of the search result""" class ItemOpenAIResponseOutputMessageFileSearchToolCall(TypedDict, total=False): id: Required[str] - """Unique identifier for this tool call""" queries: Required[SequenceNotStr[str]] - """List of search queries executed""" status: Required[str] - """Current status of the file search operation""" - type: Required[Literal["file_search_call"]] - """Tool call type identifier, always "file_search_call" """ + results: Optional[Iterable[ItemOpenAIResponseOutputMessageFileSearchToolCallResult]] - results: Iterable[ItemOpenAIResponseOutputMessageFileSearchToolCallResult] - """(Optional) Search results returned by the file search operation""" + type: Literal["file_search_call"] class ItemOpenAIResponseOutputMessageFunctionToolCall(TypedDict, total=False): arguments: Required[str] - """JSON string containing the function arguments""" call_id: Required[str] - """Unique identifier for the function call""" name: Required[str] - """Name of the function being called""" - type: Required[Literal["function_call"]] - """Tool call type identifier, always "function_call" """ + id: Optional[str] - id: str - """(Optional) Additional identifier for the tool call""" + status: Optional[str] - status: str - """(Optional) Current status of the function call execution""" + type: Literal["function_call"] class ItemOpenAIResponseInputFunctionToolCallOutput(TypedDict, total=False): @@ -274,11 +246,11 @@ class ItemOpenAIResponseInputFunctionToolCallOutput(TypedDict, total=False): output: Required[str] - type: Required[Literal["function_call_output"]] + id: Optional[str] - id: str + status: Optional[str] - status: str + type: Literal["function_call_output"] class ItemOpenAIResponseMcpApprovalRequest(TypedDict, total=False): @@ -290,7 +262,7 @@ class ItemOpenAIResponseMcpApprovalRequest(TypedDict, total=False): server_label: Required[str] - type: Required[Literal["mcp_approval_request"]] + type: Literal["mcp_approval_request"] class ItemOpenAIResponseMcpApprovalResponse(TypedDict, total=False): @@ -298,63 +270,49 @@ class ItemOpenAIResponseMcpApprovalResponse(TypedDict, total=False): approve: Required[bool] - type: Required[Literal["mcp_approval_response"]] + id: Optional[str] - id: str + reason: Optional[str] - reason: str + type: Literal["mcp_approval_response"] class ItemOpenAIResponseOutputMessageMcpCall(TypedDict, total=False): id: Required[str] - """Unique identifier for this MCP call""" arguments: Required[str] - """JSON string containing the MCP call arguments""" name: Required[str] - """Name of the MCP method being called""" server_label: Required[str] - """Label identifying the MCP server handling the call""" - type: Required[Literal["mcp_call"]] - """Tool call type identifier, always "mcp_call" """ + error: Optional[str] - error: str - """(Optional) Error message if the MCP call failed""" + output: Optional[str] - output: str - """(Optional) Output result from the successful MCP call""" + type: Literal["mcp_call"] class ItemOpenAIResponseOutputMessageMcpListToolsTool(TypedDict, total=False): - input_schema: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """JSON schema defining the tool's input parameters""" + input_schema: Required[Dict[str, object]] name: Required[str] - """Name of the tool""" - description: str - """(Optional) Description of what the tool does""" + description: Optional[str] class ItemOpenAIResponseOutputMessageMcpListTools(TypedDict, total=False): id: Required[str] - """Unique identifier for this MCP list tools operation""" server_label: Required[str] - """Label identifying the MCP server providing the tools""" tools: Required[Iterable[ItemOpenAIResponseOutputMessageMcpListToolsTool]] - """List of available tools provided by the MCP server""" - type: Required[Literal["mcp_list_tools"]] - """Tool call type identifier, always "mcp_list_tools" """ + type: Literal["mcp_list_tools"] Item: TypeAlias = Union[ - ItemOpenAIResponseMessage, + ItemOpenAIResponseMessageInput, ItemOpenAIResponseOutputMessageWebSearchToolCall, ItemOpenAIResponseOutputMessageFileSearchToolCall, ItemOpenAIResponseOutputMessageFunctionToolCall, diff --git a/src/llama_stack_client/types/conversations/item_create_response.py b/src/llama_stack_client/types/conversations/item_create_response.py index 580aaf23..182277b5 100644 --- a/src/llama_stack_client/types/conversations/item_create_response.py +++ b/src/llama_stack_client/types/conversations/item_create_response.py @@ -15,19 +15,19 @@ __all__ = [ "ItemCreateResponse", "Data", - "DataOpenAIResponseMessage", - "DataOpenAIResponseMessageContentUnionMember1", - "DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "DataOpenAIResponseMessageContentUnionMember2", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", + "DataOpenAIResponseMessageOutput", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", "DataOpenAIResponseOutputMessageWebSearchToolCall", "DataOpenAIResponseOutputMessageFileSearchToolCall", "DataOpenAIResponseOutputMessageFileSearchToolCallResult", @@ -41,91 +41,77 @@ ] -class DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText(BaseModel): +class DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( + BaseModel +): text: str - """The text content of the input message""" - - type: Literal["input_text"] - """Content type identifier, always "input_text" """ + type: Optional[Literal["input_text"]] = None -class DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage(BaseModel): - detail: Literal["low", "high", "auto"] - """Level of detail for image processing, can be "low", "high", or "auto" """ - type: Literal["input_image"] - """Content type identifier, always "input_image" """ +class DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( + BaseModel +): + detail: Optional[Literal["low", "high", "auto"]] = None file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" image_url: Optional[str] = None - """(Optional) URL of the image content""" + type: Optional[Literal["input_image"]] = None -class DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile(BaseModel): - type: Literal["input_file"] - """The type of the input item. Always `input_file`.""" +class DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( + BaseModel +): file_data: Optional[str] = None - """The data of the file to be sent to the model.""" file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" file_url: Optional[str] = None - """The URL of the file to be sent to the model.""" filename: Optional[str] = None - """The name of the file to be sent to the model.""" + type: Optional[Literal["input_file"]] = None -DataOpenAIResponseMessageContentUnionMember1: TypeAlias = Annotated[ + +DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Annotated[ Union[ - DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, + DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ], PropertyInfo(discriminator="type"), ] -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( BaseModel ): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + type: Optional[Literal["url_citation"]] = None -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( + +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( BaseModel ): container_id: str @@ -138,134 +124,125 @@ class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageCon start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( BaseModel ): file_id: str index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None -DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ +DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ Union[ - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ], PropertyInfo(discriminator="type"), ] -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText(BaseModel): - annotations: List[ - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation - ] - +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( + BaseModel +): text: str - type: Literal["output_text"] + annotations: Optional[ + List[ + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + ] = None + + type: Optional[Literal["output_text"]] = None -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal(BaseModel): +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( + BaseModel +): refusal: str - """Refusal text supplied by the model""" - type: Literal["refusal"] - """Content part type identifier, always "refusal" """ + type: Optional[Literal["refusal"]] = None -DataOpenAIResponseMessageContentUnionMember2: TypeAlias = Annotated[ +DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Annotated[ Union[ - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ], PropertyInfo(discriminator="type"), ] -class DataOpenAIResponseMessage(BaseModel): +class DataOpenAIResponseMessageOutput(BaseModel): content: Union[ - str, List[DataOpenAIResponseMessageContentUnionMember1], List[DataOpenAIResponseMessageContentUnionMember2] + str, + List[ + DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + List[ + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal + ], ] role: Literal["system", "developer", "user", "assistant"] - type: Literal["message"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["message"]] = None + class DataOpenAIResponseOutputMessageWebSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" status: str - """Current status of the web search operation""" - type: Literal["web_search_call"] - """Tool call type identifier, always "web_search_call" """ + type: Optional[Literal["web_search_call"]] = None class DataOpenAIResponseOutputMessageFileSearchToolCallResult(BaseModel): - attributes: Dict[str, Union[bool, float, str, List[object], object, None]] - """(Optional) Key-value attributes associated with the file""" + attributes: Dict[str, object] file_id: str - """Unique identifier of the file containing the result""" filename: str - """Name of the file containing the result""" score: float - """Relevance score for this search result (between 0 and 1)""" text: str - """Text content of the search result""" class DataOpenAIResponseOutputMessageFileSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" queries: List[str] - """List of search queries executed""" status: str - """Current status of the file search operation""" - - type: Literal["file_search_call"] - """Tool call type identifier, always "file_search_call" """ results: Optional[List[DataOpenAIResponseOutputMessageFileSearchToolCallResult]] = None - """(Optional) Search results returned by the file search operation""" + + type: Optional[Literal["file_search_call"]] = None class DataOpenAIResponseOutputMessageFunctionToolCall(BaseModel): arguments: str - """JSON string containing the function arguments""" call_id: str - """Unique identifier for the function call""" name: str - """Name of the function being called""" - - type: Literal["function_call"] - """Tool call type identifier, always "function_call" """ id: Optional[str] = None - """(Optional) Additional identifier for the tool call""" status: Optional[str] = None - """(Optional) Current status of the function call execution""" + + type: Optional[Literal["function_call"]] = None class DataOpenAIResponseInputFunctionToolCallOutput(BaseModel): @@ -273,12 +250,12 @@ class DataOpenAIResponseInputFunctionToolCallOutput(BaseModel): output: str - type: Literal["function_call_output"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["function_call_output"]] = None + class DataOpenAIResponseMcpApprovalRequest(BaseModel): id: str @@ -289,7 +266,7 @@ class DataOpenAIResponseMcpApprovalRequest(BaseModel): server_label: str - type: Literal["mcp_approval_request"] + type: Optional[Literal["mcp_approval_request"]] = None class DataOpenAIResponseMcpApprovalResponse(BaseModel): @@ -297,64 +274,50 @@ class DataOpenAIResponseMcpApprovalResponse(BaseModel): approve: bool - type: Literal["mcp_approval_response"] - id: Optional[str] = None reason: Optional[str] = None + type: Optional[Literal["mcp_approval_response"]] = None + class DataOpenAIResponseOutputMessageMcpCall(BaseModel): id: str - """Unique identifier for this MCP call""" arguments: str - """JSON string containing the MCP call arguments""" name: str - """Name of the MCP method being called""" server_label: str - """Label identifying the MCP server handling the call""" - - type: Literal["mcp_call"] - """Tool call type identifier, always "mcp_call" """ error: Optional[str] = None - """(Optional) Error message if the MCP call failed""" output: Optional[str] = None - """(Optional) Output result from the successful MCP call""" + + type: Optional[Literal["mcp_call"]] = None class DataOpenAIResponseOutputMessageMcpListToolsTool(BaseModel): - input_schema: Dict[str, Union[bool, float, str, List[object], object, None]] - """JSON schema defining the tool's input parameters""" + input_schema: Dict[str, object] name: str - """Name of the tool""" description: Optional[str] = None - """(Optional) Description of what the tool does""" class DataOpenAIResponseOutputMessageMcpListTools(BaseModel): id: str - """Unique identifier for this MCP list tools operation""" server_label: str - """Label identifying the MCP server providing the tools""" tools: List[DataOpenAIResponseOutputMessageMcpListToolsTool] - """List of available tools provided by the MCP server""" - type: Literal["mcp_list_tools"] - """Tool call type identifier, always "mcp_list_tools" """ + type: Optional[Literal["mcp_list_tools"]] = None Data: TypeAlias = Annotated[ Union[ - DataOpenAIResponseMessage, + DataOpenAIResponseMessageOutput, DataOpenAIResponseOutputMessageWebSearchToolCall, DataOpenAIResponseOutputMessageFileSearchToolCall, DataOpenAIResponseOutputMessageFunctionToolCall, @@ -370,11 +333,16 @@ class DataOpenAIResponseOutputMessageMcpListTools(BaseModel): class ItemCreateResponse(BaseModel): data: List[Data] - - has_more: bool - - object: str + """List of conversation items""" first_id: Optional[str] = None + """The ID of the first item in the list""" + + has_more: Optional[bool] = None + """Whether there are more items available""" last_id: Optional[str] = None + """The ID of the last item in the list""" + + object: Optional[str] = None + """Object type""" diff --git a/src/llama_stack_client/types/conversations/item_delete_response.py b/src/llama_stack_client/types/conversations/item_delete_response.py new file mode 100644 index 00000000..af7b7f64 --- /dev/null +++ b/src/llama_stack_client/types/conversations/item_delete_response.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel + +__all__ = ["ItemDeleteResponse"] + + +class ItemDeleteResponse(BaseModel): + id: str + """The deleted item identifier""" + + deleted: Optional[bool] = None + """Whether the object was deleted""" + + object: Optional[str] = None + """Object type""" diff --git a/src/llama_stack_client/types/conversations/item_get_response.py b/src/llama_stack_client/types/conversations/item_get_response.py index 434e4639..90d406d2 100644 --- a/src/llama_stack_client/types/conversations/item_get_response.py +++ b/src/llama_stack_client/types/conversations/item_get_response.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import List, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from ..._utils import PropertyInfo @@ -14,117 +14,92 @@ __all__ = [ "ItemGetResponse", - "OpenAIResponseMessage", - "OpenAIResponseMessageContentUnionMember1", - "OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "OpenAIResponseMessageContentUnionMember2", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", - "OpenAIResponseOutputMessageWebSearchToolCall", - "OpenAIResponseOutputMessageFileSearchToolCall", - "OpenAIResponseOutputMessageFileSearchToolCallResult", - "OpenAIResponseOutputMessageFunctionToolCall", - "OpenAIResponseInputFunctionToolCallOutput", - "OpenAIResponseMcpApprovalRequest", - "OpenAIResponseMcpApprovalResponse", - "OpenAIResponseOutputMessageMcpCall", - "OpenAIResponseOutputMessageMcpListTools", - "OpenAIResponseOutputMessageMcpListToolsTool", + "ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", ] -class OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText(BaseModel): +class ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( + BaseModel +): text: str - """The text content of the input message""" - - type: Literal["input_text"] - """Content type identifier, always "input_text" """ + type: Optional[Literal["input_text"]] = None -class OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage(BaseModel): - detail: Literal["low", "high", "auto"] - """Level of detail for image processing, can be "low", "high", or "auto" """ - type: Literal["input_image"] - """Content type identifier, always "input_image" """ +class ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( + BaseModel +): + detail: Optional[Literal["low", "high", "auto"]] = None file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" image_url: Optional[str] = None - """(Optional) URL of the image content""" + type: Optional[Literal["input_image"]] = None -class OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile(BaseModel): - type: Literal["input_file"] - """The type of the input item. Always `input_file`.""" +class ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( + BaseModel +): file_data: Optional[str] = None - """The data of the file to be sent to the model.""" file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" file_url: Optional[str] = None - """The URL of the file to be sent to the model.""" filename: Optional[str] = None - """The name of the file to be sent to the model.""" + + type: Optional[Literal["input_file"]] = None -OpenAIResponseMessageContentUnionMember1: TypeAlias = Annotated[ +ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Annotated[ Union[ - OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, + ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ], PropertyInfo(discriminator="type"), ] -class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None -class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( BaseModel ): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + type: Optional[Literal["url_citation"]] = None -class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( + +class ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( BaseModel ): container_id: str @@ -137,227 +112,74 @@ class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContent start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None -class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( BaseModel ): file_id: str index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None -OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ +ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ Union[ - OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, + ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ], PropertyInfo(discriminator="type"), ] -class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText(BaseModel): - annotations: List[OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation] - +class ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( + BaseModel +): text: str - type: Literal["output_text"] + annotations: Optional[ + List[ + ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + ] = None + + type: Optional[Literal["output_text"]] = None -class OpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal(BaseModel): +class ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( + BaseModel +): refusal: str - """Refusal text supplied by the model""" - type: Literal["refusal"] - """Content part type identifier, always "refusal" """ + type: Optional[Literal["refusal"]] = None -OpenAIResponseMessageContentUnionMember2: TypeAlias = Annotated[ +ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Annotated[ Union[ - OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - OpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, + ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ], PropertyInfo(discriminator="type"), ] -class OpenAIResponseMessage(BaseModel): - content: Union[str, List[OpenAIResponseMessageContentUnionMember1], List[OpenAIResponseMessageContentUnionMember2]] +class ItemGetResponse(BaseModel): + content: Union[ + str, + List[ + ContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + List[ContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal], + ] role: Literal["system", "developer", "user", "assistant"] - type: Literal["message"] - - id: Optional[str] = None - - status: Optional[str] = None - - -class OpenAIResponseOutputMessageWebSearchToolCall(BaseModel): - id: str - """Unique identifier for this tool call""" - - status: str - """Current status of the web search operation""" - - type: Literal["web_search_call"] - """Tool call type identifier, always "web_search_call" """ - - -class OpenAIResponseOutputMessageFileSearchToolCallResult(BaseModel): - attributes: Dict[str, Union[bool, float, str, List[object], object, None]] - """(Optional) Key-value attributes associated with the file""" - - file_id: str - """Unique identifier of the file containing the result""" - - filename: str - """Name of the file containing the result""" - - score: float - """Relevance score for this search result (between 0 and 1)""" - - text: str - """Text content of the search result""" - - -class OpenAIResponseOutputMessageFileSearchToolCall(BaseModel): - id: str - """Unique identifier for this tool call""" - - queries: List[str] - """List of search queries executed""" - - status: str - """Current status of the file search operation""" - - type: Literal["file_search_call"] - """Tool call type identifier, always "file_search_call" """ - - results: Optional[List[OpenAIResponseOutputMessageFileSearchToolCallResult]] = None - """(Optional) Search results returned by the file search operation""" - - -class OpenAIResponseOutputMessageFunctionToolCall(BaseModel): - arguments: str - """JSON string containing the function arguments""" - - call_id: str - """Unique identifier for the function call""" - - name: str - """Name of the function being called""" - - type: Literal["function_call"] - """Tool call type identifier, always "function_call" """ - id: Optional[str] = None - """(Optional) Additional identifier for the tool call""" status: Optional[str] = None - """(Optional) Current status of the function call execution""" - - -class OpenAIResponseInputFunctionToolCallOutput(BaseModel): - call_id: str - - output: str - - type: Literal["function_call_output"] - - id: Optional[str] = None - - status: Optional[str] = None - - -class OpenAIResponseMcpApprovalRequest(BaseModel): - id: str - - arguments: str - - name: str - - server_label: str - - type: Literal["mcp_approval_request"] - - -class OpenAIResponseMcpApprovalResponse(BaseModel): - approval_request_id: str - - approve: bool - - type: Literal["mcp_approval_response"] - - id: Optional[str] = None - - reason: Optional[str] = None - -class OpenAIResponseOutputMessageMcpCall(BaseModel): - id: str - """Unique identifier for this MCP call""" - - arguments: str - """JSON string containing the MCP call arguments""" - - name: str - """Name of the MCP method being called""" - - server_label: str - """Label identifying the MCP server handling the call""" - - type: Literal["mcp_call"] - """Tool call type identifier, always "mcp_call" """ - - error: Optional[str] = None - """(Optional) Error message if the MCP call failed""" - - output: Optional[str] = None - """(Optional) Output result from the successful MCP call""" - - -class OpenAIResponseOutputMessageMcpListToolsTool(BaseModel): - input_schema: Dict[str, Union[bool, float, str, List[object], object, None]] - """JSON schema defining the tool's input parameters""" - - name: str - """Name of the tool""" - - description: Optional[str] = None - """(Optional) Description of what the tool does""" - - -class OpenAIResponseOutputMessageMcpListTools(BaseModel): - id: str - """Unique identifier for this MCP list tools operation""" - - server_label: str - """Label identifying the MCP server providing the tools""" - - tools: List[OpenAIResponseOutputMessageMcpListToolsTool] - """List of available tools provided by the MCP server""" - - type: Literal["mcp_list_tools"] - """Tool call type identifier, always "mcp_list_tools" """ - - -ItemGetResponse: TypeAlias = Annotated[ - Union[ - OpenAIResponseMessage, - OpenAIResponseOutputMessageWebSearchToolCall, - OpenAIResponseOutputMessageFileSearchToolCall, - OpenAIResponseOutputMessageFunctionToolCall, - OpenAIResponseInputFunctionToolCallOutput, - OpenAIResponseMcpApprovalRequest, - OpenAIResponseMcpApprovalResponse, - OpenAIResponseOutputMessageMcpCall, - OpenAIResponseOutputMessageMcpListTools, - ], - PropertyInfo(discriminator="type"), -] + type: Optional[Literal["message"]] = None diff --git a/src/llama_stack_client/types/conversations/item_list_params.py b/src/llama_stack_client/types/conversations/item_list_params.py index 768a91b7..dd094dec 100644 --- a/src/llama_stack_client/types/conversations/item_list_params.py +++ b/src/llama_stack_client/types/conversations/item_list_params.py @@ -8,31 +8,29 @@ from __future__ import annotations -from typing import List +from typing import List, Optional from typing_extensions import Literal, TypedDict __all__ = ["ItemListParams"] class ItemListParams(TypedDict, total=False): - after: str - """An item ID to list items after, used in pagination.""" - - include: List[ - Literal[ - "web_search_call.action.sources", - "code_interpreter_call.outputs", - "computer_call_output.output.image_url", - "file_search_call.results", - "message.input_image.image_url", - "message.output_text.logprobs", - "reasoning.encrypted_content", + after: Optional[str] + + include: Optional[ + List[ + Literal[ + "web_search_call.action.sources", + "code_interpreter_call.outputs", + "computer_call_output.output.image_url", + "file_search_call.results", + "message.input_image.image_url", + "message.output_text.logprobs", + "reasoning.encrypted_content", + ] ] ] - """Specify additional output data to include in the response.""" - limit: int - """A limit on the number of objects to be returned (1-100, default 20).""" + limit: Optional[int] - order: Literal["asc", "desc"] - """The order to return items in (asc or desc, default desc).""" + order: Optional[Literal["asc", "desc"]] diff --git a/src/llama_stack_client/types/conversations/item_list_response.py b/src/llama_stack_client/types/conversations/item_list_response.py index d6ba4735..59b8a85f 100644 --- a/src/llama_stack_client/types/conversations/item_list_response.py +++ b/src/llama_stack_client/types/conversations/item_list_response.py @@ -14,19 +14,19 @@ __all__ = [ "ItemListResponse", - "OpenAIResponseMessage", - "OpenAIResponseMessageContentUnionMember1", - "OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "OpenAIResponseMessageContentUnionMember2", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "OpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", + "OpenAIResponseMessageOutput", + "OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", "OpenAIResponseOutputMessageWebSearchToolCall", "OpenAIResponseOutputMessageFileSearchToolCall", "OpenAIResponseOutputMessageFileSearchToolCallResult", @@ -40,91 +40,77 @@ ] -class OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText(BaseModel): +class OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( + BaseModel +): text: str - """The text content of the input message""" - type: Literal["input_text"] - """Content type identifier, always "input_text" """ + type: Optional[Literal["input_text"]] = None -class OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage(BaseModel): - detail: Literal["low", "high", "auto"] - """Level of detail for image processing, can be "low", "high", or "auto" """ - - type: Literal["input_image"] - """Content type identifier, always "input_image" """ +class OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( + BaseModel +): + detail: Optional[Literal["low", "high", "auto"]] = None file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" image_url: Optional[str] = None - """(Optional) URL of the image content""" + type: Optional[Literal["input_image"]] = None -class OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile(BaseModel): - type: Literal["input_file"] - """The type of the input item. Always `input_file`.""" +class OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( + BaseModel +): file_data: Optional[str] = None - """The data of the file to be sent to the model.""" file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" file_url: Optional[str] = None - """The URL of the file to be sent to the model.""" filename: Optional[str] = None - """The name of the file to be sent to the model.""" + type: Optional[Literal["input_file"]] = None -OpenAIResponseMessageContentUnionMember1: TypeAlias = Annotated[ + +OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Annotated[ Union[ - OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, + OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ], PropertyInfo(discriminator="type"), ] -class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None -class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( BaseModel ): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + type: Optional[Literal["url_citation"]] = None -class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( + +class OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( BaseModel ): container_id: str @@ -137,130 +123,125 @@ class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContent start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None -class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( BaseModel ): file_id: str index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None -OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ +OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ Union[ - OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, + OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ], PropertyInfo(discriminator="type"), ] -class OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText(BaseModel): - annotations: List[OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation] - +class OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( + BaseModel +): text: str - type: Literal["output_text"] + annotations: Optional[ + List[ + OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + ] = None + + type: Optional[Literal["output_text"]] = None -class OpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal(BaseModel): +class OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( + BaseModel +): refusal: str - """Refusal text supplied by the model""" - type: Literal["refusal"] - """Content part type identifier, always "refusal" """ + type: Optional[Literal["refusal"]] = None -OpenAIResponseMessageContentUnionMember2: TypeAlias = Annotated[ +OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Annotated[ Union[ - OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - OpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, + OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ], PropertyInfo(discriminator="type"), ] -class OpenAIResponseMessage(BaseModel): - content: Union[str, List[OpenAIResponseMessageContentUnionMember1], List[OpenAIResponseMessageContentUnionMember2]] +class OpenAIResponseMessageOutput(BaseModel): + content: Union[ + str, + List[ + OpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + List[ + OpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal + ], + ] role: Literal["system", "developer", "user", "assistant"] - type: Literal["message"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["message"]] = None + class OpenAIResponseOutputMessageWebSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" status: str - """Current status of the web search operation""" - type: Literal["web_search_call"] - """Tool call type identifier, always "web_search_call" """ + type: Optional[Literal["web_search_call"]] = None class OpenAIResponseOutputMessageFileSearchToolCallResult(BaseModel): - attributes: Dict[str, Union[bool, float, str, List[object], object, None]] - """(Optional) Key-value attributes associated with the file""" + attributes: Dict[str, object] file_id: str - """Unique identifier of the file containing the result""" filename: str - """Name of the file containing the result""" score: float - """Relevance score for this search result (between 0 and 1)""" text: str - """Text content of the search result""" class OpenAIResponseOutputMessageFileSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" queries: List[str] - """List of search queries executed""" status: str - """Current status of the file search operation""" - - type: Literal["file_search_call"] - """Tool call type identifier, always "file_search_call" """ results: Optional[List[OpenAIResponseOutputMessageFileSearchToolCallResult]] = None - """(Optional) Search results returned by the file search operation""" + + type: Optional[Literal["file_search_call"]] = None class OpenAIResponseOutputMessageFunctionToolCall(BaseModel): arguments: str - """JSON string containing the function arguments""" call_id: str - """Unique identifier for the function call""" name: str - """Name of the function being called""" - - type: Literal["function_call"] - """Tool call type identifier, always "function_call" """ id: Optional[str] = None - """(Optional) Additional identifier for the tool call""" status: Optional[str] = None - """(Optional) Current status of the function call execution""" + + type: Optional[Literal["function_call"]] = None class OpenAIResponseInputFunctionToolCallOutput(BaseModel): @@ -268,12 +249,12 @@ class OpenAIResponseInputFunctionToolCallOutput(BaseModel): output: str - type: Literal["function_call_output"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["function_call_output"]] = None + class OpenAIResponseMcpApprovalRequest(BaseModel): id: str @@ -284,7 +265,7 @@ class OpenAIResponseMcpApprovalRequest(BaseModel): server_label: str - type: Literal["mcp_approval_request"] + type: Optional[Literal["mcp_approval_request"]] = None class OpenAIResponseMcpApprovalResponse(BaseModel): @@ -292,64 +273,50 @@ class OpenAIResponseMcpApprovalResponse(BaseModel): approve: bool - type: Literal["mcp_approval_response"] - id: Optional[str] = None reason: Optional[str] = None + type: Optional[Literal["mcp_approval_response"]] = None + class OpenAIResponseOutputMessageMcpCall(BaseModel): id: str - """Unique identifier for this MCP call""" arguments: str - """JSON string containing the MCP call arguments""" name: str - """Name of the MCP method being called""" server_label: str - """Label identifying the MCP server handling the call""" - - type: Literal["mcp_call"] - """Tool call type identifier, always "mcp_call" """ error: Optional[str] = None - """(Optional) Error message if the MCP call failed""" output: Optional[str] = None - """(Optional) Output result from the successful MCP call""" + + type: Optional[Literal["mcp_call"]] = None class OpenAIResponseOutputMessageMcpListToolsTool(BaseModel): - input_schema: Dict[str, Union[bool, float, str, List[object], object, None]] - """JSON schema defining the tool's input parameters""" + input_schema: Dict[str, object] name: str - """Name of the tool""" description: Optional[str] = None - """(Optional) Description of what the tool does""" class OpenAIResponseOutputMessageMcpListTools(BaseModel): id: str - """Unique identifier for this MCP list tools operation""" server_label: str - """Label identifying the MCP server providing the tools""" tools: List[OpenAIResponseOutputMessageMcpListToolsTool] - """List of available tools provided by the MCP server""" - type: Literal["mcp_list_tools"] - """Tool call type identifier, always "mcp_list_tools" """ + type: Optional[Literal["mcp_list_tools"]] = None ItemListResponse: TypeAlias = Annotated[ Union[ - OpenAIResponseMessage, + OpenAIResponseMessageOutput, OpenAIResponseOutputMessageWebSearchToolCall, OpenAIResponseOutputMessageFileSearchToolCall, OpenAIResponseOutputMessageFunctionToolCall, diff --git a/src/llama_stack_client/types/create_embeddings_response.py b/src/llama_stack_client/types/create_embeddings_response.py index b4cd091a..c688ffcd 100644 --- a/src/llama_stack_client/types/create_embeddings_response.py +++ b/src/llama_stack_client/types/create_embeddings_response.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Union +from typing import List, Union, Optional from typing_extensions import Literal from .._models import BaseModel @@ -16,35 +16,24 @@ class Data(BaseModel): embedding: Union[List[float], str] - """ - The embedding vector as a list of floats (when encoding_format="float") or as a - base64-encoded string (when encoding_format="base64") - """ index: int - """The index of the embedding in the input list""" - object: Literal["embedding"] - """The object type, which will be "embedding" """ + object: Optional[Literal["embedding"]] = None class Usage(BaseModel): prompt_tokens: int - """The number of tokens in the input""" total_tokens: int - """The total number of tokens used""" class CreateEmbeddingsResponse(BaseModel): data: List[Data] - """List of embedding data objects""" model: str - """The model that was used to generate the embeddings""" - - object: Literal["list"] - """The object type, which will be "list" """ usage: Usage - """Usage information""" + """Usage information for an OpenAI-compatible embeddings response.""" + + object: Optional[Literal["list"]] = None diff --git a/src/llama_stack_client/types/create_response.py b/src/llama_stack_client/types/create_response.py index e26f1cf1..fa32d48c 100644 --- a/src/llama_stack_client/types/create_response.py +++ b/src/llama_stack_client/types/create_response.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, List, Optional from .._models import BaseModel @@ -15,30 +15,21 @@ class Result(BaseModel): flagged: bool - """Whether any of the below categories are flagged.""" - - metadata: Dict[str, Union[bool, float, str, List[object], object, None]] categories: Optional[Dict[str, bool]] = None - """A list of the categories, and whether they are flagged or not.""" category_applied_input_types: Optional[Dict[str, List[str]]] = None - """ - A list of the categories along with the input type(s) that the score applies to. - """ category_scores: Optional[Dict[str, float]] = None - """A list of the categories along with their scores as predicted by model.""" + + metadata: Optional[Dict[str, object]] = None user_message: Optional[str] = None class CreateResponse(BaseModel): id: str - """The unique identifier for the moderation request.""" model: str - """The model used to generate the moderation results.""" results: List[Result] - """A list of moderation objects""" diff --git a/src/llama_stack_client/types/delete_file_response.py b/src/llama_stack_client/types/delete_file_response.py index 281b2a8f..674b8031 100644 --- a/src/llama_stack_client/types/delete_file_response.py +++ b/src/llama_stack_client/types/delete_file_response.py @@ -6,6 +6,7 @@ # 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 @@ -15,10 +16,7 @@ class DeleteFileResponse(BaseModel): id: str - """The file identifier that was deleted""" deleted: bool - """Whether the file was successfully deleted""" - object: Literal["file"] - """The object type, which is always "file" """ + object: Optional[Literal["file"]] = None diff --git a/src/llama_stack_client/types/embedding_create_params.py b/src/llama_stack_client/types/embedding_create_params.py index 12ce2799..d976bdbe 100644 --- a/src/llama_stack_client/types/embedding_create_params.py +++ b/src/llama_stack_client/types/embedding_create_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional from typing_extensions import Required, TypedDict from .._types import SequenceNotStr @@ -18,32 +18,11 @@ class EmbeddingCreateParams(TypedDict, total=False): input: Required[Union[str, SequenceNotStr[str]]] - """Input text to embed, encoded as a string or array of strings. - - To embed multiple inputs in a single request, pass an array of strings. - """ model: Required[str] - """The identifier of the model to use. - - The model must be an embedding model registered with Llama Stack and available - via the /models endpoint. - """ - - dimensions: int - """(Optional) The number of dimensions the resulting output embeddings should have. - - Only supported in text-embedding-3 and later models. - """ - encoding_format: str - """(Optional) The format to return the embeddings in. + dimensions: Optional[int] - Can be either "float" or "base64". Defaults to "float". - """ + encoding_format: Optional[str] - user: str - """ - (Optional) A unique identifier representing your end-user, which can help OpenAI - to monitor and detect abuse. - """ + user: Optional[str] diff --git a/src/llama_stack_client/types/file.py b/src/llama_stack_client/types/file.py index 12769adb..c3fad6ec 100644 --- a/src/llama_stack_client/types/file.py +++ b/src/llama_stack_client/types/file.py @@ -6,6 +6,7 @@ # 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 @@ -15,22 +16,16 @@ class File(BaseModel): id: str - """The file identifier, which can be referenced in the API endpoints""" bytes: int - """The size of the file, in bytes""" created_at: int - """The Unix timestamp (in seconds) for when the file was created""" expires_at: int - """The Unix timestamp (in seconds) for when the file expires""" filename: str - """The name of the file""" - - object: Literal["file"] - """The object type, which is always "file" """ purpose: Literal["assistants", "batch"] - """The intended purpose of the file""" + """Valid purpose values for OpenAI Files API.""" + + object: Optional[Literal["file"]] = None diff --git a/src/llama_stack_client/types/file_create_params.py b/src/llama_stack_client/types/file_create_params.py index de0e641c..54587dd5 100644 --- a/src/llama_stack_client/types/file_create_params.py +++ b/src/llama_stack_client/types/file_create_params.py @@ -8,6 +8,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Literal, Required, TypedDict from .._types import FileTypes @@ -21,8 +22,10 @@ class FileCreateParams(TypedDict, total=False): purpose: Required[Literal["assistants", "batch"]] """Valid purpose values for OpenAI Files API.""" - expires_after: ExpiresAfter - """Control expiration of uploaded files. Params: + expires_after: Optional[ExpiresAfter] + """Control expiration of uploaded files. + + Params: - anchor, must be "created_at" - seconds, must be int between 3600 and 2592000 (1 hour to 30 days) diff --git a/src/llama_stack_client/types/file_list_params.py b/src/llama_stack_client/types/file_list_params.py index 704bbde9..0b267636 100644 --- a/src/llama_stack_client/types/file_list_params.py +++ b/src/llama_stack_client/types/file_list_params.py @@ -8,32 +8,19 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Literal, TypedDict __all__ = ["FileListParams"] class FileListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. + after: Optional[str] - `after` is an object ID that defines your place in the list. For instance, if - you make a list request and receive 100 objects, ending with obj_foo, your - subsequent call can include after=obj_foo in order to fetch the next page of the - list. - """ + limit: Optional[int] - limit: int - """A limit on the number of objects to be returned. + order: Optional[Literal["asc", "desc"]] + """Sort order for paginated responses.""" - Limit can range between 1 and 10,000, and the default is 10,000. - """ - - order: Literal["asc", "desc"] - """Sort order by the `created_at` timestamp of the objects. - - `asc` for ascending order and `desc` for descending order. - """ - - purpose: Literal["assistants", "batch"] - """Only return files with the given purpose.""" + purpose: Optional[Literal["assistants", "batch"]] + """Valid purpose values for OpenAI Files API.""" diff --git a/src/llama_stack_client/types/health_info.py b/src/llama_stack_client/types/health_info.py index 032d5c81..3ce69fc0 100644 --- a/src/llama_stack_client/types/health_info.py +++ b/src/llama_stack_client/types/health_info.py @@ -15,4 +15,3 @@ class HealthInfo(BaseModel): status: Literal["OK", "Error", "Not Implemented"] - """Current health status of the service""" diff --git a/src/llama_stack_client/types/list_files_response.py b/src/llama_stack_client/types/list_files_response.py index 7d2c166f..501a3dd2 100644 --- a/src/llama_stack_client/types/list_files_response.py +++ b/src/llama_stack_client/types/list_files_response.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List +from typing import List, Optional from typing_extensions import Literal from .file import File @@ -17,16 +17,11 @@ class ListFilesResponse(BaseModel): data: List[File] - """List of file objects""" first_id: str - """ID of the first file in the list for pagination""" has_more: bool - """Whether there are more files available beyond this page""" last_id: str - """ID of the last file in the list for pagination""" - object: Literal["list"] - """The object type, which is always "list" """ + object: Optional[Literal["list"]] = None diff --git a/src/llama_stack_client/types/list_providers_response.py b/src/llama_stack_client/types/list_providers_response.py index d3d0efb8..b7b51def 100644 --- a/src/llama_stack_client/types/list_providers_response.py +++ b/src/llama_stack_client/types/list_providers_response.py @@ -14,4 +14,3 @@ class ListProvidersResponse(BaseModel): data: ProviderListResponse - """List of provider information objects""" diff --git a/src/llama_stack_client/types/list_routes_response.py b/src/llama_stack_client/types/list_routes_response.py index 8c690969..dca4db45 100644 --- a/src/llama_stack_client/types/list_routes_response.py +++ b/src/llama_stack_client/types/list_routes_response.py @@ -14,4 +14,3 @@ class ListRoutesResponse(BaseModel): data: RouteListResponse - """List of available route information objects""" diff --git a/src/llama_stack_client/types/list_tool_groups_response.py b/src/llama_stack_client/types/list_tool_groups_response.py index dfef579f..7dceef99 100644 --- a/src/llama_stack_client/types/list_tool_groups_response.py +++ b/src/llama_stack_client/types/list_tool_groups_response.py @@ -14,4 +14,3 @@ class ListToolGroupsResponse(BaseModel): data: ToolgroupListResponse - """List of tool groups""" diff --git a/src/llama_stack_client/types/list_vector_stores_response.py b/src/llama_stack_client/types/list_vector_stores_response.py index 925e0265..471787c6 100644 --- a/src/llama_stack_client/types/list_vector_stores_response.py +++ b/src/llama_stack_client/types/list_vector_stores_response.py @@ -16,16 +16,11 @@ class ListVectorStoresResponse(BaseModel): data: List[VectorStore] - """List of vector store objects""" - - has_more: bool - """Whether there are more vector stores available beyond this page""" - - object: str - """Object type identifier, always "list" """ first_id: Optional[str] = None - """(Optional) ID of the first vector store in the list for pagination""" + + has_more: Optional[bool] = None last_id: Optional[str] = None - """(Optional) ID of the last vector store in the list for pagination""" + + object: Optional[str] = None diff --git a/src/llama_stack_client/types/model.py b/src/llama_stack_client/types/model.py index 5a2f4305..178b2b22 100644 --- a/src/llama_stack_client/types/model.py +++ b/src/llama_stack_client/types/model.py @@ -6,8 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import builtins -from typing import Dict, List, Union, Optional +from typing import Dict, Optional from typing_extensions import Literal from .._models import BaseModel @@ -20,8 +19,8 @@ class Model(BaseModel): created: int - object: Literal["model"] - owned_by: str - custom_metadata: Optional[Dict[str, Union[bool, float, str, List[builtins.object], builtins.object, None]]] = None + custom_metadata: Optional[Dict[str, object]] = None + + object: Optional[Literal["model"]] = None diff --git a/src/llama_stack_client/types/model_register_params.py b/src/llama_stack_client/types/model_register_params.py index a13382a8..1b2b459d 100644 --- a/src/llama_stack_client/types/model_register_params.py +++ b/src/llama_stack_client/types/model_register_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Optional from typing_extensions import Literal, Required, TypedDict __all__ = ["ModelRegisterParams"] @@ -10,16 +10,12 @@ class ModelRegisterParams(TypedDict, total=False): model_id: Required[str] - """The identifier of the model to register.""" - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """Any additional metadata for this model.""" + metadata: Optional[Dict[str, object]] - model_type: Literal["llm", "embedding", "rerank"] - """The type of model to register.""" + model_type: Optional[Literal["llm", "embedding", "rerank"]] + """Enumeration of supported model types in Llama Stack.""" - provider_id: str - """The identifier of the provider.""" + provider_id: Optional[str] - provider_model_id: str - """The identifier of the model in the provider.""" + provider_model_id: Optional[str] diff --git a/src/llama_stack_client/types/model_register_response.py b/src/llama_stack_client/types/model_register_response.py index 08b0e8d6..bf9ada43 100644 --- a/src/llama_stack_client/types/model_register_response.py +++ b/src/llama_stack_client/types/model_register_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, Optional from typing_extensions import Literal from pydantic import Field as FieldInfo @@ -14,17 +14,16 @@ class ModelRegisterResponse(BaseModel): identifier: str """Unique identifier for this resource in llama stack""" - metadata: Dict[str, Union[bool, float, str, List[object], object, None]] - """Any additional metadata for this model""" - - api_model_type: Literal["llm", "embedding", "rerank"] = FieldInfo(alias="model_type") - """The type of model (LLM or embedding model)""" - provider_id: str """ID of the provider that owns this resource""" - type: Literal["model"] - """The resource type, always 'model' for model resources""" + metadata: Optional[Dict[str, object]] = None + """Any additional metadata for this model""" + + api_model_type: Optional[Literal["llm", "embedding", "rerank"]] = FieldInfo(alias="model_type", default=None) + """Enumeration of supported model types in Llama Stack.""" provider_resource_id: Optional[str] = None """Unique identifier for this resource in the provider""" + + type: Optional[Literal["model"]] = None diff --git a/src/llama_stack_client/types/model_retrieve_response.py b/src/llama_stack_client/types/model_retrieve_response.py index 58f477d8..3bef29d9 100644 --- a/src/llama_stack_client/types/model_retrieve_response.py +++ b/src/llama_stack_client/types/model_retrieve_response.py @@ -1,6 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, Optional from typing_extensions import Literal from pydantic import Field as FieldInfo @@ -14,17 +14,16 @@ class ModelRetrieveResponse(BaseModel): identifier: str """Unique identifier for this resource in llama stack""" - metadata: Dict[str, Union[bool, float, str, List[object], object, None]] - """Any additional metadata for this model""" - - api_model_type: Literal["llm", "embedding", "rerank"] = FieldInfo(alias="model_type") - """The type of model (LLM or embedding model)""" - provider_id: str """ID of the provider that owns this resource""" - type: Literal["model"] - """The resource type, always 'model' for model resources""" + metadata: Optional[Dict[str, object]] = None + """Any additional metadata for this model""" + + api_model_type: Optional[Literal["llm", "embedding", "rerank"]] = FieldInfo(alias="model_type", default=None) + """Enumeration of supported model types in Llama Stack.""" provider_resource_id: Optional[str] = None """Unique identifier for this resource in the provider""" + + type: Optional[Literal["model"]] = None diff --git a/src/llama_stack_client/types/moderation_create_params.py b/src/llama_stack_client/types/moderation_create_params.py index ed27fe37..1e111748 100644 --- a/src/llama_stack_client/types/moderation_create_params.py +++ b/src/llama_stack_client/types/moderation_create_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional from typing_extensions import Required, TypedDict from .._types import SequenceNotStr @@ -18,11 +18,5 @@ class ModerationCreateParams(TypedDict, total=False): input: Required[Union[str, SequenceNotStr[str]]] - """Input (or inputs) to classify. - Can be a single string, an array of strings, or an array of multi-modal input - objects similar to other models. - """ - - model: str - """(Optional) The content moderation model you would like to use.""" + model: Optional[str] diff --git a/src/llama_stack_client/types/prompt.py b/src/llama_stack_client/types/prompt.py index f88c74ad..f3820f6a 100644 --- a/src/llama_stack_client/types/prompt.py +++ b/src/llama_stack_client/types/prompt.py @@ -8,20 +8,17 @@ class Prompt(BaseModel): - is_default: bool - """Boolean indicating whether this version is the default version for this prompt""" - prompt_id: str - """Unique identifier formatted as 'pmpt\\__<48-digit-hash>'""" - - variables: List[str] - """List of prompt variable names that can be used in the prompt template""" + """Unique identifier in format 'pmpt\\__<48-digit-hash>'""" version: int """Version (integer starting at 1, incremented on save)""" + is_default: Optional[bool] = None + """Boolean indicating whether this version is the default version""" + prompt: Optional[str] = None - """The system prompt text with variable placeholders. + """The system prompt with variable placeholders""" - Variables are only supported when using the Responses API. - """ + variables: Optional[List[str]] = None + """List of variable names that can be used in the prompt template""" diff --git a/src/llama_stack_client/types/prompt_create_params.py b/src/llama_stack_client/types/prompt_create_params.py index a1c2b411..0729a56b 100644 --- a/src/llama_stack_client/types/prompt_create_params.py +++ b/src/llama_stack_client/types/prompt_create_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Required, TypedDict from .._types import SequenceNotStr @@ -11,7 +12,5 @@ class PromptCreateParams(TypedDict, total=False): prompt: Required[str] - """The prompt text content with variable placeholders.""" - variables: SequenceNotStr[str] - """List of variable names that can be used in the prompt template.""" + variables: Optional[SequenceNotStr[str]] diff --git a/src/llama_stack_client/types/prompt_retrieve_params.py b/src/llama_stack_client/types/prompt_retrieve_params.py index 71674dd2..0beb2ea2 100644 --- a/src/llama_stack_client/types/prompt_retrieve_params.py +++ b/src/llama_stack_client/types/prompt_retrieve_params.py @@ -2,11 +2,11 @@ from __future__ import annotations +from typing import Optional from typing_extensions import TypedDict __all__ = ["PromptRetrieveParams"] class PromptRetrieveParams(TypedDict, total=False): - version: int - """The version of the prompt to get (defaults to latest).""" + version: Optional[int] diff --git a/src/llama_stack_client/types/prompt_set_default_version_params.py b/src/llama_stack_client/types/prompt_set_default_version_params.py index 6b5c6130..4ce6aae7 100644 --- a/src/llama_stack_client/types/prompt_set_default_version_params.py +++ b/src/llama_stack_client/types/prompt_set_default_version_params.py @@ -9,4 +9,3 @@ class PromptSetDefaultVersionParams(TypedDict, total=False): version: Required[int] - """The version to set as default.""" diff --git a/src/llama_stack_client/types/prompt_update_params.py b/src/llama_stack_client/types/prompt_update_params.py index 9753a07a..ee827fa5 100644 --- a/src/llama_stack_client/types/prompt_update_params.py +++ b/src/llama_stack_client/types/prompt_update_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Required, TypedDict from .._types import SequenceNotStr @@ -11,13 +12,9 @@ class PromptUpdateParams(TypedDict, total=False): prompt: Required[str] - """The updated prompt text content.""" - - set_as_default: Required[bool] - """Set the new version as the default (default=True).""" version: Required[int] - """The current version of the prompt being updated.""" - variables: SequenceNotStr[str] - """Updated list of variable names that can be used in the prompt template.""" + set_as_default: bool + + variables: Optional[SequenceNotStr[str]] diff --git a/src/llama_stack_client/types/provider_info.py b/src/llama_stack_client/types/provider_info.py index 9e95d211..ad46c6f9 100644 --- a/src/llama_stack_client/types/provider_info.py +++ b/src/llama_stack_client/types/provider_info.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union +from typing import Dict from .._models import BaseModel @@ -15,16 +15,11 @@ class ProviderInfo(BaseModel): api: str - """The API name this provider implements""" - config: Dict[str, Union[bool, float, str, List[object], object, None]] - """Configuration parameters for the provider""" + config: Dict[str, object] - health: Dict[str, Union[bool, float, str, List[object], object, None]] - """Current health status of the provider""" + health: Dict[str, object] provider_id: str - """Unique identifier for the provider""" provider_type: str - """The type of provider implementation""" diff --git a/src/llama_stack_client/types/query_chunks_response.py b/src/llama_stack_client/types/query_chunks_response.py index cb0181a2..f676c291 100644 --- a/src/llama_stack_client/types/query_chunks_response.py +++ b/src/llama_stack_client/types/query_chunks_response.py @@ -7,79 +7,138 @@ # 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 .._utils import PropertyInfo from .._models import BaseModel -from .shared.interleaved_content import InterleavedContent -__all__ = ["QueryChunksResponse", "Chunk", "ChunkChunkMetadata"] +__all__ = [ + "QueryChunksResponse", + "Chunk", + "ChunkContent", + "ChunkContentImageContentItemOutput", + "ChunkContentImageContentItemOutputImage", + "ChunkContentImageContentItemOutputImageURL", + "ChunkContentTextContentItem", + "ChunkContentListImageContentItemOutputTextContentItem", + "ChunkContentListImageContentItemOutputTextContentItemImageContentItemOutput", + "ChunkContentListImageContentItemOutputTextContentItemImageContentItemOutputImage", + "ChunkContentListImageContentItemOutputTextContentItemImageContentItemOutputImageURL", + "ChunkContentListImageContentItemOutputTextContentItemTextContentItem", + "ChunkChunkMetadata", +] + + +class ChunkContentImageContentItemOutputImageURL(BaseModel): + uri: str + + +class ChunkContentImageContentItemOutputImage(BaseModel): + data: Optional[str] = None + + url: Optional[ChunkContentImageContentItemOutputImageURL] = None + """A URL reference to external content.""" + + +class ChunkContentImageContentItemOutput(BaseModel): + image: ChunkContentImageContentItemOutputImage + """A URL or a base64 encoded string""" + + type: Optional[Literal["image"]] = None + + +class ChunkContentTextContentItem(BaseModel): + text: str + + type: Optional[Literal["text"]] = None + + +class ChunkContentListImageContentItemOutputTextContentItemImageContentItemOutputImageURL(BaseModel): + uri: str + + +class ChunkContentListImageContentItemOutputTextContentItemImageContentItemOutputImage(BaseModel): + data: Optional[str] = None + + url: Optional[ChunkContentListImageContentItemOutputTextContentItemImageContentItemOutputImageURL] = None + """A URL reference to external content.""" + + +class ChunkContentListImageContentItemOutputTextContentItemImageContentItemOutput(BaseModel): + image: ChunkContentListImageContentItemOutputTextContentItemImageContentItemOutputImage + """A URL or a base64 encoded string""" + + type: Optional[Literal["image"]] = None + + +class ChunkContentListImageContentItemOutputTextContentItemTextContentItem(BaseModel): + text: str + + type: Optional[Literal["text"]] = None + + +ChunkContentListImageContentItemOutputTextContentItem: TypeAlias = Annotated[ + Union[ + ChunkContentListImageContentItemOutputTextContentItemImageContentItemOutput, + ChunkContentListImageContentItemOutputTextContentItemTextContentItem, + ], + PropertyInfo(discriminator="type"), +] + +ChunkContent: TypeAlias = Union[ + str, + ChunkContentImageContentItemOutput, + ChunkContentTextContentItem, + List[ChunkContentListImageContentItemOutputTextContentItem], +] class ChunkChunkMetadata(BaseModel): chunk_embedding_dimension: Optional[int] = None - """The dimension of the embedding vector for the chunk.""" chunk_embedding_model: Optional[str] = None - """The embedding model used to create the chunk's embedding.""" chunk_id: Optional[str] = None - """The ID of the chunk. - - If not set, it will be generated based on the document ID and content. - """ chunk_tokenizer: Optional[str] = None - """The tokenizer used to create the chunk. Default is Tiktoken.""" chunk_window: Optional[str] = None - """The window of the chunk, which can be used to group related chunks together.""" content_token_count: Optional[int] = None - """The number of tokens in the content of the chunk.""" created_timestamp: Optional[int] = None - """An optional timestamp indicating when the chunk was created.""" document_id: Optional[str] = None - """The ID of the document this chunk belongs to.""" metadata_token_count: Optional[int] = None - """The number of tokens in the metadata of the chunk.""" source: Optional[str] = None - """The source of the content, such as a URL, file path, or other identifier.""" updated_timestamp: Optional[int] = None - """An optional timestamp indicating when the chunk was last updated.""" class Chunk(BaseModel): chunk_id: str - """Unique identifier for the chunk. Must be provided explicitly.""" - content: InterleavedContent - """ - The content of the chunk, which can be interleaved text, images, or other types. - """ - - metadata: Dict[str, Union[bool, float, str, List[object], object, None]] - """ - Metadata associated with the chunk that will be used in the model context during - inference. - """ + content: ChunkContent + """A image content item""" chunk_metadata: Optional[ChunkChunkMetadata] = None - """Metadata for the chunk that will NOT be used in the context during inference. - - The `chunk_metadata` is required backend functionality. + """ + `ChunkMetadata` is backend metadata for a `Chunk` that is used to store + additional information about the chunk that will not be used in the context + during inference, but is required for backend functionality. The `ChunkMetadata` + is set during chunk creation in `MemoryToolRuntimeImpl().insert()`and is not + expected to change after. Use `Chunk.metadata` for metadata that will be used in + the context during inference. """ embedding: Optional[List[float]] = None - """Optional embedding for the chunk. If not provided, it will be computed later.""" + + metadata: Optional[Dict[str, object]] = None class QueryChunksResponse(BaseModel): chunks: List[Chunk] - """List of content chunks returned from the query""" scores: List[float] - """Relevance scores corresponding to each returned chunk""" diff --git a/src/llama_stack_client/types/response_create_params.py b/src/llama_stack_client/types/response_create_params.py index e6f90efc..ef8ed6fe 100644 --- a/src/llama_stack_client/types/response_create_params.py +++ b/src/llama_stack_client/types/response_create_params.py @@ -8,37 +8,37 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .._types import SequenceNotStr __all__ = [ "ResponseCreateParamsBase", - "InputUnionMember1", - "InputUnionMember1OpenAIResponseMessage", - "InputUnionMember1OpenAIResponseMessageContentUnionMember1", - "InputUnionMember1OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "InputUnionMember1OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "InputUnionMember1OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "InputUnionMember1OpenAIResponseMessageContentUnionMember2", - "InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", - "InputUnionMember1OpenAIResponseOutputMessageWebSearchToolCall", - "InputUnionMember1OpenAIResponseOutputMessageFileSearchToolCall", - "InputUnionMember1OpenAIResponseOutputMessageFileSearchToolCallResult", - "InputUnionMember1OpenAIResponseOutputMessageFunctionToolCall", - "InputUnionMember1OpenAIResponseOutputMessageMcpCall", - "InputUnionMember1OpenAIResponseOutputMessageMcpListTools", - "InputUnionMember1OpenAIResponseOutputMessageMcpListToolsTool", - "InputUnionMember1OpenAIResponseMcpApprovalRequest", - "InputUnionMember1OpenAIResponseInputFunctionToolCallOutput", - "InputUnionMember1OpenAIResponseMcpApprovalResponse", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutput", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInput", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageWebSearchToolCall", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageFileSearchToolCall", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageFileSearchToolCallResult", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageFunctionToolCall", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageMcpCall", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageMcpListTools", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageMcpListToolsTool", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMcpApprovalRequest", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseInputFunctionToolCallOutput", + "InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMcpApprovalResponse", "Prompt", "PromptVariables", "PromptVariablesOpenAIResponseInputMessageContentText", @@ -52,150 +52,113 @@ "ToolOpenAIResponseInputToolFileSearchRankingOptions", "ToolOpenAIResponseInputToolFunction", "ToolOpenAIResponseInputToolMcp", - "ToolOpenAIResponseInputToolMcpRequireApproval", - "ToolOpenAIResponseInputToolMcpRequireApprovalApprovalFilter", "ToolOpenAIResponseInputToolMcpAllowedTools", "ToolOpenAIResponseInputToolMcpAllowedToolsAllowedToolsFilter", + "ToolOpenAIResponseInputToolMcpRequireApproval", + "ToolOpenAIResponseInputToolMcpRequireApprovalApprovalFilter", "ResponseCreateParamsNonStreaming", "ResponseCreateParamsStreaming", ] class ResponseCreateParamsBase(TypedDict, total=False): - input: Required[Union[str, Iterable[InputUnionMember1]]] - """Input message(s) to create the response.""" + input: Required[Union[str, Iterable[InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutput]]] model: Required[str] - """The underlying LLM used for completions.""" - conversation: str - """(Optional) The ID of a conversation to add the response to. + conversation: Optional[str] - Must begin with 'conv\\__'. Input and output messages will be automatically added - to the conversation. - """ + include: Optional[SequenceNotStr[str]] - include: SequenceNotStr[str] - """(Optional) Additional fields to include in the response.""" + instructions: Optional[str] - instructions: str + max_infer_iters: Optional[int] - max_infer_iters: int + max_tool_calls: Optional[int] - max_tool_calls: int - """ - (Optional) Max number of total calls to built-in tools that can be processed in - a response. - """ + previous_response_id: Optional[str] - previous_response_id: str - """ - (Optional) if specified, the new response will be a continuation of the previous - response. This can be used to easily fork-off new responses from existing - responses. - """ + prompt: Optional[Prompt] + """OpenAI compatible Prompt object that is used in OpenAI responses.""" - prompt: Prompt - """(Optional) Prompt object with ID, version, and variables.""" + store: Optional[bool] - store: bool + temperature: Optional[float] - temperature: float - - text: Text + text: Optional[Text] """Text response configuration for OpenAI responses.""" - tools: Iterable[Tool] + tools: Optional[Iterable[Tool]] -class InputUnionMember1OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText( +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( TypedDict, total=False ): text: Required[str] - """The text content of the input message""" - type: Required[Literal["input_text"]] - """Content type identifier, always "input_text" """ + type: Literal["input_text"] -class InputUnionMember1OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage( +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( TypedDict, total=False ): - detail: Required[Literal["low", "high", "auto"]] - """Level of detail for image processing, can be "low", "high", or "auto" """ + detail: Literal["low", "high", "auto"] - type: Required[Literal["input_image"]] - """Content type identifier, always "input_image" """ + file_id: Optional[str] - file_id: str - """(Optional) The ID of the file to be sent to the model.""" + image_url: Optional[str] - image_url: str - """(Optional) URL of the image content""" + type: Literal["input_image"] -class InputUnionMember1OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile( +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( TypedDict, total=False ): - type: Required[Literal["input_file"]] - """The type of the input item. Always `input_file`.""" + file_data: Optional[str] - file_data: str - """The data of the file to be sent to the model.""" + file_id: Optional[str] - file_id: str - """(Optional) The ID of the file to be sent to the model.""" + file_url: Optional[str] - file_url: str - """The URL of the file to be sent to the model.""" + filename: Optional[str] - filename: str - """The name of the file to be sent to the model.""" + type: Literal["input_file"] -InputUnionMember1OpenAIResponseMessageContentUnionMember1: TypeAlias = Union[ - InputUnionMember1OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - InputUnionMember1OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - InputUnionMember1OpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, +InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Union[ + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ] -class InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( TypedDict, total=False ): file_id: Required[str] - """Unique identifier of the referenced file""" filename: Required[str] - """Name of the referenced file""" index: Required[int] - """Position index of the citation within the content""" - type: Required[Literal["file_citation"]] - """Annotation type identifier, always "file_citation" """ + type: Literal["file_citation"] -class InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( TypedDict, total=False ): end_index: Required[int] - """End position of the citation span in the content""" start_index: Required[int] - """Start position of the citation span in the content""" title: Required[str] - """Title of the referenced web resource""" - - type: Required[Literal["url_citation"]] - """Annotation type identifier, always "url_citation" """ url: Required[str] - """URL of the referenced web resource""" + type: Literal["url_citation"] -class InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( + +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( TypedDict, total=False ): container_id: Required[str] @@ -208,187 +171,182 @@ class InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOut start_index: Required[int] - type: Required[Literal["container_file_citation"]] + type: Literal["container_file_citation"] -class InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( TypedDict, total=False ): file_id: Required[str] index: Required[int] - type: Required[Literal["file_path"]] + type: Literal["file_path"] -InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Union[ - InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, +InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Union[ + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ] -class InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText( +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( TypedDict, total=False ): - annotations: Required[ - Iterable[ - InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation - ] - ] - text: Required[str] - type: Required[Literal["output_text"]] + annotations: Iterable[ + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + + type: Literal["output_text"] -class InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal(TypedDict, total=False): +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( + TypedDict, total=False +): refusal: Required[str] - """Refusal text supplied by the model""" - type: Required[Literal["refusal"]] - """Content part type identifier, always "refusal" """ + type: Literal["refusal"] -InputUnionMember1OpenAIResponseMessageContentUnionMember2: TypeAlias = Union[ - InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - InputUnionMember1OpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, +InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Union[ + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ] -class InputUnionMember1OpenAIResponseMessage(TypedDict, total=False): +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInput( + TypedDict, total=False +): content: Required[ Union[ str, - Iterable[InputUnionMember1OpenAIResponseMessageContentUnionMember1], - Iterable[InputUnionMember1OpenAIResponseMessageContentUnionMember2], + Iterable[ + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + Iterable[ + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal + ], ] ] role: Required[Literal["system", "developer", "user", "assistant"]] - type: Required[Literal["message"]] + id: Optional[str] - id: str + status: Optional[str] - status: str + type: Literal["message"] -class InputUnionMember1OpenAIResponseOutputMessageWebSearchToolCall(TypedDict, total=False): +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageWebSearchToolCall( + TypedDict, total=False +): id: Required[str] - """Unique identifier for this tool call""" status: Required[str] - """Current status of the web search operation""" - type: Required[Literal["web_search_call"]] - """Tool call type identifier, always "web_search_call" """ + type: Literal["web_search_call"] -class InputUnionMember1OpenAIResponseOutputMessageFileSearchToolCallResult(TypedDict, total=False): - attributes: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """(Optional) Key-value attributes associated with the file""" +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageFileSearchToolCallResult( + TypedDict, total=False +): + attributes: Required[Dict[str, object]] file_id: Required[str] - """Unique identifier of the file containing the result""" filename: Required[str] - """Name of the file containing the result""" score: Required[float] - """Relevance score for this search result (between 0 and 1)""" text: Required[str] - """Text content of the search result""" -class InputUnionMember1OpenAIResponseOutputMessageFileSearchToolCall(TypedDict, total=False): +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageFileSearchToolCall( + TypedDict, total=False +): id: Required[str] - """Unique identifier for this tool call""" queries: Required[SequenceNotStr[str]] - """List of search queries executed""" status: Required[str] - """Current status of the file search operation""" - type: Required[Literal["file_search_call"]] - """Tool call type identifier, always "file_search_call" """ + results: Optional[ + Iterable[ + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageFileSearchToolCallResult + ] + ] - results: Iterable[InputUnionMember1OpenAIResponseOutputMessageFileSearchToolCallResult] - """(Optional) Search results returned by the file search operation""" + type: Literal["file_search_call"] -class InputUnionMember1OpenAIResponseOutputMessageFunctionToolCall(TypedDict, total=False): +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageFunctionToolCall( + TypedDict, total=False +): arguments: Required[str] - """JSON string containing the function arguments""" call_id: Required[str] - """Unique identifier for the function call""" name: Required[str] - """Name of the function being called""" - type: Required[Literal["function_call"]] - """Tool call type identifier, always "function_call" """ + id: Optional[str] - id: str - """(Optional) Additional identifier for the tool call""" + status: Optional[str] - status: str - """(Optional) Current status of the function call execution""" + type: Literal["function_call"] -class InputUnionMember1OpenAIResponseOutputMessageMcpCall(TypedDict, total=False): +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageMcpCall( + TypedDict, total=False +): id: Required[str] - """Unique identifier for this MCP call""" arguments: Required[str] - """JSON string containing the MCP call arguments""" name: Required[str] - """Name of the MCP method being called""" server_label: Required[str] - """Label identifying the MCP server handling the call""" - type: Required[Literal["mcp_call"]] - """Tool call type identifier, always "mcp_call" """ + error: Optional[str] - error: str - """(Optional) Error message if the MCP call failed""" + output: Optional[str] - output: str - """(Optional) Output result from the successful MCP call""" + type: Literal["mcp_call"] -class InputUnionMember1OpenAIResponseOutputMessageMcpListToolsTool(TypedDict, total=False): - input_schema: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """JSON schema defining the tool's input parameters""" +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageMcpListToolsTool( + TypedDict, total=False +): + input_schema: Required[Dict[str, object]] name: Required[str] - """Name of the tool""" - description: str - """(Optional) Description of what the tool does""" + description: Optional[str] -class InputUnionMember1OpenAIResponseOutputMessageMcpListTools(TypedDict, total=False): +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageMcpListTools( + TypedDict, total=False +): id: Required[str] - """Unique identifier for this MCP list tools operation""" server_label: Required[str] - """Label identifying the MCP server providing the tools""" - tools: Required[Iterable[InputUnionMember1OpenAIResponseOutputMessageMcpListToolsTool]] - """List of available tools provided by the MCP server""" + tools: Required[ + Iterable[ + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageMcpListToolsTool + ] + ] - type: Required[Literal["mcp_list_tools"]] - """Tool call type identifier, always "mcp_list_tools" """ + type: Literal["mcp_list_tools"] -class InputUnionMember1OpenAIResponseMcpApprovalRequest(TypedDict, total=False): +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMcpApprovalRequest( + TypedDict, total=False +): id: Required[str] arguments: Required[str] @@ -397,84 +355,77 @@ class InputUnionMember1OpenAIResponseMcpApprovalRequest(TypedDict, total=False): server_label: Required[str] - type: Required[Literal["mcp_approval_request"]] + type: Literal["mcp_approval_request"] -class InputUnionMember1OpenAIResponseInputFunctionToolCallOutput(TypedDict, total=False): +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseInputFunctionToolCallOutput( + TypedDict, total=False +): call_id: Required[str] output: Required[str] - type: Required[Literal["function_call_output"]] + id: Optional[str] - id: str + status: Optional[str] - status: str + type: Literal["function_call_output"] -class InputUnionMember1OpenAIResponseMcpApprovalResponse(TypedDict, total=False): +class InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMcpApprovalResponse( + TypedDict, total=False +): approval_request_id: Required[str] approve: Required[bool] - type: Required[Literal["mcp_approval_response"]] + id: Optional[str] - id: str + reason: Optional[str] - reason: str + type: Literal["mcp_approval_response"] -InputUnionMember1: TypeAlias = Union[ - InputUnionMember1OpenAIResponseMessage, - InputUnionMember1OpenAIResponseOutputMessageWebSearchToolCall, - InputUnionMember1OpenAIResponseOutputMessageFileSearchToolCall, - InputUnionMember1OpenAIResponseOutputMessageFunctionToolCall, - InputUnionMember1OpenAIResponseOutputMessageMcpCall, - InputUnionMember1OpenAIResponseOutputMessageMcpListTools, - InputUnionMember1OpenAIResponseMcpApprovalRequest, - InputUnionMember1OpenAIResponseInputFunctionToolCallOutput, - InputUnionMember1OpenAIResponseMcpApprovalResponse, - InputUnionMember1OpenAIResponseMessage, +InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutput: TypeAlias = Union[ + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInput, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageWebSearchToolCall, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageFileSearchToolCall, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageFunctionToolCall, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageMcpCall, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseOutputMessageMcpListTools, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMcpApprovalRequest, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseInputFunctionToolCallOutput, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMcpApprovalResponse, + InputListOpenAIResponseMessageUnionOpenAIResponseInputFunctionToolCallOutputOpenAIResponseMessageInput, ] class PromptVariablesOpenAIResponseInputMessageContentText(TypedDict, total=False): text: Required[str] - """The text content of the input message""" - type: Required[Literal["input_text"]] - """Content type identifier, always "input_text" """ + type: Literal["input_text"] class PromptVariablesOpenAIResponseInputMessageContentImage(TypedDict, total=False): - detail: Required[Literal["low", "high", "auto"]] - """Level of detail for image processing, can be "low", "high", or "auto" """ + detail: Literal["low", "high", "auto"] - type: Required[Literal["input_image"]] - """Content type identifier, always "input_image" """ + file_id: Optional[str] - file_id: str - """(Optional) The ID of the file to be sent to the model.""" + image_url: Optional[str] - image_url: str - """(Optional) URL of the image content""" + type: Literal["input_image"] class PromptVariablesOpenAIResponseInputMessageContentFile(TypedDict, total=False): - type: Required[Literal["input_file"]] - """The type of the input item. Always `input_file`.""" + file_data: Optional[str] - file_data: str - """The data of the file to be sent to the model.""" + file_id: Optional[str] - file_id: str - """(Optional) The ID of the file to be sent to the model.""" + file_url: Optional[str] - file_url: str - """The URL of the file to be sent to the model.""" + filename: Optional[str] - filename: str - """The name of the file to be sent to the model.""" + type: Literal["input_file"] PromptVariables: TypeAlias = Union[ @@ -486,143 +437,102 @@ class PromptVariablesOpenAIResponseInputMessageContentFile(TypedDict, total=Fals class Prompt(TypedDict, total=False): id: Required[str] - """Unique identifier of the prompt template""" - variables: Dict[str, PromptVariables] - """ - Dictionary of variable names to OpenAIResponseInputMessageContent structure for - template substitution. The substitution values can either be strings, or other - Response input types like images or files. - """ + variables: Optional[Dict[str, PromptVariables]] - version: str - """Version number of the prompt to use (defaults to latest if not specified)""" + version: Optional[str] class TextFormat(TypedDict, total=False): - type: Required[Literal["text", "json_schema", "json_object"]] - """Must be "text", "json_schema", or "json_object" to identify the format type""" - - description: str - """(Optional) A description of the response format. Only used for json_schema.""" + description: Optional[str] - name: str - """The name of the response format. Only used for json_schema.""" + name: Optional[str] - schema: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """The JSON schema the response should conform to. + schema: Optional[Dict[str, object]] - In a Python SDK, this is often a `pydantic` model. Only used for json_schema. - """ + strict: Optional[bool] - strict: bool - """(Optional) Whether to strictly enforce the JSON schema. - - If true, the response must match the schema exactly. Only used for json_schema. - """ + type: Literal["text", "json_schema", "json_object"] class Text(TypedDict, total=False): - format: TextFormat - """(Optional) Text format configuration specifying output format requirements""" + format: Optional[TextFormat] + """Configuration for Responses API text format.""" class ToolOpenAIResponseInputToolWebSearch(TypedDict, total=False): - type: Required[ - Literal["web_search", "web_search_preview", "web_search_preview_2025_03_11", "web_search_2025_08_26"] - ] - """Web search tool type variant to use""" + search_context_size: Optional[str] - search_context_size: str - """(Optional) Size of search context, must be "low", "medium", or "high" """ + type: Literal["web_search", "web_search_preview", "web_search_preview_2025_03_11", "web_search_2025_08_26"] class ToolOpenAIResponseInputToolFileSearchRankingOptions(TypedDict, total=False): - ranker: str - """(Optional) Name of the ranking algorithm to use""" + ranker: Optional[str] - score_threshold: float - """(Optional) Minimum relevance score threshold for results""" + score_threshold: Optional[float] class ToolOpenAIResponseInputToolFileSearch(TypedDict, total=False): - type: Required[Literal["file_search"]] - """Tool type identifier, always "file_search" """ - vector_store_ids: Required[SequenceNotStr[str]] - """List of vector store identifiers to search within""" - filters: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) Additional filters to apply to the search""" + filters: Optional[Dict[str, object]] + + max_num_results: Optional[int] - max_num_results: int - """(Optional) Maximum number of search results to return (1-50)""" + ranking_options: Optional[ToolOpenAIResponseInputToolFileSearchRankingOptions] + """Options for ranking and filtering search results.""" - ranking_options: ToolOpenAIResponseInputToolFileSearchRankingOptions - """(Optional) Options for ranking and scoring search results""" + type: Literal["file_search"] class ToolOpenAIResponseInputToolFunction(TypedDict, total=False): name: Required[str] - """Name of the function that can be called""" - type: Required[Literal["function"]] - """Tool type identifier, always "function" """ + parameters: Required[Optional[Dict[str, object]]] - description: str - """(Optional) Description of what the function does""" + description: Optional[str] - parameters: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) JSON schema defining the function's parameters""" + strict: Optional[bool] - strict: bool - """(Optional) Whether to enforce strict parameter validation""" + type: Literal["function"] -class ToolOpenAIResponseInputToolMcpRequireApprovalApprovalFilter(TypedDict, total=False): - always: SequenceNotStr[str] - """(Optional) List of tool names that always require approval""" - - never: SequenceNotStr[str] - """(Optional) List of tool names that never require approval""" +class ToolOpenAIResponseInputToolMcpAllowedToolsAllowedToolsFilter(TypedDict, total=False): + tool_names: Optional[SequenceNotStr[str]] -ToolOpenAIResponseInputToolMcpRequireApproval: TypeAlias = Union[ - Literal["always", "never"], ToolOpenAIResponseInputToolMcpRequireApprovalApprovalFilter +ToolOpenAIResponseInputToolMcpAllowedTools: TypeAlias = Union[ + SequenceNotStr[str], ToolOpenAIResponseInputToolMcpAllowedToolsAllowedToolsFilter ] -class ToolOpenAIResponseInputToolMcpAllowedToolsAllowedToolsFilter(TypedDict, total=False): - tool_names: SequenceNotStr[str] - """(Optional) List of specific tool names that are allowed""" +class ToolOpenAIResponseInputToolMcpRequireApprovalApprovalFilter(TypedDict, total=False): + always: Optional[SequenceNotStr[str]] + never: Optional[SequenceNotStr[str]] -ToolOpenAIResponseInputToolMcpAllowedTools: TypeAlias = Union[ - SequenceNotStr[str], ToolOpenAIResponseInputToolMcpAllowedToolsAllowedToolsFilter + +ToolOpenAIResponseInputToolMcpRequireApproval: TypeAlias = Union[ + Literal["always", "never"], ToolOpenAIResponseInputToolMcpRequireApprovalApprovalFilter ] class ToolOpenAIResponseInputToolMcp(TypedDict, total=False): - require_approval: Required[ToolOpenAIResponseInputToolMcpRequireApproval] - """Approval requirement for tool calls ("always", "never", or filter)""" - server_label: Required[str] - """Label to identify this MCP server""" server_url: Required[str] - """URL endpoint of the MCP server""" - type: Required[Literal["mcp"]] - """Tool type identifier, always "mcp" """ + allowed_tools: Optional[ToolOpenAIResponseInputToolMcpAllowedTools] + """Filter configuration for restricting which MCP tools can be used.""" + + authorization: Optional[str] - allowed_tools: ToolOpenAIResponseInputToolMcpAllowedTools - """(Optional) Restriction on which tools can be used from this server""" + headers: Optional[Dict[str, object]] - authorization: str - """(Optional) OAuth access token for authenticating with the MCP server""" + require_approval: ToolOpenAIResponseInputToolMcpRequireApproval + """Filter configuration for MCP tool approval requirements.""" - headers: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) HTTP headers to include when connecting to the server""" + type: Literal["mcp"] Tool: TypeAlias = Union[ @@ -634,7 +544,7 @@ class ToolOpenAIResponseInputToolMcp(TypedDict, total=False): class ResponseCreateParamsNonStreaming(ResponseCreateParamsBase, total=False): - stream: Literal[False] + stream: Optional[Literal[False]] class ResponseCreateParamsStreaming(ResponseCreateParamsBase): diff --git a/src/llama_stack_client/types/response_delete_response.py b/src/llama_stack_client/types/response_delete_response.py index ce229452..75515977 100644 --- a/src/llama_stack_client/types/response_delete_response.py +++ b/src/llama_stack_client/types/response_delete_response.py @@ -6,6 +6,7 @@ # 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 @@ -15,10 +16,7 @@ class ResponseDeleteResponse(BaseModel): id: str - """Unique identifier of the deleted response""" - deleted: bool - """Deletion confirmation flag, always True""" + deleted: Optional[bool] = None - object: Literal["response"] - """Object type identifier, always "response" """ + object: Optional[Literal["response"]] = None diff --git a/src/llama_stack_client/types/response_list_params.py b/src/llama_stack_client/types/response_list_params.py index 5de4106e..ee25b8de 100644 --- a/src/llama_stack_client/types/response_list_params.py +++ b/src/llama_stack_client/types/response_list_params.py @@ -8,20 +8,18 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Literal, TypedDict __all__ = ["ResponseListParams"] class ResponseListParams(TypedDict, total=False): - after: str - """The ID of the last response to return.""" + after: Optional[str] - limit: int - """The number of responses to return.""" + limit: Optional[int] - model: str - """The model to filter responses by.""" + model: Optional[str] - order: Literal["asc", "desc"] - """The order to sort responses by when sorted by created_at ('asc' or 'desc').""" + order: Optional[Literal["asc", "desc"]] + """Sort order for paginated responses.""" diff --git a/src/llama_stack_client/types/response_list_response.py b/src/llama_stack_client/types/response_list_response.py index 7ba4e1ed..13317264 100644 --- a/src/llama_stack_client/types/response_list_response.py +++ b/src/llama_stack_client/types/response_list_response.py @@ -17,19 +17,19 @@ __all__ = [ "ResponseListResponse", "Input", - "InputOpenAIResponseMessage", - "InputOpenAIResponseMessageContentUnionMember1", - "InputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "InputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "InputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "InputOpenAIResponseMessageContentUnionMember2", - "InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "InputOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", + "InputOpenAIResponseMessageOutput", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", "InputOpenAIResponseOutputMessageWebSearchToolCall", "InputOpenAIResponseOutputMessageFileSearchToolCall", "InputOpenAIResponseOutputMessageFileSearchToolCallResult", @@ -41,19 +41,19 @@ "InputOpenAIResponseInputFunctionToolCallOutput", "InputOpenAIResponseMcpApprovalResponse", "Output", - "OutputOpenAIResponseMessage", - "OutputOpenAIResponseMessageContentUnionMember1", - "OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "OutputOpenAIResponseMessageContentUnionMember2", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", + "OutputOpenAIResponseMessageOutput", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", "OutputOpenAIResponseOutputMessageWebSearchToolCall", "OutputOpenAIResponseOutputMessageFileSearchToolCall", "OutputOpenAIResponseOutputMessageFileSearchToolCallResult", @@ -62,14 +62,14 @@ "OutputOpenAIResponseOutputMessageMcpListTools", "OutputOpenAIResponseOutputMessageMcpListToolsTool", "OutputOpenAIResponseMcpApprovalRequest", - "Text", - "TextFormat", "Error", "Prompt", "PromptVariables", "PromptVariablesOpenAIResponseInputMessageContentText", "PromptVariablesOpenAIResponseInputMessageContentImage", "PromptVariablesOpenAIResponseInputMessageContentFile", + "Text", + "TextFormat", "Tool", "ToolOpenAIResponseInputToolWebSearch", "ToolOpenAIResponseInputToolFileSearch", @@ -84,91 +84,77 @@ ] -class InputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText(BaseModel): +class InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( + BaseModel +): text: str - """The text content of the input message""" - - type: Literal["input_text"] - """Content type identifier, always "input_text" """ + type: Optional[Literal["input_text"]] = None -class InputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage(BaseModel): - detail: Literal["low", "high", "auto"] - """Level of detail for image processing, can be "low", "high", or "auto" """ - type: Literal["input_image"] - """Content type identifier, always "input_image" """ +class InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( + BaseModel +): + detail: Optional[Literal["low", "high", "auto"]] = None file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" image_url: Optional[str] = None - """(Optional) URL of the image content""" + type: Optional[Literal["input_image"]] = None -class InputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile(BaseModel): - type: Literal["input_file"] - """The type of the input item. Always `input_file`.""" +class InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( + BaseModel +): file_data: Optional[str] = None - """The data of the file to be sent to the model.""" file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" file_url: Optional[str] = None - """The URL of the file to be sent to the model.""" filename: Optional[str] = None - """The name of the file to be sent to the model.""" + type: Optional[Literal["input_file"]] = None -InputOpenAIResponseMessageContentUnionMember1: TypeAlias = Annotated[ + +InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Annotated[ Union[ - InputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - InputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - InputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, + InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ], PropertyInfo(discriminator="type"), ] -class InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None -class InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( BaseModel ): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + + type: Optional[Literal["url_citation"]] = None -class InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( +class InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( BaseModel ): container_id: str @@ -181,182 +167,159 @@ class InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageCo start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None -class InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( BaseModel ): file_id: str index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None -InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ +InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ Union[ - InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, + InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ], PropertyInfo(discriminator="type"), ] -class InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText(BaseModel): - annotations: List[ - InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation - ] - +class InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( + BaseModel +): text: str - type: Literal["output_text"] + annotations: Optional[ + List[ + InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + ] = None + type: Optional[Literal["output_text"]] = None -class InputOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal(BaseModel): + +class InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( + BaseModel +): refusal: str - """Refusal text supplied by the model""" - type: Literal["refusal"] - """Content part type identifier, always "refusal" """ + type: Optional[Literal["refusal"]] = None -InputOpenAIResponseMessageContentUnionMember2: TypeAlias = Annotated[ +InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Annotated[ Union[ - InputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - InputOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, + InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ], PropertyInfo(discriminator="type"), ] -class InputOpenAIResponseMessage(BaseModel): +class InputOpenAIResponseMessageOutput(BaseModel): content: Union[ - str, List[InputOpenAIResponseMessageContentUnionMember1], List[InputOpenAIResponseMessageContentUnionMember2] + str, + List[ + InputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + List[ + InputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal + ], ] role: Literal["system", "developer", "user", "assistant"] - type: Literal["message"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["message"]] = None + class InputOpenAIResponseOutputMessageWebSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" status: str - """Current status of the web search operation""" - type: Literal["web_search_call"] - """Tool call type identifier, always "web_search_call" """ + type: Optional[Literal["web_search_call"]] = None class InputOpenAIResponseOutputMessageFileSearchToolCallResult(BaseModel): - attributes: Dict[str, Union[bool, float, str, List[object], object, None]] - """(Optional) Key-value attributes associated with the file""" + attributes: Dict[str, object] file_id: str - """Unique identifier of the file containing the result""" filename: str - """Name of the file containing the result""" score: float - """Relevance score for this search result (between 0 and 1)""" text: str - """Text content of the search result""" class InputOpenAIResponseOutputMessageFileSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" queries: List[str] - """List of search queries executed""" status: str - """Current status of the file search operation""" - - type: Literal["file_search_call"] - """Tool call type identifier, always "file_search_call" """ results: Optional[List[InputOpenAIResponseOutputMessageFileSearchToolCallResult]] = None - """(Optional) Search results returned by the file search operation""" + + type: Optional[Literal["file_search_call"]] = None class InputOpenAIResponseOutputMessageFunctionToolCall(BaseModel): arguments: str - """JSON string containing the function arguments""" call_id: str - """Unique identifier for the function call""" name: str - """Name of the function being called""" - - type: Literal["function_call"] - """Tool call type identifier, always "function_call" """ id: Optional[str] = None - """(Optional) Additional identifier for the tool call""" status: Optional[str] = None - """(Optional) Current status of the function call execution""" + + type: Optional[Literal["function_call"]] = None class InputOpenAIResponseOutputMessageMcpCall(BaseModel): id: str - """Unique identifier for this MCP call""" arguments: str - """JSON string containing the MCP call arguments""" name: str - """Name of the MCP method being called""" server_label: str - """Label identifying the MCP server handling the call""" - - type: Literal["mcp_call"] - """Tool call type identifier, always "mcp_call" """ error: Optional[str] = None - """(Optional) Error message if the MCP call failed""" output: Optional[str] = None - """(Optional) Output result from the successful MCP call""" + + type: Optional[Literal["mcp_call"]] = None class InputOpenAIResponseOutputMessageMcpListToolsTool(BaseModel): - input_schema: Dict[str, Union[bool, float, str, List[object], object, None]] - """JSON schema defining the tool's input parameters""" + input_schema: Dict[str, object] name: str - """Name of the tool""" description: Optional[str] = None - """(Optional) Description of what the tool does""" class InputOpenAIResponseOutputMessageMcpListTools(BaseModel): id: str - """Unique identifier for this MCP list tools operation""" server_label: str - """Label identifying the MCP server providing the tools""" tools: List[InputOpenAIResponseOutputMessageMcpListToolsTool] - """List of available tools provided by the MCP server""" - type: Literal["mcp_list_tools"] - """Tool call type identifier, always "mcp_list_tools" """ + type: Optional[Literal["mcp_list_tools"]] = None class InputOpenAIResponseMcpApprovalRequest(BaseModel): @@ -368,7 +331,7 @@ class InputOpenAIResponseMcpApprovalRequest(BaseModel): server_label: str - type: Literal["mcp_approval_request"] + type: Optional[Literal["mcp_approval_request"]] = None class InputOpenAIResponseInputFunctionToolCallOutput(BaseModel): @@ -376,27 +339,27 @@ class InputOpenAIResponseInputFunctionToolCallOutput(BaseModel): output: str - type: Literal["function_call_output"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["function_call_output"]] = None + class InputOpenAIResponseMcpApprovalResponse(BaseModel): approval_request_id: str approve: bool - type: Literal["mcp_approval_response"] - id: Optional[str] = None reason: Optional[str] = None + type: Optional[Literal["mcp_approval_response"]] = None + Input: TypeAlias = Union[ - InputOpenAIResponseMessage, + InputOpenAIResponseMessageOutput, InputOpenAIResponseOutputMessageWebSearchToolCall, InputOpenAIResponseOutputMessageFileSearchToolCall, InputOpenAIResponseOutputMessageFunctionToolCall, @@ -405,95 +368,81 @@ class InputOpenAIResponseMcpApprovalResponse(BaseModel): InputOpenAIResponseMcpApprovalRequest, InputOpenAIResponseInputFunctionToolCallOutput, InputOpenAIResponseMcpApprovalResponse, - InputOpenAIResponseMessage, + InputOpenAIResponseMessageOutput, ] -class OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText(BaseModel): +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( + BaseModel +): text: str - """The text content of the input message""" - - type: Literal["input_text"] - """Content type identifier, always "input_text" """ + type: Optional[Literal["input_text"]] = None -class OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage(BaseModel): - detail: Literal["low", "high", "auto"] - """Level of detail for image processing, can be "low", "high", or "auto" """ - type: Literal["input_image"] - """Content type identifier, always "input_image" """ +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( + BaseModel +): + detail: Optional[Literal["low", "high", "auto"]] = None file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" image_url: Optional[str] = None - """(Optional) URL of the image content""" + type: Optional[Literal["input_image"]] = None -class OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile(BaseModel): - type: Literal["input_file"] - """The type of the input item. Always `input_file`.""" +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( + BaseModel +): file_data: Optional[str] = None - """The data of the file to be sent to the model.""" file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" file_url: Optional[str] = None - """The URL of the file to be sent to the model.""" filename: Optional[str] = None - """The name of the file to be sent to the model.""" + type: Optional[Literal["input_file"]] = None -OutputOpenAIResponseMessageContentUnionMember1: TypeAlias = Annotated[ + +OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Annotated[ Union[ - OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ], PropertyInfo(discriminator="type"), ] -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( BaseModel ): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + type: Optional[Literal["url_citation"]] = None -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( + +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( BaseModel ): container_id: str @@ -506,182 +455,159 @@ class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageC start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( BaseModel ): file_id: str index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None -OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ +OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ Union[ - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ], PropertyInfo(discriminator="type"), ] -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText(BaseModel): - annotations: List[ - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation - ] - +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( + BaseModel +): text: str - type: Literal["output_text"] + annotations: Optional[ + List[ + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + ] = None + type: Optional[Literal["output_text"]] = None -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal(BaseModel): + +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( + BaseModel +): refusal: str - """Refusal text supplied by the model""" - type: Literal["refusal"] - """Content part type identifier, always "refusal" """ + type: Optional[Literal["refusal"]] = None -OutputOpenAIResponseMessageContentUnionMember2: TypeAlias = Annotated[ +OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Annotated[ Union[ - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ], PropertyInfo(discriminator="type"), ] -class OutputOpenAIResponseMessage(BaseModel): +class OutputOpenAIResponseMessageOutput(BaseModel): content: Union[ - str, List[OutputOpenAIResponseMessageContentUnionMember1], List[OutputOpenAIResponseMessageContentUnionMember2] + str, + List[ + OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + List[ + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal + ], ] role: Literal["system", "developer", "user", "assistant"] - type: Literal["message"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["message"]] = None + class OutputOpenAIResponseOutputMessageWebSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" status: str - """Current status of the web search operation""" - type: Literal["web_search_call"] - """Tool call type identifier, always "web_search_call" """ + type: Optional[Literal["web_search_call"]] = None class OutputOpenAIResponseOutputMessageFileSearchToolCallResult(BaseModel): - attributes: Dict[str, Union[bool, float, str, List[object], object, None]] - """(Optional) Key-value attributes associated with the file""" + attributes: Dict[str, object] file_id: str - """Unique identifier of the file containing the result""" filename: str - """Name of the file containing the result""" score: float - """Relevance score for this search result (between 0 and 1)""" text: str - """Text content of the search result""" class OutputOpenAIResponseOutputMessageFileSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" queries: List[str] - """List of search queries executed""" status: str - """Current status of the file search operation""" - - type: Literal["file_search_call"] - """Tool call type identifier, always "file_search_call" """ results: Optional[List[OutputOpenAIResponseOutputMessageFileSearchToolCallResult]] = None - """(Optional) Search results returned by the file search operation""" + + type: Optional[Literal["file_search_call"]] = None class OutputOpenAIResponseOutputMessageFunctionToolCall(BaseModel): arguments: str - """JSON string containing the function arguments""" call_id: str - """Unique identifier for the function call""" name: str - """Name of the function being called""" - - type: Literal["function_call"] - """Tool call type identifier, always "function_call" """ id: Optional[str] = None - """(Optional) Additional identifier for the tool call""" status: Optional[str] = None - """(Optional) Current status of the function call execution""" + + type: Optional[Literal["function_call"]] = None class OutputOpenAIResponseOutputMessageMcpCall(BaseModel): id: str - """Unique identifier for this MCP call""" arguments: str - """JSON string containing the MCP call arguments""" name: str - """Name of the MCP method being called""" server_label: str - """Label identifying the MCP server handling the call""" - - type: Literal["mcp_call"] - """Tool call type identifier, always "mcp_call" """ error: Optional[str] = None - """(Optional) Error message if the MCP call failed""" output: Optional[str] = None - """(Optional) Output result from the successful MCP call""" + + type: Optional[Literal["mcp_call"]] = None class OutputOpenAIResponseOutputMessageMcpListToolsTool(BaseModel): - input_schema: Dict[str, Union[bool, float, str, List[object], object, None]] - """JSON schema defining the tool's input parameters""" + input_schema: Dict[str, object] name: str - """Name of the tool""" description: Optional[str] = None - """(Optional) Description of what the tool does""" class OutputOpenAIResponseOutputMessageMcpListTools(BaseModel): id: str - """Unique identifier for this MCP list tools operation""" server_label: str - """Label identifying the MCP server providing the tools""" tools: List[OutputOpenAIResponseOutputMessageMcpListToolsTool] - """List of available tools provided by the MCP server""" - type: Literal["mcp_list_tools"] - """Tool call type identifier, always "mcp_list_tools" """ + type: Optional[Literal["mcp_list_tools"]] = None class OutputOpenAIResponseMcpApprovalRequest(BaseModel): @@ -693,12 +619,12 @@ class OutputOpenAIResponseMcpApprovalRequest(BaseModel): server_label: str - type: Literal["mcp_approval_request"] + type: Optional[Literal["mcp_approval_request"]] = None Output: TypeAlias = Annotated[ Union[ - OutputOpenAIResponseMessage, + OutputOpenAIResponseMessageOutput, OutputOpenAIResponseOutputMessageWebSearchToolCall, OutputOpenAIResponseOutputMessageFileSearchToolCall, OutputOpenAIResponseOutputMessageFunctionToolCall, @@ -710,81 +636,38 @@ class OutputOpenAIResponseMcpApprovalRequest(BaseModel): ] -class TextFormat(BaseModel): - type: Literal["text", "json_schema", "json_object"] - """Must be "text", "json_schema", or "json_object" to identify the format type""" - - description: Optional[str] = None - """(Optional) A description of the response format. Only used for json_schema.""" - - name: Optional[str] = None - """The name of the response format. Only used for json_schema.""" - - schema_: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = FieldInfo( - alias="schema", default=None - ) - """The JSON schema the response should conform to. - - In a Python SDK, this is often a `pydantic` model. Only used for json_schema. - """ - - strict: Optional[bool] = None - """(Optional) Whether to strictly enforce the JSON schema. - - If true, the response must match the schema exactly. Only used for json_schema. - """ - - -class Text(BaseModel): - format: Optional[TextFormat] = None - """(Optional) Text format configuration specifying output format requirements""" - - class Error(BaseModel): code: str - """Error code identifying the type of failure""" message: str - """Human-readable error message describing the failure""" class PromptVariablesOpenAIResponseInputMessageContentText(BaseModel): text: str - """The text content of the input message""" - type: Literal["input_text"] - """Content type identifier, always "input_text" """ + type: Optional[Literal["input_text"]] = None class PromptVariablesOpenAIResponseInputMessageContentImage(BaseModel): - detail: Literal["low", "high", "auto"] - """Level of detail for image processing, can be "low", "high", or "auto" """ - - type: Literal["input_image"] - """Content type identifier, always "input_image" """ + detail: Optional[Literal["low", "high", "auto"]] = None file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" image_url: Optional[str] = None - """(Optional) URL of the image content""" + type: Optional[Literal["input_image"]] = None -class PromptVariablesOpenAIResponseInputMessageContentFile(BaseModel): - type: Literal["input_file"] - """The type of the input item. Always `input_file`.""" +class PromptVariablesOpenAIResponseInputMessageContentFile(BaseModel): file_data: Optional[str] = None - """The data of the file to be sent to the model.""" file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" file_url: Optional[str] = None - """The URL of the file to be sent to the model.""" filename: Optional[str] = None - """The name of the file to be sent to the model.""" + + type: Optional[Literal["input_file"]] = None PromptVariables: TypeAlias = Annotated[ @@ -799,88 +682,84 @@ class PromptVariablesOpenAIResponseInputMessageContentFile(BaseModel): class Prompt(BaseModel): id: str - """Unique identifier of the prompt template""" variables: Optional[Dict[str, PromptVariables]] = None - """ - Dictionary of variable names to OpenAIResponseInputMessageContent structure for - template substitution. The substitution values can either be strings, or other - Response input types like images or files. - """ version: Optional[str] = None - """Version number of the prompt to use (defaults to latest if not specified)""" -class ToolOpenAIResponseInputToolWebSearch(BaseModel): - type: Literal["web_search", "web_search_preview", "web_search_preview_2025_03_11", "web_search_2025_08_26"] - """Web search tool type variant to use""" +class TextFormat(BaseModel): + description: Optional[str] = None + + name: Optional[str] = None + + schema_: Optional[Dict[str, object]] = FieldInfo(alias="schema", default=None) + + strict: Optional[bool] = None + + type: Optional[Literal["text", "json_schema", "json_object"]] = None + +class Text(BaseModel): + format: Optional[TextFormat] = None + """Configuration for Responses API text format.""" + + +class ToolOpenAIResponseInputToolWebSearch(BaseModel): search_context_size: Optional[str] = None - """(Optional) Size of search context, must be "low", "medium", or "high" """ + + type: Optional[ + Literal["web_search", "web_search_preview", "web_search_preview_2025_03_11", "web_search_2025_08_26"] + ] = None class ToolOpenAIResponseInputToolFileSearchRankingOptions(BaseModel): ranker: Optional[str] = None - """(Optional) Name of the ranking algorithm to use""" score_threshold: Optional[float] = None - """(Optional) Minimum relevance score threshold for results""" class ToolOpenAIResponseInputToolFileSearch(BaseModel): - type: Literal["file_search"] - """Tool type identifier, always "file_search" """ - vector_store_ids: List[str] - """List of vector store identifiers to search within""" - filters: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) Additional filters to apply to the search""" + filters: Optional[Dict[str, object]] = None max_num_results: Optional[int] = None - """(Optional) Maximum number of search results to return (1-50)""" ranking_options: Optional[ToolOpenAIResponseInputToolFileSearchRankingOptions] = None - """(Optional) Options for ranking and scoring search results""" + """Options for ranking and filtering search results.""" + + type: Optional[Literal["file_search"]] = None class ToolOpenAIResponseInputToolFunction(BaseModel): name: str - """Name of the function that can be called""" - type: Literal["function"] - """Tool type identifier, always "function" """ + parameters: Optional[Dict[str, object]] = None description: Optional[str] = None - """(Optional) Description of what the function does""" - - parameters: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) JSON schema defining the function's parameters""" strict: Optional[bool] = None - """(Optional) Whether to enforce strict parameter validation""" + + type: Optional[Literal["function"]] = None class ToolOpenAIResponseToolMcpAllowedToolsAllowedToolsFilter(BaseModel): tool_names: Optional[List[str]] = None - """(Optional) List of specific tool names that are allowed""" ToolOpenAIResponseToolMcpAllowedTools: TypeAlias = Union[ - List[str], ToolOpenAIResponseToolMcpAllowedToolsAllowedToolsFilter + List[str], ToolOpenAIResponseToolMcpAllowedToolsAllowedToolsFilter, None ] class ToolOpenAIResponseToolMcp(BaseModel): server_label: str - """Label to identify this MCP server""" - - type: Literal["mcp"] - """Tool type identifier, always "mcp" """ allowed_tools: Optional[ToolOpenAIResponseToolMcpAllowedTools] = None - """(Optional) Restriction on which tools can be used from this server""" + """Filter configuration for restricting which MCP tools can be used.""" + + type: Optional[Literal["mcp"]] = None Tool: TypeAlias = Union[ @@ -893,88 +772,65 @@ class ToolOpenAIResponseToolMcp(BaseModel): class UsageInputTokensDetails(BaseModel): cached_tokens: Optional[int] = None - """Number of tokens retrieved from cache""" class UsageOutputTokensDetails(BaseModel): reasoning_tokens: Optional[int] = None - """Number of tokens used for reasoning (o1/o3 models)""" class Usage(BaseModel): input_tokens: int - """Number of tokens in the input""" output_tokens: int - """Number of tokens in the output""" total_tokens: int - """Total tokens used (input + output)""" input_tokens_details: Optional[UsageInputTokensDetails] = None - """Detailed breakdown of input token usage""" + """Token details for input tokens in OpenAI response usage.""" output_tokens_details: Optional[UsageOutputTokensDetails] = None - """Detailed breakdown of output token usage""" + """Token details for output tokens in OpenAI response usage.""" class ResponseListResponse(BaseModel): id: str - """Unique identifier for this response""" created_at: int - """Unix timestamp when the response was created""" input: List[Input] - """List of input items that led to this response""" model: str - """Model identifier used for generation""" - - object: Literal["response"] - """Object type identifier, always "response" """ output: List[Output] - """List of generated output items (messages, tool calls, etc.)""" - - parallel_tool_calls: bool - """Whether tool calls can be executed in parallel""" status: str - """Current status of the response generation""" - - text: Text - """Text formatting configuration for the response""" error: Optional[Error] = None - """(Optional) Error details if the response generation failed""" + """Error details for failed OpenAI response requests.""" instructions: Optional[str] = None - """(Optional) System message inserted into the model's context""" max_tool_calls: Optional[int] = None - """ - (Optional) Max number of total calls to built-in tools that can be processed in - a response - """ + + object: Optional[Literal["response"]] = None + + parallel_tool_calls: Optional[bool] = None previous_response_id: Optional[str] = None - """(Optional) ID of the previous response in a conversation""" prompt: Optional[Prompt] = None - """(Optional) Reference to a prompt template and its variables.""" + """OpenAI compatible Prompt object that is used in OpenAI responses.""" temperature: Optional[float] = None - """(Optional) Sampling temperature used for generation""" + + text: Optional[Text] = None + """Text response configuration for OpenAI responses.""" tools: Optional[List[Tool]] = None - """(Optional) An array of tools the model may call while generating a response.""" top_p: Optional[float] = None - """(Optional) Nucleus sampling parameter used for generation""" truncation: Optional[str] = None - """(Optional) Truncation strategy applied to the response""" usage: Optional[Usage] = None - """(Optional) Token usage information for the response""" + """Usage information for OpenAI response.""" diff --git a/src/llama_stack_client/types/response_object.py b/src/llama_stack_client/types/response_object.py index 8db0f035..3f189577 100644 --- a/src/llama_stack_client/types/response_object.py +++ b/src/llama_stack_client/types/response_object.py @@ -17,19 +17,19 @@ __all__ = [ "ResponseObject", "Output", - "OutputOpenAIResponseMessage", - "OutputOpenAIResponseMessageContentUnionMember1", - "OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "OutputOpenAIResponseMessageContentUnionMember2", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", + "OutputOpenAIResponseMessageOutput", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", "OutputOpenAIResponseOutputMessageWebSearchToolCall", "OutputOpenAIResponseOutputMessageFileSearchToolCall", "OutputOpenAIResponseOutputMessageFileSearchToolCallResult", @@ -38,14 +38,14 @@ "OutputOpenAIResponseOutputMessageMcpListTools", "OutputOpenAIResponseOutputMessageMcpListToolsTool", "OutputOpenAIResponseMcpApprovalRequest", - "Text", - "TextFormat", "Error", "Prompt", "PromptVariables", "PromptVariablesOpenAIResponseInputMessageContentText", "PromptVariablesOpenAIResponseInputMessageContentImage", "PromptVariablesOpenAIResponseInputMessageContentFile", + "Text", + "TextFormat", "Tool", "ToolOpenAIResponseInputToolWebSearch", "ToolOpenAIResponseInputToolFileSearch", @@ -60,91 +60,77 @@ ] -class OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText(BaseModel): +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( + BaseModel +): text: str - """The text content of the input message""" - - type: Literal["input_text"] - """Content type identifier, always "input_text" """ + type: Optional[Literal["input_text"]] = None -class OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage(BaseModel): - detail: Literal["low", "high", "auto"] - """Level of detail for image processing, can be "low", "high", or "auto" """ - type: Literal["input_image"] - """Content type identifier, always "input_image" """ +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( + BaseModel +): + detail: Optional[Literal["low", "high", "auto"]] = None file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" image_url: Optional[str] = None - """(Optional) URL of the image content""" + type: Optional[Literal["input_image"]] = None -class OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile(BaseModel): - type: Literal["input_file"] - """The type of the input item. Always `input_file`.""" +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( + BaseModel +): file_data: Optional[str] = None - """The data of the file to be sent to the model.""" file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" file_url: Optional[str] = None - """The URL of the file to be sent to the model.""" filename: Optional[str] = None - """The name of the file to be sent to the model.""" + + type: Optional[Literal["input_file"]] = None -OutputOpenAIResponseMessageContentUnionMember1: TypeAlias = Annotated[ +OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Annotated[ Union[ - OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - OutputOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ], PropertyInfo(discriminator="type"), ] -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( BaseModel ): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + type: Optional[Literal["url_citation"]] = None -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( + +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( BaseModel ): container_id: str @@ -157,182 +143,159 @@ class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageC start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( BaseModel ): file_id: str index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None -OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ +OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ Union[ - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ], PropertyInfo(discriminator="type"), ] -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText(BaseModel): - annotations: List[ - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation - ] - +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( + BaseModel +): text: str - type: Literal["output_text"] + annotations: Optional[ + List[ + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + ] = None + type: Optional[Literal["output_text"]] = None -class OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal(BaseModel): + +class OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( + BaseModel +): refusal: str - """Refusal text supplied by the model""" - type: Literal["refusal"] - """Content part type identifier, always "refusal" """ + type: Optional[Literal["refusal"]] = None -OutputOpenAIResponseMessageContentUnionMember2: TypeAlias = Annotated[ +OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Annotated[ Union[ - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - OutputOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ], PropertyInfo(discriminator="type"), ] -class OutputOpenAIResponseMessage(BaseModel): +class OutputOpenAIResponseMessageOutput(BaseModel): content: Union[ - str, List[OutputOpenAIResponseMessageContentUnionMember1], List[OutputOpenAIResponseMessageContentUnionMember2] + str, + List[ + OutputOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + List[ + OutputOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal + ], ] role: Literal["system", "developer", "user", "assistant"] - type: Literal["message"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["message"]] = None + class OutputOpenAIResponseOutputMessageWebSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" status: str - """Current status of the web search operation""" - type: Literal["web_search_call"] - """Tool call type identifier, always "web_search_call" """ + type: Optional[Literal["web_search_call"]] = None class OutputOpenAIResponseOutputMessageFileSearchToolCallResult(BaseModel): - attributes: Dict[str, Union[bool, float, str, List[object], object, None]] - """(Optional) Key-value attributes associated with the file""" + attributes: Dict[str, object] file_id: str - """Unique identifier of the file containing the result""" filename: str - """Name of the file containing the result""" score: float - """Relevance score for this search result (between 0 and 1)""" text: str - """Text content of the search result""" class OutputOpenAIResponseOutputMessageFileSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" queries: List[str] - """List of search queries executed""" status: str - """Current status of the file search operation""" - - type: Literal["file_search_call"] - """Tool call type identifier, always "file_search_call" """ results: Optional[List[OutputOpenAIResponseOutputMessageFileSearchToolCallResult]] = None - """(Optional) Search results returned by the file search operation""" + + type: Optional[Literal["file_search_call"]] = None class OutputOpenAIResponseOutputMessageFunctionToolCall(BaseModel): arguments: str - """JSON string containing the function arguments""" call_id: str - """Unique identifier for the function call""" name: str - """Name of the function being called""" - - type: Literal["function_call"] - """Tool call type identifier, always "function_call" """ id: Optional[str] = None - """(Optional) Additional identifier for the tool call""" status: Optional[str] = None - """(Optional) Current status of the function call execution""" + + type: Optional[Literal["function_call"]] = None class OutputOpenAIResponseOutputMessageMcpCall(BaseModel): id: str - """Unique identifier for this MCP call""" arguments: str - """JSON string containing the MCP call arguments""" name: str - """Name of the MCP method being called""" server_label: str - """Label identifying the MCP server handling the call""" - - type: Literal["mcp_call"] - """Tool call type identifier, always "mcp_call" """ error: Optional[str] = None - """(Optional) Error message if the MCP call failed""" output: Optional[str] = None - """(Optional) Output result from the successful MCP call""" + + type: Optional[Literal["mcp_call"]] = None class OutputOpenAIResponseOutputMessageMcpListToolsTool(BaseModel): - input_schema: Dict[str, Union[bool, float, str, List[object], object, None]] - """JSON schema defining the tool's input parameters""" + input_schema: Dict[str, object] name: str - """Name of the tool""" description: Optional[str] = None - """(Optional) Description of what the tool does""" class OutputOpenAIResponseOutputMessageMcpListTools(BaseModel): id: str - """Unique identifier for this MCP list tools operation""" server_label: str - """Label identifying the MCP server providing the tools""" tools: List[OutputOpenAIResponseOutputMessageMcpListToolsTool] - """List of available tools provided by the MCP server""" - type: Literal["mcp_list_tools"] - """Tool call type identifier, always "mcp_list_tools" """ + type: Optional[Literal["mcp_list_tools"]] = None class OutputOpenAIResponseMcpApprovalRequest(BaseModel): @@ -344,12 +307,12 @@ class OutputOpenAIResponseMcpApprovalRequest(BaseModel): server_label: str - type: Literal["mcp_approval_request"] + type: Optional[Literal["mcp_approval_request"]] = None Output: TypeAlias = Annotated[ Union[ - OutputOpenAIResponseMessage, + OutputOpenAIResponseMessageOutput, OutputOpenAIResponseOutputMessageWebSearchToolCall, OutputOpenAIResponseOutputMessageFileSearchToolCall, OutputOpenAIResponseOutputMessageFunctionToolCall, @@ -361,81 +324,38 @@ class OutputOpenAIResponseMcpApprovalRequest(BaseModel): ] -class TextFormat(BaseModel): - type: Literal["text", "json_schema", "json_object"] - """Must be "text", "json_schema", or "json_object" to identify the format type""" - - description: Optional[str] = None - """(Optional) A description of the response format. Only used for json_schema.""" - - name: Optional[str] = None - """The name of the response format. Only used for json_schema.""" - - schema_: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = FieldInfo( - alias="schema", default=None - ) - """The JSON schema the response should conform to. - - In a Python SDK, this is often a `pydantic` model. Only used for json_schema. - """ - - strict: Optional[bool] = None - """(Optional) Whether to strictly enforce the JSON schema. - - If true, the response must match the schema exactly. Only used for json_schema. - """ - - -class Text(BaseModel): - format: Optional[TextFormat] = None - """(Optional) Text format configuration specifying output format requirements""" - - class Error(BaseModel): code: str - """Error code identifying the type of failure""" message: str - """Human-readable error message describing the failure""" class PromptVariablesOpenAIResponseInputMessageContentText(BaseModel): text: str - """The text content of the input message""" - type: Literal["input_text"] - """Content type identifier, always "input_text" """ + type: Optional[Literal["input_text"]] = None class PromptVariablesOpenAIResponseInputMessageContentImage(BaseModel): - detail: Literal["low", "high", "auto"] - """Level of detail for image processing, can be "low", "high", or "auto" """ - - type: Literal["input_image"] - """Content type identifier, always "input_image" """ + detail: Optional[Literal["low", "high", "auto"]] = None file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" image_url: Optional[str] = None - """(Optional) URL of the image content""" + type: Optional[Literal["input_image"]] = None -class PromptVariablesOpenAIResponseInputMessageContentFile(BaseModel): - type: Literal["input_file"] - """The type of the input item. Always `input_file`.""" +class PromptVariablesOpenAIResponseInputMessageContentFile(BaseModel): file_data: Optional[str] = None - """The data of the file to be sent to the model.""" file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" file_url: Optional[str] = None - """The URL of the file to be sent to the model.""" filename: Optional[str] = None - """The name of the file to be sent to the model.""" + + type: Optional[Literal["input_file"]] = None PromptVariables: TypeAlias = Annotated[ @@ -450,88 +370,84 @@ class PromptVariablesOpenAIResponseInputMessageContentFile(BaseModel): class Prompt(BaseModel): id: str - """Unique identifier of the prompt template""" variables: Optional[Dict[str, PromptVariables]] = None - """ - Dictionary of variable names to OpenAIResponseInputMessageContent structure for - template substitution. The substitution values can either be strings, or other - Response input types like images or files. - """ version: Optional[str] = None - """Version number of the prompt to use (defaults to latest if not specified)""" -class ToolOpenAIResponseInputToolWebSearch(BaseModel): - type: Literal["web_search", "web_search_preview", "web_search_preview_2025_03_11", "web_search_2025_08_26"] - """Web search tool type variant to use""" +class TextFormat(BaseModel): + description: Optional[str] = None + + name: Optional[str] = None + + schema_: Optional[Dict[str, object]] = FieldInfo(alias="schema", default=None) + + strict: Optional[bool] = None + + type: Optional[Literal["text", "json_schema", "json_object"]] = None + +class Text(BaseModel): + format: Optional[TextFormat] = None + """Configuration for Responses API text format.""" + + +class ToolOpenAIResponseInputToolWebSearch(BaseModel): search_context_size: Optional[str] = None - """(Optional) Size of search context, must be "low", "medium", or "high" """ + + type: Optional[ + Literal["web_search", "web_search_preview", "web_search_preview_2025_03_11", "web_search_2025_08_26"] + ] = None class ToolOpenAIResponseInputToolFileSearchRankingOptions(BaseModel): ranker: Optional[str] = None - """(Optional) Name of the ranking algorithm to use""" score_threshold: Optional[float] = None - """(Optional) Minimum relevance score threshold for results""" class ToolOpenAIResponseInputToolFileSearch(BaseModel): - type: Literal["file_search"] - """Tool type identifier, always "file_search" """ - vector_store_ids: List[str] - """List of vector store identifiers to search within""" - filters: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) Additional filters to apply to the search""" + filters: Optional[Dict[str, object]] = None max_num_results: Optional[int] = None - """(Optional) Maximum number of search results to return (1-50)""" ranking_options: Optional[ToolOpenAIResponseInputToolFileSearchRankingOptions] = None - """(Optional) Options for ranking and scoring search results""" + """Options for ranking and filtering search results.""" + + type: Optional[Literal["file_search"]] = None class ToolOpenAIResponseInputToolFunction(BaseModel): name: str - """Name of the function that can be called""" - type: Literal["function"] - """Tool type identifier, always "function" """ + parameters: Optional[Dict[str, object]] = None description: Optional[str] = None - """(Optional) Description of what the function does""" - - parameters: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) JSON schema defining the function's parameters""" strict: Optional[bool] = None - """(Optional) Whether to enforce strict parameter validation""" + + type: Optional[Literal["function"]] = None class ToolOpenAIResponseToolMcpAllowedToolsAllowedToolsFilter(BaseModel): tool_names: Optional[List[str]] = None - """(Optional) List of specific tool names that are allowed""" ToolOpenAIResponseToolMcpAllowedTools: TypeAlias = Union[ - List[str], ToolOpenAIResponseToolMcpAllowedToolsAllowedToolsFilter + List[str], ToolOpenAIResponseToolMcpAllowedToolsAllowedToolsFilter, None ] class ToolOpenAIResponseToolMcp(BaseModel): server_label: str - """Label to identify this MCP server""" - - type: Literal["mcp"] - """Tool type identifier, always "mcp" """ allowed_tools: Optional[ToolOpenAIResponseToolMcpAllowedTools] = None - """(Optional) Restriction on which tools can be used from this server""" + """Filter configuration for restricting which MCP tools can be used.""" + + type: Optional[Literal["mcp"]] = None Tool: TypeAlias = Union[ @@ -544,29 +460,24 @@ class ToolOpenAIResponseToolMcp(BaseModel): class UsageInputTokensDetails(BaseModel): cached_tokens: Optional[int] = None - """Number of tokens retrieved from cache""" class UsageOutputTokensDetails(BaseModel): reasoning_tokens: Optional[int] = None - """Number of tokens used for reasoning (o1/o3 models)""" class Usage(BaseModel): input_tokens: int - """Number of tokens in the input""" output_tokens: int - """Number of tokens in the output""" total_tokens: int - """Total tokens used (input + output)""" input_tokens_details: Optional[UsageInputTokensDetails] = None - """Detailed breakdown of input token usage""" + """Token details for input tokens in OpenAI response usage.""" output_tokens_details: Optional[UsageOutputTokensDetails] = None - """Detailed breakdown of output token usage""" + """Token details for output tokens in OpenAI response usage.""" class ResponseObject(BaseModel): @@ -581,58 +492,41 @@ def output_text(self) -> str: return "".join(texts) id: str - """Unique identifier for this response""" created_at: int - """Unix timestamp when the response was created""" model: str - """Model identifier used for generation""" - - object: Literal["response"] - """Object type identifier, always "response" """ output: List[Output] - """List of generated output items (messages, tool calls, etc.)""" - - parallel_tool_calls: bool - """Whether tool calls can be executed in parallel""" status: str - """Current status of the response generation""" - - text: Text - """Text formatting configuration for the response""" error: Optional[Error] = None - """(Optional) Error details if the response generation failed""" + """Error details for failed OpenAI response requests.""" instructions: Optional[str] = None - """(Optional) System message inserted into the model's context""" max_tool_calls: Optional[int] = None - """ - (Optional) Max number of total calls to built-in tools that can be processed in - a response - """ + + object: Optional[Literal["response"]] = None + + parallel_tool_calls: Optional[bool] = None previous_response_id: Optional[str] = None - """(Optional) ID of the previous response in a conversation""" prompt: Optional[Prompt] = None - """(Optional) Reference to a prompt template and its variables.""" + """OpenAI compatible Prompt object that is used in OpenAI responses.""" temperature: Optional[float] = None - """(Optional) Sampling temperature used for generation""" + + text: Optional[Text] = None + """Text response configuration for OpenAI responses.""" tools: Optional[List[Tool]] = None - """(Optional) An array of tools the model may call while generating a response.""" top_p: Optional[float] = None - """(Optional) Nucleus sampling parameter used for generation""" truncation: Optional[str] = None - """(Optional) Truncation strategy applied to the response""" usage: Optional[Usage] = None - """(Optional) Token usage information for the response""" + """Usage information for OpenAI response.""" diff --git a/src/llama_stack_client/types/response_object_stream.py b/src/llama_stack_client/types/response_object_stream.py index 16fe6c6d..7cda237f 100644 --- a/src/llama_stack_client/types/response_object_stream.py +++ b/src/llama_stack_client/types/response_object_stream.py @@ -20,18 +20,18 @@ "OpenAIResponseObjectStreamResponseOutputItemAdded", "OpenAIResponseObjectStreamResponseOutputItemAddedItem", "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessage", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageWebSearchToolCall", "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageFileSearchToolCall", "OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageFileSearchToolCallResult", @@ -43,18 +43,18 @@ "OpenAIResponseObjectStreamResponseOutputItemDone", "OpenAIResponseObjectStreamResponseOutputItemDoneItem", "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessage", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageWebSearchToolCall", "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageFileSearchToolCall", "OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageFileSearchToolCallResult", @@ -125,114 +125,91 @@ class OpenAIResponseObjectStreamResponseCreated(BaseModel): response: ResponseObject - """The response object that was created""" + """Complete OpenAI response object containing generation results and metadata.""" - type: Literal["response.created"] - """Event type identifier, always "response.created" """ + type: Optional[Literal["response.created"]] = None class OpenAIResponseObjectStreamResponseInProgress(BaseModel): response: ResponseObject - """Current response state while in progress""" + """Complete OpenAI response object containing generation results and metadata.""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.in_progress"] - """Event type identifier, always "response.in_progress" """ + type: Optional[Literal["response.in_progress"]] = None -class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText( +class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( BaseModel ): text: str - """The text content of the input message""" - type: Literal["input_text"] - """Content type identifier, always "input_text" """ + type: Optional[Literal["input_text"]] = None -class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage( +class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( BaseModel ): - detail: Literal["low", "high", "auto"] - """Level of detail for image processing, can be "low", "high", or "auto" """ - - type: Literal["input_image"] - """Content type identifier, always "input_image" """ + detail: Optional[Literal["low", "high", "auto"]] = None file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" image_url: Optional[str] = None - """(Optional) URL of the image content""" + + type: Optional[Literal["input_image"]] = None -class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile( +class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( BaseModel ): - type: Literal["input_file"] - """The type of the input item. Always `input_file`.""" - file_data: Optional[str] = None - """The data of the file to be sent to the model.""" file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" file_url: Optional[str] = None - """The URL of the file to be sent to the model.""" filename: Optional[str] = None - """The name of the file to be sent to the model.""" + + type: Optional[Literal["input_file"]] = None -OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1: TypeAlias = Annotated[ +OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Annotated[ Union[ - OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ], PropertyInfo(discriminator="type"), ] -class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None -class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( BaseModel ): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + + type: Optional[Literal["url_citation"]] = None -class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( +class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( BaseModel ): container_id: str @@ -245,56 +222,56 @@ class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessage start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None -class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( BaseModel ): file_id: str index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None -OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ +OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ Union[ - OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ], PropertyInfo(discriminator="type"), ] -class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText( +class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( BaseModel ): - annotations: List[ - OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation - ] - text: str - type: Literal["output_text"] + annotations: Optional[ + List[ + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + ] = None + + type: Optional[Literal["output_text"]] = None -class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal( +class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( BaseModel ): refusal: str - """Refusal text supplied by the model""" - type: Literal["refusal"] - """Content part type identifier, always "refusal" """ + type: Optional[Literal["refusal"]] = None -OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2: TypeAlias = Annotated[ +OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Annotated[ Union[ - OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ], PropertyInfo(discriminator="type"), ] @@ -303,134 +280,105 @@ class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessage class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessage(BaseModel): content: Union[ str, - List[OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember1], - List[OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentUnionMember2], + List[ + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + List[ + OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal + ], ] role: Literal["system", "developer", "user", "assistant"] - type: Literal["message"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["message"]] = None + class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageWebSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" status: str - """Current status of the web search operation""" - type: Literal["web_search_call"] - """Tool call type identifier, always "web_search_call" """ + type: Optional[Literal["web_search_call"]] = None class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageFileSearchToolCallResult( BaseModel ): - attributes: Dict[str, Union[bool, float, str, List[object], object, None]] - """(Optional) Key-value attributes associated with the file""" + attributes: Dict[str, object] file_id: str - """Unique identifier of the file containing the result""" filename: str - """Name of the file containing the result""" score: float - """Relevance score for this search result (between 0 and 1)""" text: str - """Text content of the search result""" class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageFileSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" queries: List[str] - """List of search queries executed""" status: str - """Current status of the file search operation""" - - type: Literal["file_search_call"] - """Tool call type identifier, always "file_search_call" """ results: Optional[ List[OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageFileSearchToolCallResult] ] = None - """(Optional) Search results returned by the file search operation""" + + type: Optional[Literal["file_search_call"]] = None class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageFunctionToolCall(BaseModel): arguments: str - """JSON string containing the function arguments""" call_id: str - """Unique identifier for the function call""" name: str - """Name of the function being called""" - - type: Literal["function_call"] - """Tool call type identifier, always "function_call" """ id: Optional[str] = None - """(Optional) Additional identifier for the tool call""" status: Optional[str] = None - """(Optional) Current status of the function call execution""" + + type: Optional[Literal["function_call"]] = None class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageMcpCall(BaseModel): id: str - """Unique identifier for this MCP call""" arguments: str - """JSON string containing the MCP call arguments""" name: str - """Name of the MCP method being called""" server_label: str - """Label identifying the MCP server handling the call""" - - type: Literal["mcp_call"] - """Tool call type identifier, always "mcp_call" """ error: Optional[str] = None - """(Optional) Error message if the MCP call failed""" output: Optional[str] = None - """(Optional) Output result from the successful MCP call""" + + type: Optional[Literal["mcp_call"]] = None class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageMcpListToolsTool(BaseModel): - input_schema: Dict[str, Union[bool, float, str, List[object], object, None]] - """JSON schema defining the tool's input parameters""" + input_schema: Dict[str, object] name: str - """Name of the tool""" description: Optional[str] = None - """(Optional) Description of what the tool does""" class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageMcpListTools(BaseModel): id: str - """Unique identifier for this MCP list tools operation""" server_label: str - """Label identifying the MCP server providing the tools""" tools: List[OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseOutputMessageMcpListToolsTool] - """List of available tools provided by the MCP server""" - type: Literal["mcp_list_tools"] - """Tool call type identifier, always "mcp_list_tools" """ + type: Optional[Literal["mcp_list_tools"]] = None class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMcpApprovalRequest(BaseModel): @@ -442,7 +390,7 @@ class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMcpAppr server_label: str - type: Literal["mcp_approval_request"] + type: Optional[Literal["mcp_approval_request"]] = None OpenAIResponseObjectStreamResponseOutputItemAddedItem: TypeAlias = Annotated[ @@ -461,112 +409,92 @@ class OpenAIResponseObjectStreamResponseOutputItemAddedItemOpenAIResponseMcpAppr class OpenAIResponseObjectStreamResponseOutputItemAdded(BaseModel): item: OpenAIResponseObjectStreamResponseOutputItemAddedItem - """The output item that was added (message, tool call, etc.)""" + """ + Corresponds to the various Message types in the Responses API. They are all + under one type because the Responses API gives them all the same "type" value, + and there is no way to tell them apart in certain scenarios. + """ output_index: int - """Index position of this item in the output list""" response_id: str - """Unique identifier of the response containing this output""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.output_item.added"] - """Event type identifier, always "response.output_item.added" """ + type: Optional[Literal["response.output_item.added"]] = None -class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText( +class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( BaseModel ): text: str - """The text content of the input message""" - type: Literal["input_text"] - """Content type identifier, always "input_text" """ + type: Optional[Literal["input_text"]] = None -class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage( +class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( BaseModel ): - detail: Literal["low", "high", "auto"] - """Level of detail for image processing, can be "low", "high", or "auto" """ - - type: Literal["input_image"] - """Content type identifier, always "input_image" """ + detail: Optional[Literal["low", "high", "auto"]] = None file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" image_url: Optional[str] = None - """(Optional) URL of the image content""" + type: Optional[Literal["input_image"]] = None -class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile( + +class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( BaseModel ): - type: Literal["input_file"] - """The type of the input item. Always `input_file`.""" - file_data: Optional[str] = None - """The data of the file to be sent to the model.""" file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" file_url: Optional[str] = None - """The URL of the file to be sent to the model.""" filename: Optional[str] = None - """The name of the file to be sent to the model.""" + + type: Optional[Literal["input_file"]] = None -OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1: TypeAlias = Annotated[ +OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Annotated[ Union[ - OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ], PropertyInfo(discriminator="type"), ] -class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None -class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( BaseModel ): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + + type: Optional[Literal["url_citation"]] = None -class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( +class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( BaseModel ): container_id: str @@ -579,56 +507,56 @@ class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageC start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None -class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( BaseModel ): file_id: str index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None -OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ +OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ Union[ - OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ], PropertyInfo(discriminator="type"), ] -class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText( +class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( BaseModel ): - annotations: List[ - OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation - ] - text: str - type: Literal["output_text"] + annotations: Optional[ + List[ + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + ] = None + + type: Optional[Literal["output_text"]] = None -class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal( +class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( BaseModel ): refusal: str - """Refusal text supplied by the model""" - type: Literal["refusal"] - """Content part type identifier, always "refusal" """ + type: Optional[Literal["refusal"]] = None -OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2: TypeAlias = Annotated[ +OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Annotated[ Union[ - OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ], PropertyInfo(discriminator="type"), ] @@ -637,134 +565,105 @@ class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageC class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessage(BaseModel): content: Union[ str, - List[OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember1], - List[OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentUnionMember2], + List[ + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + List[ + OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMessageContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal + ], ] role: Literal["system", "developer", "user", "assistant"] - type: Literal["message"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["message"]] = None + class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageWebSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" status: str - """Current status of the web search operation""" - type: Literal["web_search_call"] - """Tool call type identifier, always "web_search_call" """ + type: Optional[Literal["web_search_call"]] = None class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageFileSearchToolCallResult( BaseModel ): - attributes: Dict[str, Union[bool, float, str, List[object], object, None]] - """(Optional) Key-value attributes associated with the file""" + attributes: Dict[str, object] file_id: str - """Unique identifier of the file containing the result""" filename: str - """Name of the file containing the result""" score: float - """Relevance score for this search result (between 0 and 1)""" text: str - """Text content of the search result""" class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageFileSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" queries: List[str] - """List of search queries executed""" status: str - """Current status of the file search operation""" - - type: Literal["file_search_call"] - """Tool call type identifier, always "file_search_call" """ results: Optional[ List[OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageFileSearchToolCallResult] ] = None - """(Optional) Search results returned by the file search operation""" + + type: Optional[Literal["file_search_call"]] = None class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageFunctionToolCall(BaseModel): arguments: str - """JSON string containing the function arguments""" call_id: str - """Unique identifier for the function call""" name: str - """Name of the function being called""" - - type: Literal["function_call"] - """Tool call type identifier, always "function_call" """ id: Optional[str] = None - """(Optional) Additional identifier for the tool call""" status: Optional[str] = None - """(Optional) Current status of the function call execution""" + + type: Optional[Literal["function_call"]] = None class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageMcpCall(BaseModel): id: str - """Unique identifier for this MCP call""" arguments: str - """JSON string containing the MCP call arguments""" name: str - """Name of the MCP method being called""" server_label: str - """Label identifying the MCP server handling the call""" - - type: Literal["mcp_call"] - """Tool call type identifier, always "mcp_call" """ error: Optional[str] = None - """(Optional) Error message if the MCP call failed""" output: Optional[str] = None - """(Optional) Output result from the successful MCP call""" + + type: Optional[Literal["mcp_call"]] = None class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageMcpListToolsTool(BaseModel): - input_schema: Dict[str, Union[bool, float, str, List[object], object, None]] - """JSON schema defining the tool's input parameters""" + input_schema: Dict[str, object] name: str - """Name of the tool""" description: Optional[str] = None - """(Optional) Description of what the tool does""" class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageMcpListTools(BaseModel): id: str - """Unique identifier for this MCP list tools operation""" server_label: str - """Label identifying the MCP server providing the tools""" tools: List[OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseOutputMessageMcpListToolsTool] - """List of available tools provided by the MCP server""" - type: Literal["mcp_list_tools"] - """Tool call type identifier, always "mcp_list_tools" """ + type: Optional[Literal["mcp_list_tools"]] = None class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMcpApprovalRequest(BaseModel): @@ -776,7 +675,7 @@ class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMcpAppro server_label: str - type: Literal["mcp_approval_request"] + type: Optional[Literal["mcp_approval_request"]] = None OpenAIResponseObjectStreamResponseOutputItemDoneItem: TypeAlias = Annotated[ @@ -795,107 +694,81 @@ class OpenAIResponseObjectStreamResponseOutputItemDoneItemOpenAIResponseMcpAppro class OpenAIResponseObjectStreamResponseOutputItemDone(BaseModel): item: OpenAIResponseObjectStreamResponseOutputItemDoneItem - """The completed output item (message, tool call, etc.)""" + """ + Corresponds to the various Message types in the Responses API. They are all + under one type because the Responses API gives them all the same "type" value, + and there is no way to tell them apart in certain scenarios. + """ output_index: int - """Index position of this item in the output list""" response_id: str - """Unique identifier of the response containing this output""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.output_item.done"] - """Event type identifier, always "response.output_item.done" """ + type: Optional[Literal["response.output_item.done"]] = None class OpenAIResponseObjectStreamResponseOutputTextDelta(BaseModel): content_index: int - """Index position within the text content""" delta: str - """Incremental text content being added""" item_id: str - """Unique identifier of the output item being updated""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.output_text.delta"] - """Event type identifier, always "response.output_text.delta" """ + type: Optional[Literal["response.output_text.delta"]] = None class OpenAIResponseObjectStreamResponseOutputTextDone(BaseModel): content_index: int - """Index position within the text content""" item_id: str - """Unique identifier of the completed output item""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" text: str - """Final complete text content of the output item""" - type: Literal["response.output_text.done"] - """Event type identifier, always "response.output_text.done" """ + type: Optional[Literal["response.output_text.done"]] = None class OpenAIResponseObjectStreamResponseFunctionCallArgumentsDelta(BaseModel): delta: str - """Incremental function call arguments being added""" item_id: str - """Unique identifier of the function call being updated""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.function_call_arguments.delta"] - """Event type identifier, always "response.function_call_arguments.delta" """ + type: Optional[Literal["response.function_call_arguments.delta"]] = None class OpenAIResponseObjectStreamResponseFunctionCallArgumentsDone(BaseModel): arguments: str - """Final complete arguments JSON string for the function call""" item_id: str - """Unique identifier of the completed function call""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.function_call_arguments.done"] - """Event type identifier, always "response.function_call_arguments.done" """ + type: Optional[Literal["response.function_call_arguments.done"]] = None class OpenAIResponseObjectStreamResponseWebSearchCallInProgress(BaseModel): item_id: str - """Unique identifier of the web search call""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.web_search_call.in_progress"] - """Event type identifier, always "response.web_search_call.in_progress" """ + type: Optional[Literal["response.web_search_call.in_progress"]] = None class OpenAIResponseObjectStreamResponseWebSearchCallSearching(BaseModel): @@ -905,39 +778,35 @@ class OpenAIResponseObjectStreamResponseWebSearchCallSearching(BaseModel): sequence_number: int - type: Literal["response.web_search_call.searching"] + type: Optional[Literal["response.web_search_call.searching"]] = None class OpenAIResponseObjectStreamResponseWebSearchCallCompleted(BaseModel): item_id: str - """Unique identifier of the completed web search call""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.web_search_call.completed"] - """Event type identifier, always "response.web_search_call.completed" """ + type: Optional[Literal["response.web_search_call.completed"]] = None class OpenAIResponseObjectStreamResponseMcpListToolsInProgress(BaseModel): sequence_number: int - type: Literal["response.mcp_list_tools.in_progress"] + type: Optional[Literal["response.mcp_list_tools.in_progress"]] = None class OpenAIResponseObjectStreamResponseMcpListToolsFailed(BaseModel): sequence_number: int - type: Literal["response.mcp_list_tools.failed"] + type: Optional[Literal["response.mcp_list_tools.failed"]] = None class OpenAIResponseObjectStreamResponseMcpListToolsCompleted(BaseModel): sequence_number: int - type: Literal["response.mcp_list_tools.completed"] + type: Optional[Literal["response.mcp_list_tools.completed"]] = None class OpenAIResponseObjectStreamResponseMcpCallArgumentsDelta(BaseModel): @@ -949,7 +818,7 @@ class OpenAIResponseObjectStreamResponseMcpCallArgumentsDelta(BaseModel): sequence_number: int - type: Literal["response.mcp_call.arguments.delta"] + type: Optional[Literal["response.mcp_call.arguments.delta"]] = None class OpenAIResponseObjectStreamResponseMcpCallArgumentsDone(BaseModel): @@ -961,72 +830,55 @@ class OpenAIResponseObjectStreamResponseMcpCallArgumentsDone(BaseModel): sequence_number: int - type: Literal["response.mcp_call.arguments.done"] + type: Optional[Literal["response.mcp_call.arguments.done"]] = None class OpenAIResponseObjectStreamResponseMcpCallInProgress(BaseModel): item_id: str - """Unique identifier of the MCP call""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.mcp_call.in_progress"] - """Event type identifier, always "response.mcp_call.in_progress" """ + type: Optional[Literal["response.mcp_call.in_progress"]] = None class OpenAIResponseObjectStreamResponseMcpCallFailed(BaseModel): sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.mcp_call.failed"] - """Event type identifier, always "response.mcp_call.failed" """ + type: Optional[Literal["response.mcp_call.failed"]] = None class OpenAIResponseObjectStreamResponseMcpCallCompleted(BaseModel): sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.mcp_call.completed"] - """Event type identifier, always "response.mcp_call.completed" """ + type: Optional[Literal["response.mcp_call.completed"]] = None class OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseContentPartOutputTextAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None class OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseContentPartOutputTextAnnotationOpenAIResponseAnnotationCitation( BaseModel ): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + + type: Optional[Literal["url_citation"]] = None class OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseContentPartOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( @@ -1042,7 +894,7 @@ class OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseConten start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None class OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseContentPartOutputTextAnnotationOpenAIResponseAnnotationFilePath( @@ -1052,7 +904,7 @@ class OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseConten index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseContentPartOutputTextAnnotation: TypeAlias = Annotated[ @@ -1067,35 +919,27 @@ class OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseConten class OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseContentPartOutputText(BaseModel): - annotations: List[ - OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseContentPartOutputTextAnnotation - ] - """Structured annotations associated with the text""" - text: str - """Text emitted for this content part""" - type: Literal["output_text"] - """Content part type identifier, always "output_text" """ + annotations: Optional[ + List[OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseContentPartOutputTextAnnotation] + ] = None + + logprobs: Optional[List[Dict[str, object]]] = None - logprobs: Optional[List[Dict[str, Union[bool, float, str, List[object], object, None]]]] = None - """(Optional) Token log probability details""" + type: Optional[Literal["output_text"]] = None class OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseContentPartRefusal(BaseModel): refusal: str - """Refusal text supplied by the model""" - type: Literal["refusal"] - """Content part type identifier, always "refusal" """ + type: Optional[Literal["refusal"]] = None class OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseContentPartReasoningText(BaseModel): text: str - """Reasoning text supplied by the model""" - type: Literal["reasoning_text"] - """Content part type identifier, always "reasoning_text" """ + type: Optional[Literal["reasoning_text"]] = None OpenAIResponseObjectStreamResponseContentPartAddedPart: TypeAlias = Annotated[ @@ -1110,60 +954,45 @@ class OpenAIResponseObjectStreamResponseContentPartAddedPartOpenAIResponseConten class OpenAIResponseObjectStreamResponseContentPartAdded(BaseModel): content_index: int - """Index position of the part within the content array""" item_id: str - """Unique identifier of the output item containing this content part""" output_index: int - """Index position of the output item in the response""" part: OpenAIResponseObjectStreamResponseContentPartAddedPart - """The content part that was added""" + """Text content within a streamed response part.""" response_id: str - """Unique identifier of the response containing this content""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.content_part.added"] - """Event type identifier, always "response.content_part.added" """ + type: Optional[Literal["response.content_part.added"]] = None class OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContentPartOutputTextAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None class OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContentPartOutputTextAnnotationOpenAIResponseAnnotationCitation( BaseModel ): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + + type: Optional[Literal["url_citation"]] = None class OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContentPartOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( @@ -1179,7 +1008,7 @@ class OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContent start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None class OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContentPartOutputTextAnnotationOpenAIResponseAnnotationFilePath( @@ -1189,7 +1018,7 @@ class OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContent index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContentPartOutputTextAnnotation: TypeAlias = Annotated[ @@ -1204,35 +1033,27 @@ class OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContent class OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContentPartOutputText(BaseModel): - annotations: List[ - OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContentPartOutputTextAnnotation - ] - """Structured annotations associated with the text""" - text: str - """Text emitted for this content part""" - type: Literal["output_text"] - """Content part type identifier, always "output_text" """ + annotations: Optional[ + List[OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContentPartOutputTextAnnotation] + ] = None + + logprobs: Optional[List[Dict[str, object]]] = None - logprobs: Optional[List[Dict[str, Union[bool, float, str, List[object], object, None]]]] = None - """(Optional) Token log probability details""" + type: Optional[Literal["output_text"]] = None class OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContentPartRefusal(BaseModel): refusal: str - """Refusal text supplied by the model""" - type: Literal["refusal"] - """Content part type identifier, always "refusal" """ + type: Optional[Literal["refusal"]] = None class OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContentPartReasoningText(BaseModel): text: str - """Reasoning text supplied by the model""" - type: Literal["reasoning_text"] - """Content part type identifier, always "reasoning_text" """ + type: Optional[Literal["reasoning_text"]] = None OpenAIResponseObjectStreamResponseContentPartDonePart: TypeAlias = Annotated[ @@ -1247,234 +1068,169 @@ class OpenAIResponseObjectStreamResponseContentPartDonePartOpenAIResponseContent class OpenAIResponseObjectStreamResponseContentPartDone(BaseModel): content_index: int - """Index position of the part within the content array""" item_id: str - """Unique identifier of the output item containing this content part""" output_index: int - """Index position of the output item in the response""" part: OpenAIResponseObjectStreamResponseContentPartDonePart - """The completed content part""" + """Text content within a streamed response part.""" response_id: str - """Unique identifier of the response containing this content""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.content_part.done"] - """Event type identifier, always "response.content_part.done" """ + type: Optional[Literal["response.content_part.done"]] = None class OpenAIResponseObjectStreamResponseReasoningTextDelta(BaseModel): content_index: int - """Index position of the reasoning content part""" delta: str - """Incremental reasoning text being added""" item_id: str - """Unique identifier of the output item being updated""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.reasoning_text.delta"] - """Event type identifier, always "response.reasoning_text.delta" """ + type: Optional[Literal["response.reasoning_text.delta"]] = None class OpenAIResponseObjectStreamResponseReasoningTextDone(BaseModel): content_index: int - """Index position of the reasoning content part""" item_id: str - """Unique identifier of the completed output item""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" text: str - """Final complete reasoning text""" - type: Literal["response.reasoning_text.done"] - """Event type identifier, always "response.reasoning_text.done" """ + type: Optional[Literal["response.reasoning_text.done"]] = None class OpenAIResponseObjectStreamResponseReasoningSummaryPartAddedPart(BaseModel): text: str - """Summary text""" - type: Literal["summary_text"] - """Content part type identifier, always "summary_text" """ + type: Optional[Literal["summary_text"]] = None class OpenAIResponseObjectStreamResponseReasoningSummaryPartAdded(BaseModel): item_id: str - """Unique identifier of the output item""" output_index: int - """Index position of the output item""" part: OpenAIResponseObjectStreamResponseReasoningSummaryPartAddedPart - """The summary part that was added""" + """Reasoning summary part in a streamed response.""" sequence_number: int - """Sequential number for ordering streaming events""" summary_index: int - """Index of the summary part within the reasoning summary""" - type: Literal["response.reasoning_summary_part.added"] - """Event type identifier, always "response.reasoning_summary_part.added" """ + type: Optional[Literal["response.reasoning_summary_part.added"]] = None class OpenAIResponseObjectStreamResponseReasoningSummaryPartDonePart(BaseModel): text: str - """Summary text""" - type: Literal["summary_text"] - """Content part type identifier, always "summary_text" """ + type: Optional[Literal["summary_text"]] = None class OpenAIResponseObjectStreamResponseReasoningSummaryPartDone(BaseModel): item_id: str - """Unique identifier of the output item""" output_index: int - """Index position of the output item""" part: OpenAIResponseObjectStreamResponseReasoningSummaryPartDonePart - """The completed summary part""" + """Reasoning summary part in a streamed response.""" sequence_number: int - """Sequential number for ordering streaming events""" summary_index: int - """Index of the summary part within the reasoning summary""" - type: Literal["response.reasoning_summary_part.done"] - """Event type identifier, always "response.reasoning_summary_part.done" """ + type: Optional[Literal["response.reasoning_summary_part.done"]] = None class OpenAIResponseObjectStreamResponseReasoningSummaryTextDelta(BaseModel): delta: str - """Incremental summary text being added""" item_id: str - """Unique identifier of the output item""" output_index: int - """Index position of the output item""" sequence_number: int - """Sequential number for ordering streaming events""" summary_index: int - """Index of the summary part within the reasoning summary""" - type: Literal["response.reasoning_summary_text.delta"] - """Event type identifier, always "response.reasoning_summary_text.delta" """ + type: Optional[Literal["response.reasoning_summary_text.delta"]] = None class OpenAIResponseObjectStreamResponseReasoningSummaryTextDone(BaseModel): item_id: str - """Unique identifier of the output item""" output_index: int - """Index position of the output item""" sequence_number: int - """Sequential number for ordering streaming events""" summary_index: int - """Index of the summary part within the reasoning summary""" text: str - """Final complete summary text""" - type: Literal["response.reasoning_summary_text.done"] - """Event type identifier, always "response.reasoning_summary_text.done" """ + type: Optional[Literal["response.reasoning_summary_text.done"]] = None class OpenAIResponseObjectStreamResponseRefusalDelta(BaseModel): content_index: int - """Index position of the content part""" delta: str - """Incremental refusal text being added""" item_id: str - """Unique identifier of the output item""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.refusal.delta"] - """Event type identifier, always "response.refusal.delta" """ + type: Optional[Literal["response.refusal.delta"]] = None class OpenAIResponseObjectStreamResponseRefusalDone(BaseModel): content_index: int - """Index position of the content part""" item_id: str - """Unique identifier of the output item""" output_index: int - """Index position of the item in the output list""" refusal: str - """Final complete refusal text""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.refusal.done"] - """Event type identifier, always "response.refusal.done" """ + type: Optional[Literal["response.refusal.done"]] = None class OpenAIResponseObjectStreamResponseOutputTextAnnotationAddedAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None class OpenAIResponseObjectStreamResponseOutputTextAnnotationAddedAnnotationOpenAIResponseAnnotationCitation(BaseModel): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + + type: Optional[Literal["url_citation"]] = None class OpenAIResponseObjectStreamResponseOutputTextAnnotationAddedAnnotationOpenAIResponseAnnotationContainerFileCitation( @@ -1490,7 +1246,7 @@ class OpenAIResponseObjectStreamResponseOutputTextAnnotationAddedAnnotationOpenA start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None class OpenAIResponseObjectStreamResponseOutputTextAnnotationAddedAnnotationOpenAIResponseAnnotationFilePath(BaseModel): @@ -1498,7 +1254,7 @@ class OpenAIResponseObjectStreamResponseOutputTextAnnotationAddedAnnotationOpenA index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None OpenAIResponseObjectStreamResponseOutputTextAnnotationAddedAnnotation: TypeAlias = Annotated[ @@ -1514,97 +1270,74 @@ class OpenAIResponseObjectStreamResponseOutputTextAnnotationAddedAnnotationOpenA class OpenAIResponseObjectStreamResponseOutputTextAnnotationAdded(BaseModel): annotation: OpenAIResponseObjectStreamResponseOutputTextAnnotationAddedAnnotation - """The annotation object being added""" + """File citation annotation for referencing specific files in response content.""" annotation_index: int - """Index of the annotation within the content part""" content_index: int - """Index position of the content part within the output item""" item_id: str - """Unique identifier of the item to which the annotation is being added""" output_index: int - """Index position of the output item in the response's output array""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.output_text.annotation.added"] - """Event type identifier, always "response.output_text.annotation.added" """ + type: Optional[Literal["response.output_text.annotation.added"]] = None class OpenAIResponseObjectStreamResponseFileSearchCallInProgress(BaseModel): item_id: str - """Unique identifier of the file search call""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.file_search_call.in_progress"] - """Event type identifier, always "response.file_search_call.in_progress" """ + type: Optional[Literal["response.file_search_call.in_progress"]] = None class OpenAIResponseObjectStreamResponseFileSearchCallSearching(BaseModel): item_id: str - """Unique identifier of the file search call""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.file_search_call.searching"] - """Event type identifier, always "response.file_search_call.searching" """ + type: Optional[Literal["response.file_search_call.searching"]] = None class OpenAIResponseObjectStreamResponseFileSearchCallCompleted(BaseModel): item_id: str - """Unique identifier of the completed file search call""" output_index: int - """Index position of the item in the output list""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.file_search_call.completed"] - """Event type identifier, always "response.file_search_call.completed" """ + type: Optional[Literal["response.file_search_call.completed"]] = None class OpenAIResponseObjectStreamResponseIncomplete(BaseModel): response: ResponseObject - """Response object describing the incomplete state""" + """Complete OpenAI response object containing generation results and metadata.""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.incomplete"] - """Event type identifier, always "response.incomplete" """ + type: Optional[Literal["response.incomplete"]] = None class OpenAIResponseObjectStreamResponseFailed(BaseModel): response: ResponseObject - """Response object describing the failure""" + """Complete OpenAI response object containing generation results and metadata.""" sequence_number: int - """Sequential number for ordering streaming events""" - type: Literal["response.failed"] - """Event type identifier, always "response.failed" """ + type: Optional[Literal["response.failed"]] = None class OpenAIResponseObjectStreamResponseCompleted(BaseModel): response: ResponseObject - """Completed response object""" + """Complete OpenAI response object containing generation results and metadata.""" - type: Literal["response.completed"] - """Event type identifier, always "response.completed" """ + type: Optional[Literal["response.completed"]] = None ResponseObjectStream: TypeAlias = Annotated[ diff --git a/src/llama_stack_client/types/responses/input_item_list_params.py b/src/llama_stack_client/types/responses/input_item_list_params.py index de4dd691..7345b163 100644 --- a/src/llama_stack_client/types/responses/input_item_list_params.py +++ b/src/llama_stack_client/types/responses/input_item_list_params.py @@ -8,6 +8,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Literal, TypedDict from ..._types import SequenceNotStr @@ -16,20 +17,13 @@ class InputItemListParams(TypedDict, total=False): - after: str - """An item ID to list items after, used for pagination.""" + after: Optional[str] - before: str - """An item ID to list items before, used for pagination.""" + before: Optional[str] - include: SequenceNotStr[str] - """Additional fields to include in the response.""" + include: Optional[SequenceNotStr[str]] - limit: int - """A limit on the number of objects to be returned. + limit: Optional[int] - Limit can range between 1 and 100, and the default is 20. - """ - - order: Literal["asc", "desc"] - """The order to return the input items in. Default is desc.""" + order: Optional[Literal["asc", "desc"]] + """Sort order for paginated responses.""" diff --git a/src/llama_stack_client/types/responses/input_item_list_response.py b/src/llama_stack_client/types/responses/input_item_list_response.py index 71a59f50..02addf1b 100644 --- a/src/llama_stack_client/types/responses/input_item_list_response.py +++ b/src/llama_stack_client/types/responses/input_item_list_response.py @@ -15,19 +15,19 @@ __all__ = [ "InputItemListResponse", "Data", - "DataOpenAIResponseMessage", - "DataOpenAIResponseMessageContentUnionMember1", - "DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText", - "DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage", - "DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile", - "DataOpenAIResponseMessageContentUnionMember2", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", - "DataOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal", + "DataOpenAIResponseMessageOutput", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath", + "DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal", "DataOpenAIResponseOutputMessageWebSearchToolCall", "DataOpenAIResponseOutputMessageFileSearchToolCall", "DataOpenAIResponseOutputMessageFileSearchToolCallResult", @@ -41,91 +41,77 @@ ] -class DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText(BaseModel): +class DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText( + BaseModel +): text: str - """The text content of the input message""" - type: Literal["input_text"] - """Content type identifier, always "input_text" """ + type: Optional[Literal["input_text"]] = None -class DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage(BaseModel): - detail: Literal["low", "high", "auto"] - """Level of detail for image processing, can be "low", "high", or "auto" """ - - type: Literal["input_image"] - """Content type identifier, always "input_image" """ +class DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage( + BaseModel +): + detail: Optional[Literal["low", "high", "auto"]] = None file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" image_url: Optional[str] = None - """(Optional) URL of the image content""" + type: Optional[Literal["input_image"]] = None -class DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile(BaseModel): - type: Literal["input_file"] - """The type of the input item. Always `input_file`.""" +class DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile( + BaseModel +): file_data: Optional[str] = None - """The data of the file to be sent to the model.""" file_id: Optional[str] = None - """(Optional) The ID of the file to be sent to the model.""" file_url: Optional[str] = None - """The URL of the file to be sent to the model.""" filename: Optional[str] = None - """The name of the file to be sent to the model.""" + + type: Optional[Literal["input_file"]] = None -DataOpenAIResponseMessageContentUnionMember1: TypeAlias = Annotated[ +DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile: TypeAlias = Annotated[ Union[ - DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentText, - DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentImage, - DataOpenAIResponseMessageContentUnionMember1OpenAIResponseInputMessageContentFile, + DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentText, + DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentImage, + DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFileOpenAIResponseInputMessageContentFile, ], PropertyInfo(discriminator="type"), ] -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation( BaseModel ): file_id: str - """Unique identifier of the referenced file""" filename: str - """Name of the referenced file""" index: int - """Position index of the citation within the content""" - type: Literal["file_citation"] - """Annotation type identifier, always "file_citation" """ + type: Optional[Literal["file_citation"]] = None -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation( BaseModel ): end_index: int - """End position of the citation span in the content""" start_index: int - """Start position of the citation span in the content""" title: str - """Title of the referenced web resource""" - - type: Literal["url_citation"] - """Annotation type identifier, always "url_citation" """ url: str - """URL of the referenced web resource""" + + type: Optional[Literal["url_citation"]] = None -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation( BaseModel ): container_id: str @@ -138,182 +124,159 @@ class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageCon start_index: int - type: Literal["container_file_citation"] + type: Optional[Literal["container_file_citation"]] = None -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath( BaseModel ): file_id: str index: int - type: Literal["file_path"] + type: Optional[Literal["file_path"]] = None -DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ +DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation: TypeAlias = Annotated[ Union[ - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFileCitation, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationCitation, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationContainerFileCitation, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotationOpenAIResponseAnnotationFilePath, ], PropertyInfo(discriminator="type"), ] -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText(BaseModel): - annotations: List[ - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputTextAnnotation - ] - +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText( + BaseModel +): text: str - type: Literal["output_text"] + annotations: Optional[ + List[ + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputTextAnnotation + ] + ] = None + + type: Optional[Literal["output_text"]] = None -class DataOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal(BaseModel): +class DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal( + BaseModel +): refusal: str - """Refusal text supplied by the model""" - type: Literal["refusal"] - """Content part type identifier, always "refusal" """ + type: Optional[Literal["refusal"]] = None -DataOpenAIResponseMessageContentUnionMember2: TypeAlias = Annotated[ +DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal: TypeAlias = Annotated[ Union[ - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseOutputMessageContentOutputText, - DataOpenAIResponseMessageContentUnionMember2OpenAIResponseContentPartRefusal, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseOutputMessageContentOutputText, + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusalOpenAIResponseContentPartRefusal, ], PropertyInfo(discriminator="type"), ] -class DataOpenAIResponseMessage(BaseModel): +class DataOpenAIResponseMessageOutput(BaseModel): content: Union[ - str, List[DataOpenAIResponseMessageContentUnionMember1], List[DataOpenAIResponseMessageContentUnionMember2] + str, + List[ + DataOpenAIResponseMessageOutputContentListOpenAIResponseInputMessageContentTextOpenAIResponseInputMessageContentImageOpenAIResponseInputMessageContentFile + ], + List[ + DataOpenAIResponseMessageOutputContentListOpenAIResponseOutputMessageContentOutputTextOpenAIResponseContentPartRefusal + ], ] role: Literal["system", "developer", "user", "assistant"] - type: Literal["message"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["message"]] = None + class DataOpenAIResponseOutputMessageWebSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" status: str - """Current status of the web search operation""" - type: Literal["web_search_call"] - """Tool call type identifier, always "web_search_call" """ + type: Optional[Literal["web_search_call"]] = None class DataOpenAIResponseOutputMessageFileSearchToolCallResult(BaseModel): - attributes: Dict[str, Union[bool, float, str, List[object], object, None]] - """(Optional) Key-value attributes associated with the file""" + attributes: Dict[str, object] file_id: str - """Unique identifier of the file containing the result""" filename: str - """Name of the file containing the result""" score: float - """Relevance score for this search result (between 0 and 1)""" text: str - """Text content of the search result""" class DataOpenAIResponseOutputMessageFileSearchToolCall(BaseModel): id: str - """Unique identifier for this tool call""" queries: List[str] - """List of search queries executed""" status: str - """Current status of the file search operation""" - - type: Literal["file_search_call"] - """Tool call type identifier, always "file_search_call" """ results: Optional[List[DataOpenAIResponseOutputMessageFileSearchToolCallResult]] = None - """(Optional) Search results returned by the file search operation""" + + type: Optional[Literal["file_search_call"]] = None class DataOpenAIResponseOutputMessageFunctionToolCall(BaseModel): arguments: str - """JSON string containing the function arguments""" call_id: str - """Unique identifier for the function call""" name: str - """Name of the function being called""" - - type: Literal["function_call"] - """Tool call type identifier, always "function_call" """ id: Optional[str] = None - """(Optional) Additional identifier for the tool call""" status: Optional[str] = None - """(Optional) Current status of the function call execution""" + + type: Optional[Literal["function_call"]] = None class DataOpenAIResponseOutputMessageMcpCall(BaseModel): id: str - """Unique identifier for this MCP call""" arguments: str - """JSON string containing the MCP call arguments""" name: str - """Name of the MCP method being called""" server_label: str - """Label identifying the MCP server handling the call""" - - type: Literal["mcp_call"] - """Tool call type identifier, always "mcp_call" """ error: Optional[str] = None - """(Optional) Error message if the MCP call failed""" output: Optional[str] = None - """(Optional) Output result from the successful MCP call""" + + type: Optional[Literal["mcp_call"]] = None class DataOpenAIResponseOutputMessageMcpListToolsTool(BaseModel): - input_schema: Dict[str, Union[bool, float, str, List[object], object, None]] - """JSON schema defining the tool's input parameters""" + input_schema: Dict[str, object] name: str - """Name of the tool""" description: Optional[str] = None - """(Optional) Description of what the tool does""" class DataOpenAIResponseOutputMessageMcpListTools(BaseModel): id: str - """Unique identifier for this MCP list tools operation""" server_label: str - """Label identifying the MCP server providing the tools""" tools: List[DataOpenAIResponseOutputMessageMcpListToolsTool] - """List of available tools provided by the MCP server""" - type: Literal["mcp_list_tools"] - """Tool call type identifier, always "mcp_list_tools" """ + type: Optional[Literal["mcp_list_tools"]] = None class DataOpenAIResponseMcpApprovalRequest(BaseModel): @@ -325,7 +288,7 @@ class DataOpenAIResponseMcpApprovalRequest(BaseModel): server_label: str - type: Literal["mcp_approval_request"] + type: Optional[Literal["mcp_approval_request"]] = None class DataOpenAIResponseInputFunctionToolCallOutput(BaseModel): @@ -333,27 +296,27 @@ class DataOpenAIResponseInputFunctionToolCallOutput(BaseModel): output: str - type: Literal["function_call_output"] - id: Optional[str] = None status: Optional[str] = None + type: Optional[Literal["function_call_output"]] = None + class DataOpenAIResponseMcpApprovalResponse(BaseModel): approval_request_id: str approve: bool - type: Literal["mcp_approval_response"] - id: Optional[str] = None reason: Optional[str] = None + type: Optional[Literal["mcp_approval_response"]] = None + Data: TypeAlias = Union[ - DataOpenAIResponseMessage, + DataOpenAIResponseMessageOutput, DataOpenAIResponseOutputMessageWebSearchToolCall, DataOpenAIResponseOutputMessageFileSearchToolCall, DataOpenAIResponseOutputMessageFunctionToolCall, @@ -362,13 +325,11 @@ class DataOpenAIResponseMcpApprovalResponse(BaseModel): DataOpenAIResponseMcpApprovalRequest, DataOpenAIResponseInputFunctionToolCallOutput, DataOpenAIResponseMcpApprovalResponse, - DataOpenAIResponseMessage, + DataOpenAIResponseMessageOutput, ] class InputItemListResponse(BaseModel): data: List[Data] - """List of input items""" - object: Literal["list"] - """Object type identifier, always "list" """ + object: Optional[Literal["list"]] = None diff --git a/src/llama_stack_client/types/route_info.py b/src/llama_stack_client/types/route_info.py index a78151d9..4ecaa2e5 100644 --- a/src/llama_stack_client/types/route_info.py +++ b/src/llama_stack_client/types/route_info.py @@ -15,10 +15,7 @@ class RouteInfo(BaseModel): method: str - """HTTP method for the route""" provider_types: List[str] - """List of provider types that implement this route""" route: str - """The API endpoint path""" diff --git a/src/llama_stack_client/types/route_list_params.py b/src/llama_stack_client/types/route_list_params.py index 443b1d59..657e128c 100644 --- a/src/llama_stack_client/types/route_list_params.py +++ b/src/llama_stack_client/types/route_list_params.py @@ -2,16 +2,11 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Literal, TypedDict __all__ = ["RouteListParams"] class RouteListParams(TypedDict, total=False): - api_filter: Literal["v1", "v1alpha", "v1beta", "deprecated"] - """Optional filter to control which routes are returned. - - Can be an API level ('v1', 'v1alpha', 'v1beta') to show non-deprecated routes at - that level, or 'deprecated' to show deprecated routes across all levels. If not - specified, returns all non-deprecated routes. - """ + api_filter: Optional[Literal["v1", "v1alpha", "v1beta", "deprecated"]] diff --git a/src/llama_stack_client/types/run_shield_response.py b/src/llama_stack_client/types/run_shield_response.py index fd51a10c..5306993a 100644 --- a/src/llama_stack_client/types/run_shield_response.py +++ b/src/llama_stack_client/types/run_shield_response.py @@ -16,4 +16,4 @@ class RunShieldResponse(BaseModel): violation: Optional[SafetyViolation] = None - """(Optional) Safety violation detected by the shield, if any""" + """Details of a safety violation detected by content moderation.""" diff --git a/src/llama_stack_client/types/safety_run_shield_params.py b/src/llama_stack_client/types/safety_run_shield_params.py index 3ee72883..eb0ac7ae 100644 --- a/src/llama_stack_client/types/safety_run_shield_params.py +++ b/src/llama_stack_client/types/safety_run_shield_params.py @@ -8,216 +8,198 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Iterable, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ "SafetyRunShieldParams", "Message", - "MessageOpenAIUserMessageParam", - "MessageOpenAIUserMessageParamContentUnionMember1", - "MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam", - "MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam", - "MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL", - "MessageOpenAIUserMessageParamContentUnionMember1OpenAIFile", - "MessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile", + "MessageOpenAIUserMessageParamInput", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile", + "MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile", "MessageOpenAISystemMessageParam", - "MessageOpenAISystemMessageParamContentUnionMember1", - "MessageOpenAIAssistantMessageParam", - "MessageOpenAIAssistantMessageParamContentUnionMember1", - "MessageOpenAIAssistantMessageParamToolCall", - "MessageOpenAIAssistantMessageParamToolCallFunction", + "MessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam", + "MessageOpenAIAssistantMessageParamInput", + "MessageOpenAIAssistantMessageParamInputContentListOpenAIChatCompletionContentPartTextParam", + "MessageOpenAIAssistantMessageParamInputToolCall", + "MessageOpenAIAssistantMessageParamInputToolCallFunction", "MessageOpenAIToolMessageParam", - "MessageOpenAIToolMessageParamContentUnionMember1", + "MessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam", "MessageOpenAIDeveloperMessageParam", - "MessageOpenAIDeveloperMessageParamContentUnionMember1", + "MessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam", ] class SafetyRunShieldParams(TypedDict, total=False): messages: Required[Iterable[Message]] - """The messages to run the shield on.""" - params: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """The parameters of the shield.""" + params: Required[Dict[str, object]] shield_id: Required[str] - """The identifier of the shield to run.""" -class MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam(TypedDict, total=False): +class MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam( + TypedDict, total=False +): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] -class MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL( +class MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL( TypedDict, total=False ): url: Required[str] - """URL of the image to include in the message""" - - detail: str - """(Optional) Level of detail for image processing. - Can be "low", "high", or "auto" - """ + detail: Optional[str] -class MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam(TypedDict, total=False): +class MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam( + TypedDict, total=False +): image_url: Required[ - MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParamImageURL + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParamImageURL ] - """Image URL specification and processing details""" + """Image URL specification for OpenAI-compatible chat completion messages.""" - type: Required[Literal["image_url"]] - """Must be "image_url" to identify this as image content""" + type: Literal["image_url"] -class MessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile(TypedDict, total=False): - file_data: str +class MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile( + TypedDict, total=False +): + file_data: Optional[str] - file_id: str + file_id: Optional[str] - filename: str + filename: Optional[str] -class MessageOpenAIUserMessageParamContentUnionMember1OpenAIFile(TypedDict, total=False): - file: Required[MessageOpenAIUserMessageParamContentUnionMember1OpenAIFileFile] +class MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile( + TypedDict, total=False +): + file: Required[ + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFileFile + ] - type: Required[Literal["file"]] + type: Literal["file"] -MessageOpenAIUserMessageParamContentUnionMember1: TypeAlias = Union[ - MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartTextParam, - MessageOpenAIUserMessageParamContentUnionMember1OpenAIChatCompletionContentPartImageParam, - MessageOpenAIUserMessageParamContentUnionMember1OpenAIFile, +MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile: TypeAlias = Union[ + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartTextParam, + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIChatCompletionContentPartImageParam, + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFileOpenAIFile, ] -class MessageOpenAIUserMessageParam(TypedDict, total=False): - content: Required[Union[str, Iterable[MessageOpenAIUserMessageParamContentUnionMember1]]] - """The content of the message, which can include text and other media""" +class MessageOpenAIUserMessageParamInput(TypedDict, total=False): + content: Required[ + Union[ + str, + Iterable[ + MessageOpenAIUserMessageParamInputContentListOpenAIChatCompletionContentPartTextParamOpenAIChatCompletionContentPartImageParamOpenAIFile + ], + ] + ] - role: Required[Literal["user"]] - """Must be "user" to identify this as a user message""" + name: Optional[str] - name: str - """(Optional) The name of the user message participant.""" + role: Literal["user"] -class MessageOpenAISystemMessageParamContentUnionMember1(TypedDict, total=False): +class MessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam(TypedDict, total=False): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] class MessageOpenAISystemMessageParam(TypedDict, total=False): - content: Required[Union[str, Iterable[MessageOpenAISystemMessageParamContentUnionMember1]]] - """The content of the "system prompt". - - If multiple system messages are provided, they are concatenated. The underlying - Llama Stack code may also add other system messages (for example, for formatting - tool definitions). - """ + content: Required[ + Union[str, Iterable[MessageOpenAISystemMessageParamContentListOpenAIChatCompletionContentPartTextParam]] + ] - role: Required[Literal["system"]] - """Must be "system" to identify this as a system message""" + name: Optional[str] - name: str - """(Optional) The name of the system message participant.""" + role: Literal["system"] -class MessageOpenAIAssistantMessageParamContentUnionMember1(TypedDict, total=False): +class MessageOpenAIAssistantMessageParamInputContentListOpenAIChatCompletionContentPartTextParam( + TypedDict, total=False +): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] -class MessageOpenAIAssistantMessageParamToolCallFunction(TypedDict, total=False): - arguments: str - """(Optional) Arguments to pass to the function as a JSON string""" +class MessageOpenAIAssistantMessageParamInputToolCallFunction(TypedDict, total=False): + arguments: Optional[str] - name: str - """(Optional) Name of the function to call""" + name: Optional[str] -class MessageOpenAIAssistantMessageParamToolCall(TypedDict, total=False): - type: Required[Literal["function"]] - """Must be "function" to identify this as a function call""" +class MessageOpenAIAssistantMessageParamInputToolCall(TypedDict, total=False): + id: Optional[str] - id: str - """(Optional) Unique identifier for the tool call""" + function: Optional[MessageOpenAIAssistantMessageParamInputToolCallFunction] + """Function call details for OpenAI-compatible tool calls.""" - function: MessageOpenAIAssistantMessageParamToolCallFunction - """(Optional) Function call details""" + index: Optional[int] - index: int - """(Optional) Index of the tool call in the list""" + type: Literal["function"] -class MessageOpenAIAssistantMessageParam(TypedDict, total=False): - role: Required[Literal["assistant"]] - """Must be "assistant" to identify this as the model's response""" +class MessageOpenAIAssistantMessageParamInput(TypedDict, total=False): + content: Union[ + str, Iterable[MessageOpenAIAssistantMessageParamInputContentListOpenAIChatCompletionContentPartTextParam], None + ] - content: Union[str, Iterable[MessageOpenAIAssistantMessageParamContentUnionMember1]] - """The content of the model's response""" + name: Optional[str] - name: str - """(Optional) The name of the assistant message participant.""" + role: Literal["assistant"] - tool_calls: Iterable[MessageOpenAIAssistantMessageParamToolCall] - """List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.""" + tool_calls: Optional[Iterable[MessageOpenAIAssistantMessageParamInputToolCall]] -class MessageOpenAIToolMessageParamContentUnionMember1(TypedDict, total=False): +class MessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam(TypedDict, total=False): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] class MessageOpenAIToolMessageParam(TypedDict, total=False): - content: Required[Union[str, Iterable[MessageOpenAIToolMessageParamContentUnionMember1]]] - """The response content from the tool""" - - role: Required[Literal["tool"]] - """Must be "tool" to identify this as a tool response""" + content: Required[ + Union[str, Iterable[MessageOpenAIToolMessageParamContentListOpenAIChatCompletionContentPartTextParam]] + ] tool_call_id: Required[str] - """Unique identifier for the tool call this response is for""" + role: Literal["tool"] -class MessageOpenAIDeveloperMessageParamContentUnionMember1(TypedDict, total=False): + +class MessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam(TypedDict, total=False): text: Required[str] - """The text content of the message""" - type: Required[Literal["text"]] - """Must be "text" to identify this as text content""" + type: Literal["text"] class MessageOpenAIDeveloperMessageParam(TypedDict, total=False): - content: Required[Union[str, Iterable[MessageOpenAIDeveloperMessageParamContentUnionMember1]]] - """The content of the developer message""" + content: Required[ + Union[str, Iterable[MessageOpenAIDeveloperMessageParamContentListOpenAIChatCompletionContentPartTextParam]] + ] - role: Required[Literal["developer"]] - """Must be "developer" to identify this as a developer message""" + name: Optional[str] - name: str - """(Optional) The name of the developer message participant.""" + role: Literal["developer"] Message: TypeAlias = Union[ - MessageOpenAIUserMessageParam, + MessageOpenAIUserMessageParamInput, MessageOpenAISystemMessageParam, - MessageOpenAIAssistantMessageParam, + MessageOpenAIAssistantMessageParamInput, MessageOpenAIToolMessageParam, MessageOpenAIDeveloperMessageParam, ] diff --git a/src/llama_stack_client/types/scoring_fn.py b/src/llama_stack_client/types/scoring_fn.py index 7b96d2b0..4e77e331 100644 --- a/src/llama_stack_client/types/scoring_fn.py +++ b/src/llama_stack_client/types/scoring_fn.py @@ -7,12 +7,19 @@ # 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 typing_extensions import Literal, Annotated, TypeAlias +from .._utils import PropertyInfo from .._models import BaseModel -from .scoring_fn_params import ScoringFnParams -__all__ = ["ScoringFn", "ReturnType"] +__all__ = [ + "ScoringFn", + "ReturnType", + "Params", + "ParamsLlmAsJudgeScoringFnParams", + "ParamsRegexParserScoringFnParams", + "ParamsBasicScoringFnParams", +] class ReturnType(BaseModel): @@ -30,21 +37,70 @@ class ReturnType(BaseModel): ] +class ParamsLlmAsJudgeScoringFnParams(BaseModel): + judge_model: str + + aggregation_functions: Optional[ + List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + ] = None + """Aggregation functions to apply to the scores of each row""" + + judge_score_regexes: Optional[List[str]] = None + """Regexes to extract the answer from generated response""" + + prompt_template: Optional[str] = None + + type: Optional[Literal["llm_as_judge"]] = None + + +class ParamsRegexParserScoringFnParams(BaseModel): + aggregation_functions: Optional[ + List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + ] = None + """Aggregation functions to apply to the scores of each row""" + + parsing_regexes: Optional[List[str]] = None + """Regex to extract the answer from generated response""" + + type: Optional[Literal["regex_parser"]] = None + + +class ParamsBasicScoringFnParams(BaseModel): + aggregation_functions: Optional[ + List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + ] = None + """Aggregation functions to apply to the scores of each row""" + + type: Optional[Literal["basic"]] = None + + +Params: TypeAlias = Annotated[ + Union[ParamsLlmAsJudgeScoringFnParams, ParamsRegexParserScoringFnParams, ParamsBasicScoringFnParams, None], + PropertyInfo(discriminator="type"), +] + + class ScoringFn(BaseModel): identifier: str - - metadata: Dict[str, Union[bool, float, str, List[object], object, None]] + """Unique identifier for this resource in llama stack""" provider_id: str + """ID of the provider that owns this resource""" return_type: ReturnType - type: Literal["scoring_function"] - """The resource type, always scoring_function""" - description: Optional[str] = None - params: Optional[ScoringFnParams] = None - """Parameters for LLM-as-judge scoring function configuration.""" + metadata: Optional[Dict[str, object]] = None + """Any additional metadata for this definition""" + + params: Optional[Params] = None + """ + The parameters for the scoring function for benchmark eval, these can be + overridden for app eval + """ provider_resource_id: Optional[str] = None + """Unique identifier for this resource in the provider""" + + type: Optional[Literal["scoring_function"]] = None 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 bf58bc33..8780fc15 100644 --- a/src/llama_stack_client/types/scoring_function_register_params.py +++ b/src/llama_stack_client/types/scoring_function_register_params.py @@ -2,47 +2,20 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing_extensions import Required, TypedDict -from .scoring_fn_params_param import ScoringFnParamsParam - -__all__ = ["ScoringFunctionRegisterParams", "ReturnType"] +__all__ = ["ScoringFunctionRegisterParams"] class ScoringFunctionRegisterParams(TypedDict, total=False): - description: Required[str] - """The description of the scoring function.""" - - return_type: Required[ReturnType] - - scoring_fn_id: Required[str] - """The ID of the scoring function to register.""" - - params: ScoringFnParamsParam - """ - The parameters for the scoring function for benchmark eval, these can be - overridden for app eval. - """ - - provider_id: str - """The ID of the provider to use for the scoring function.""" - - provider_scoring_fn_id: str - """The ID of the provider scoring function to use for the scoring function.""" - - -class ReturnType(TypedDict, total=False): - type: Required[ - Literal[ - "string", - "number", - "boolean", - "array", - "object", - "json", - "union", - "chat_completion_input", - "completion_input", - "agent_turn_input", - ] - ] + description: Required[object] + + return_type: Required[object] + + scoring_fn_id: Required[object] + + params: object + + provider_id: object + + provider_scoring_fn_id: object 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 546011c5..b8d258c8 100644 --- a/src/llama_stack_client/types/scoring_score_batch_params.py +++ b/src/llama_stack_client/types/scoring_score_batch_params.py @@ -8,20 +8,61 @@ from __future__ import annotations -from typing import Dict, Optional -from typing_extensions import Required, TypedDict +from typing import Dict, List, Union, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .scoring_fn_params_param import ScoringFnParamsParam +from .._types import SequenceNotStr -__all__ = ["ScoringScoreBatchParams"] +__all__ = [ + "ScoringScoreBatchParams", + "ScoringFunctions", + "ScoringFunctionsLlmAsJudgeScoringFnParams", + "ScoringFunctionsRegexParserScoringFnParams", + "ScoringFunctionsBasicScoringFnParams", +] class ScoringScoreBatchParams(TypedDict, total=False): dataset_id: Required[str] - """The ID of the dataset to score.""" - save_results_dataset: Required[bool] - """Whether to save the results to a dataset.""" + scoring_functions: Required[Dict[str, Optional[ScoringFunctions]]] - scoring_functions: Required[Dict[str, Optional[ScoringFnParamsParam]]] - """The scoring functions to use for the scoring.""" + save_results_dataset: bool + + +class ScoringFunctionsLlmAsJudgeScoringFnParams(TypedDict, total=False): + judge_model: Required[str] + + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + judge_score_regexes: SequenceNotStr[str] + """Regexes to extract the answer from generated response""" + + prompt_template: Optional[str] + + type: Literal["llm_as_judge"] + + +class ScoringFunctionsRegexParserScoringFnParams(TypedDict, total=False): + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + parsing_regexes: SequenceNotStr[str] + """Regex to extract the answer from generated response""" + + type: Literal["regex_parser"] + + +class ScoringFunctionsBasicScoringFnParams(TypedDict, total=False): + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + type: Literal["basic"] + + +ScoringFunctions: TypeAlias = Union[ + ScoringFunctionsLlmAsJudgeScoringFnParams, + ScoringFunctionsRegexParserScoringFnParams, + ScoringFunctionsBasicScoringFnParams, +] diff --git a/src/llama_stack_client/types/scoring_score_batch_response.py b/src/llama_stack_client/types/scoring_score_batch_response.py index e3e84a9d..ea46721b 100644 --- a/src/llama_stack_client/types/scoring_score_batch_response.py +++ b/src/llama_stack_client/types/scoring_score_batch_response.py @@ -16,7 +16,5 @@ class ScoringScoreBatchResponse(BaseModel): results: Dict[str, ScoringResult] - """A map of scoring function name to ScoringResult""" dataset_id: Optional[str] = None - """(Optional) The identifier of the dataset that was scored""" diff --git a/src/llama_stack_client/types/scoring_score_params.py b/src/llama_stack_client/types/scoring_score_params.py index c141fb4e..407c8bba 100644 --- a/src/llama_stack_client/types/scoring_score_params.py +++ b/src/llama_stack_client/types/scoring_score_params.py @@ -8,17 +8,59 @@ from __future__ import annotations -from typing import Dict, Union, Iterable, Optional -from typing_extensions import Required, TypedDict +from typing import Dict, List, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .scoring_fn_params_param import ScoringFnParamsParam +from .._types import SequenceNotStr -__all__ = ["ScoringScoreParams"] +__all__ = [ + "ScoringScoreParams", + "ScoringFunctions", + "ScoringFunctionsLlmAsJudgeScoringFnParams", + "ScoringFunctionsRegexParserScoringFnParams", + "ScoringFunctionsBasicScoringFnParams", +] class ScoringScoreParams(TypedDict, total=False): - input_rows: Required[Iterable[Dict[str, Union[bool, float, str, Iterable[object], object, None]]]] - """The rows to score.""" + input_rows: Required[Iterable[Dict[str, object]]] - scoring_functions: Required[Dict[str, Optional[ScoringFnParamsParam]]] - """The scoring functions to use for the scoring.""" + scoring_functions: Required[Dict[str, Optional[ScoringFunctions]]] + + +class ScoringFunctionsLlmAsJudgeScoringFnParams(TypedDict, total=False): + judge_model: Required[str] + + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + judge_score_regexes: SequenceNotStr[str] + """Regexes to extract the answer from generated response""" + + prompt_template: Optional[str] + + type: Literal["llm_as_judge"] + + +class ScoringFunctionsRegexParserScoringFnParams(TypedDict, total=False): + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + parsing_regexes: SequenceNotStr[str] + """Regex to extract the answer from generated response""" + + type: Literal["regex_parser"] + + +class ScoringFunctionsBasicScoringFnParams(TypedDict, total=False): + aggregation_functions: List[Literal["average", "weighted_average", "median", "categorical_count", "accuracy"]] + """Aggregation functions to apply to the scores of each row""" + + type: Literal["basic"] + + +ScoringFunctions: TypeAlias = Union[ + ScoringFunctionsLlmAsJudgeScoringFnParams, + ScoringFunctionsRegexParserScoringFnParams, + ScoringFunctionsBasicScoringFnParams, +] diff --git a/src/llama_stack_client/types/scoring_score_response.py b/src/llama_stack_client/types/scoring_score_response.py index 478e9fb5..27d7e2e1 100644 --- a/src/llama_stack_client/types/scoring_score_response.py +++ b/src/llama_stack_client/types/scoring_score_response.py @@ -16,4 +16,3 @@ class ScoringScoreResponse(BaseModel): results: Dict[str, ScoringResult] - """A map of scoring function name to ScoringResult.""" diff --git a/src/llama_stack_client/types/shared/interleaved_content.py b/src/llama_stack_client/types/shared/interleaved_content.py index d0a087ad..f5a6a7ee 100644 --- a/src/llama_stack_client/types/shared/interleaved_content.py +++ b/src/llama_stack_client/types/shared/interleaved_content.py @@ -7,10 +7,10 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import List, Union, Optional -from typing_extensions import Literal, TypeAlias +from typing_extensions import Literal, Annotated, TypeAlias +from ..._utils import PropertyInfo from ..._models import BaseModel -from .interleaved_content_item import InterleavedContentItem __all__ = [ "InterleavedContent", @@ -18,39 +18,65 @@ "ImageContentItemImage", "ImageContentItemImageURL", "TextContentItem", + "ListImageContentItemTextContentItem", + "ListImageContentItemTextContentItemImageContentItem", + "ListImageContentItemTextContentItemImageContentItemImage", + "ListImageContentItemTextContentItemImageContentItemImageURL", + "ListImageContentItemTextContentItemTextContentItem", ] class ImageContentItemImageURL(BaseModel): uri: str - """The URL string pointing to the resource""" class ImageContentItemImage(BaseModel): data: Optional[str] = None - """base64 encoded image data as string""" url: Optional[ImageContentItemImageURL] = 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. - """ + """A URL reference to external content.""" class ImageContentItem(BaseModel): image: ImageContentItemImage - """Image as a base64 encoded string or an URL""" + """A URL or a base64 encoded string""" - type: Literal["image"] - """Discriminator type of the content item. Always "image" """ + type: Optional[Literal["image"]] = None class TextContentItem(BaseModel): text: str - """Text content""" - type: Literal["text"] - """Discriminator type of the content item. Always "text" """ + type: Optional[Literal["text"]] = None + + +class ListImageContentItemTextContentItemImageContentItemImageURL(BaseModel): + uri: str + + +class ListImageContentItemTextContentItemImageContentItemImage(BaseModel): + data: Optional[str] = None + + url: Optional[ListImageContentItemTextContentItemImageContentItemImageURL] = None + """A URL reference to external content.""" + +class ListImageContentItemTextContentItemImageContentItem(BaseModel): + image: ListImageContentItemTextContentItemImageContentItemImage + """A URL or a base64 encoded string""" + + type: Optional[Literal["image"]] = None + + +class ListImageContentItemTextContentItemTextContentItem(BaseModel): + text: str + + type: Optional[Literal["text"]] = None + + +ListImageContentItemTextContentItem: TypeAlias = Annotated[ + Union[ListImageContentItemTextContentItemImageContentItem, ListImageContentItemTextContentItemTextContentItem], + PropertyInfo(discriminator="type"), +] -InterleavedContent: TypeAlias = Union[str, ImageContentItem, TextContentItem, List[InterleavedContentItem]] +InterleavedContent: TypeAlias = Union[str, ImageContentItem, TextContentItem, List[ListImageContentItemTextContentItem]] 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 85e5d758..a841f5f1 100644 --- a/src/llama_stack_client/types/shared/interleaved_content_item.py +++ b/src/llama_stack_client/types/shared/interleaved_content_item.py @@ -23,34 +23,26 @@ class ImageContentItemImageURL(BaseModel): uri: str - """The URL string pointing to the resource""" class ImageContentItemImage(BaseModel): data: Optional[str] = None - """base64 encoded image data as string""" url: Optional[ImageContentItemImageURL] = 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. - """ + """A URL reference to external content.""" class ImageContentItem(BaseModel): image: ImageContentItemImage - """Image as a base64 encoded string or an URL""" + """A URL or a base64 encoded string""" - type: Literal["image"] - """Discriminator type of the content item. Always "image" """ + type: Optional[Literal["image"]] = None class TextContentItem(BaseModel): text: str - """Text content""" - type: Literal["text"] - """Discriminator type of the content item. Always "text" """ + type: Optional[Literal["text"]] = None InterleavedContentItem: TypeAlias = Annotated[ diff --git a/src/llama_stack_client/types/shared/param_type.py b/src/llama_stack_client/types/shared/param_type.py index a45a31db..6b00b99b 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. -from typing import Union +from typing import Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from ..._utils import PropertyInfo @@ -21,48 +21,39 @@ class StringType(BaseModel): - type: Literal["string"] - """Discriminator type. Always "string" """ + type: Optional[Literal["string"]] = None class NumberType(BaseModel): - type: Literal["number"] - """Discriminator type. Always "number" """ + type: Optional[Literal["number"]] = None class BooleanType(BaseModel): - type: Literal["boolean"] - """Discriminator type. Always "boolean" """ + type: Optional[Literal["boolean"]] = None class ArrayType(BaseModel): - type: Literal["array"] - """Discriminator type. Always "array" """ + type: Optional[Literal["array"]] = None class ObjectType(BaseModel): - type: Literal["object"] - """Discriminator type. Always "object" """ + type: Optional[Literal["object"]] = None class JsonType(BaseModel): - type: Literal["json"] - """Discriminator type. Always "json" """ + type: Optional[Literal["json"]] = None class UnionType(BaseModel): - type: Literal["union"] - """Discriminator type. Always "union" """ + type: Optional[Literal["union"]] = None class ChatCompletionInputType(BaseModel): - type: Literal["chat_completion_input"] - """Discriminator type. Always "chat_completion_input" """ + type: Optional[Literal["chat_completion_input"]] = None class CompletionInputType(BaseModel): - type: Literal["completion_input"] - """Discriminator type. Always "completion_input" """ + type: Optional[Literal["completion_input"]] = None ParamType: TypeAlias = Annotated[ diff --git a/src/llama_stack_client/types/shared/safety_violation.py b/src/llama_stack_client/types/shared/safety_violation.py index dc18d9bf..a8797bf7 100644 --- a/src/llama_stack_client/types/shared/safety_violation.py +++ b/src/llama_stack_client/types/shared/safety_violation.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, Optional from typing_extensions import Literal from ..._models import BaseModel @@ -15,14 +15,9 @@ class SafetyViolation(BaseModel): - metadata: Dict[str, Union[bool, float, str, List[object], object, None]] - """ - Additional metadata including specific violation codes for debugging and - telemetry - """ - violation_level: Literal["info", "warn", "error"] - """Severity level of the violation""" + """Severity level of a safety violation.""" + + metadata: Optional[Dict[str, object]] = None user_message: Optional[str] = None - """(Optional) Message to convey to the user about the violation""" diff --git a/src/llama_stack_client/types/shared/sampling_params.py b/src/llama_stack_client/types/shared/sampling_params.py index f34ed6f5..fbe697c5 100644 --- a/src/llama_stack_client/types/shared/sampling_params.py +++ b/src/llama_stack_client/types/shared/sampling_params.py @@ -22,27 +22,21 @@ class StrategyGreedySamplingStrategy(BaseModel): - type: Literal["greedy"] - """Must be "greedy" to identify this sampling strategy""" + type: Optional[Literal["greedy"]] = None class StrategyTopPSamplingStrategy(BaseModel): - type: Literal["top_p"] - """Must be "top_p" to identify this sampling strategy""" - temperature: Optional[float] = None - """Controls randomness in sampling. Higher values increase randomness""" top_p: Optional[float] = None - """Cumulative probability threshold for nucleus sampling. Defaults to 0.95""" + + type: Optional[Literal["top_p"]] = None class StrategyTopKSamplingStrategy(BaseModel): top_k: int - """Number of top tokens to consider for sampling. Must be at least 1""" - type: Literal["top_k"] - """Must be "top_k" to identify this sampling strategy""" + type: Optional[Literal["top_k"]] = None Strategy: TypeAlias = Annotated[ @@ -52,25 +46,14 @@ class StrategyTopKSamplingStrategy(BaseModel): class SamplingParams(BaseModel): - strategy: Strategy - """The sampling strategy.""" - max_tokens: Optional[int] = None - """The maximum number of tokens that can be generated in the completion. - - The token count of your prompt plus max_tokens cannot exceed the model's context - length. - """ repetition_penalty: Optional[float] = None - """Number between -2.0 and 2.0. - - Positive values penalize new tokens based on whether they appear in the text so - far, increasing the model's likelihood to talk about new topics. - """ stop: Optional[List[str]] = None - """Up to 4 sequences where the API will stop generating further tokens. - The returned text will not contain the stop sequence. + strategy: Optional[Strategy] = None + """ + Greedy sampling strategy that selects the highest probability token at each + step. """ diff --git a/src/llama_stack_client/types/shared/scoring_result.py b/src/llama_stack_client/types/shared/scoring_result.py index 68788ca2..4343e36c 100644 --- a/src/llama_stack_client/types/shared/scoring_result.py +++ b/src/llama_stack_client/types/shared/scoring_result.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union +from typing import Dict, List from ..._models import BaseModel @@ -14,8 +14,6 @@ class ScoringResult(BaseModel): - aggregated_results: Dict[str, Union[bool, float, str, List[object], object, None]] - """Map of metric name to aggregated value""" + aggregated_results: Dict[str, object] - score_rows: List[Dict[str, Union[bool, float, str, List[object], object, None]]] - """The scoring result for each row. Each row is a map of column name to value.""" + score_rows: List[Dict[str, object]] diff --git a/src/llama_stack_client/types/shared/system_message.py b/src/llama_stack_client/types/shared/system_message.py index 03c2d3d4..2d5b8cef 100644 --- a/src/llama_stack_client/types/shared/system_message.py +++ b/src/llama_stack_client/types/shared/system_message.py @@ -6,22 +6,90 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing_extensions import Literal +from typing import List, Union, Optional +from typing_extensions import Literal, Annotated, TypeAlias +from ..._utils import PropertyInfo from ..._models import BaseModel -from .interleaved_content import InterleavedContent -__all__ = ["SystemMessage"] +__all__ = [ + "SystemMessage", + "Content", + "ContentImageContentItemInput", + "ContentImageContentItemInputImage", + "ContentImageContentItemInputImageURL", + "ContentTextContentItem", + "ContentListImageContentItemInputTextContentItem", + "ContentListImageContentItemInputTextContentItemImageContentItemInput", + "ContentListImageContentItemInputTextContentItemImageContentItemInputImage", + "ContentListImageContentItemInputTextContentItemImageContentItemInputImageURL", + "ContentListImageContentItemInputTextContentItemTextContentItem", +] -class SystemMessage(BaseModel): - content: InterleavedContent - """The content of the "system prompt". +class ContentImageContentItemInputImageURL(BaseModel): + uri: str + + +class ContentImageContentItemInputImage(BaseModel): + data: Optional[str] = None + + url: Optional[ContentImageContentItemInputImageURL] = None + """A URL reference to external content.""" + + +class ContentImageContentItemInput(BaseModel): + image: ContentImageContentItemInputImage + """A URL or a base64 encoded string""" + + type: Optional[Literal["image"]] = None + + +class ContentTextContentItem(BaseModel): + text: str + + type: Optional[Literal["text"]] = None + + +class ContentListImageContentItemInputTextContentItemImageContentItemInputImageURL(BaseModel): + uri: str + - If multiple system messages are provided, they are concatenated. The underlying - Llama Stack code may also add other system messages (for example, for formatting - tool definitions). - """ +class ContentListImageContentItemInputTextContentItemImageContentItemInputImage(BaseModel): + data: Optional[str] = None + + url: Optional[ContentListImageContentItemInputTextContentItemImageContentItemInputImageURL] = None + """A URL reference to external content.""" + + +class ContentListImageContentItemInputTextContentItemImageContentItemInput(BaseModel): + image: ContentListImageContentItemInputTextContentItemImageContentItemInputImage + """A URL or a base64 encoded string""" + + type: Optional[Literal["image"]] = None + + +class ContentListImageContentItemInputTextContentItemTextContentItem(BaseModel): + text: str + + type: Optional[Literal["text"]] = None + + +ContentListImageContentItemInputTextContentItem: TypeAlias = Annotated[ + Union[ + ContentListImageContentItemInputTextContentItemImageContentItemInput, + ContentListImageContentItemInputTextContentItemTextContentItem, + ], + PropertyInfo(discriminator="type"), +] + +Content: TypeAlias = Union[ + str, ContentImageContentItemInput, ContentTextContentItem, List[ContentListImageContentItemInputTextContentItem] +] + + +class SystemMessage(BaseModel): + content: Content + """A image content item""" - role: Literal["system"] - """Must be "system" to identify this as a system message""" + role: Optional[Literal["system"]] = None diff --git a/src/llama_stack_client/types/shared_params/__init__.py b/src/llama_stack_client/types/shared_params/__init__.py index 97d63fb6..3cc535a5 100644 --- a/src/llama_stack_client/types/shared_params/__init__.py +++ b/src/llama_stack_client/types/shared_params/__init__.py @@ -8,5 +8,3 @@ from .system_message import SystemMessage as SystemMessage from .sampling_params import SamplingParams as SamplingParams -from .interleaved_content import InterleavedContent as InterleavedContent -from .interleaved_content_item import InterleavedContentItem as InterleavedContentItem diff --git a/src/llama_stack_client/types/shared_params/interleaved_content.py b/src/llama_stack_client/types/shared_params/interleaved_content.py deleted file mode 100644 index 855e23a7..00000000 --- a/src/llama_stack_client/types/shared_params/interleaved_content.py +++ /dev/null @@ -1,57 +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, TypeAlias, TypedDict - -from .interleaved_content_item import InterleavedContentItem - -__all__ = [ - "InterleavedContent", - "ImageContentItem", - "ImageContentItemImage", - "ImageContentItemImageURL", - "TextContentItem", -] - - -class ImageContentItemImageURL(TypedDict, total=False): - uri: Required[str] - """The URL string pointing to the resource""" - - -class ImageContentItemImage(TypedDict, total=False): - data: str - """base64 encoded image data as string""" - - url: ImageContentItemImageURL - """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 ImageContentItem(TypedDict, total=False): - image: Required[ImageContentItemImage] - """Image as a base64 encoded string or an URL""" - - type: Required[Literal["image"]] - """Discriminator type of the content item. Always "image" """ - - -class TextContentItem(TypedDict, total=False): - text: Required[str] - """Text content""" - - type: Required[Literal["text"]] - """Discriminator type of the content item. Always "text" """ - - -InterleavedContent: TypeAlias = Union[str, ImageContentItem, TextContentItem, Iterable[InterleavedContentItem]] 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 deleted file mode 100644 index 79c2c09f..00000000 --- a/src/llama_stack_client/types/shared_params/interleaved_content_item.py +++ /dev/null @@ -1,55 +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 -from typing_extensions import Literal, Required, TypeAlias, TypedDict - -__all__ = [ - "InterleavedContentItem", - "ImageContentItem", - "ImageContentItemImage", - "ImageContentItemImageURL", - "TextContentItem", -] - - -class ImageContentItemImageURL(TypedDict, total=False): - uri: Required[str] - """The URL string pointing to the resource""" - - -class ImageContentItemImage(TypedDict, total=False): - data: str - """base64 encoded image data as string""" - - url: ImageContentItemImageURL - """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 ImageContentItem(TypedDict, total=False): - image: Required[ImageContentItemImage] - """Image as a base64 encoded string or an URL""" - - type: Required[Literal["image"]] - """Discriminator type of the content item. Always "image" """ - - -class TextContentItem(TypedDict, total=False): - text: Required[str] - """Text content""" - - type: Required[Literal["text"]] - """Discriminator type of the content item. Always "text" """ - - -InterleavedContentItem: TypeAlias = Union[ImageContentItem, TextContentItem] 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 9be15690..206e8a22 100644 --- a/src/llama_stack_client/types/shared_params/sampling_params.py +++ b/src/llama_stack_client/types/shared_params/sampling_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Union +from typing import Union, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr @@ -23,52 +23,35 @@ class StrategyGreedySamplingStrategy(TypedDict, total=False): - type: Required[Literal["greedy"]] - """Must be "greedy" to identify this sampling strategy""" + type: Literal["greedy"] class StrategyTopPSamplingStrategy(TypedDict, total=False): - type: Required[Literal["top_p"]] - """Must be "top_p" to identify this sampling strategy""" + temperature: Required[Optional[float]] - temperature: float - """Controls randomness in sampling. Higher values increase randomness""" + top_p: Optional[float] - top_p: float - """Cumulative probability threshold for nucleus sampling. Defaults to 0.95""" + type: Literal["top_p"] class StrategyTopKSamplingStrategy(TypedDict, total=False): top_k: Required[int] - """Number of top tokens to consider for sampling. Must be at least 1""" - type: Required[Literal["top_k"]] - """Must be "top_k" to identify this sampling strategy""" + type: Literal["top_k"] Strategy: TypeAlias = Union[StrategyGreedySamplingStrategy, StrategyTopPSamplingStrategy, StrategyTopKSamplingStrategy] class SamplingParams(TypedDict, total=False): - strategy: Required[Strategy] - """The sampling strategy.""" + max_tokens: Optional[int] - max_tokens: int - """The maximum number of tokens that can be generated in the completion. + repetition_penalty: Optional[float] - The token count of your prompt plus max_tokens cannot exceed the model's context - length. - """ - - repetition_penalty: float - """Number between -2.0 and 2.0. + stop: Optional[SequenceNotStr[str]] - Positive values penalize new tokens based on whether they appear in the text so - far, increasing the model's likelihood to talk about new topics. + strategy: Strategy """ - - stop: SequenceNotStr[str] - """Up to 4 sequences where the API will stop generating further tokens. - - The returned text will not contain the stop sequence. + Greedy sampling strategy that selects the highest probability token at each + step. """ diff --git a/src/llama_stack_client/types/shared_params/system_message.py b/src/llama_stack_client/types/shared_params/system_message.py index bb41f69d..d62c334a 100644 --- a/src/llama_stack_client/types/shared_params/system_message.py +++ b/src/llama_stack_client/types/shared_params/system_message.py @@ -8,21 +8,84 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing import Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .interleaved_content import InterleavedContent +__all__ = [ + "SystemMessage", + "Content", + "ContentImageContentItemInput", + "ContentImageContentItemInputImage", + "ContentImageContentItemInputImageURL", + "ContentTextContentItem", + "ContentListImageContentItemInputTextContentItem", + "ContentListImageContentItemInputTextContentItemImageContentItemInput", + "ContentListImageContentItemInputTextContentItemImageContentItemInputImage", + "ContentListImageContentItemInputTextContentItemImageContentItemInputImageURL", + "ContentListImageContentItemInputTextContentItemTextContentItem", +] -__all__ = ["SystemMessage"] +class ContentImageContentItemInputImageURL(TypedDict, total=False): + uri: Required[str] -class SystemMessage(TypedDict, total=False): - content: Required[InterleavedContent] - """The content of the "system prompt". - If multiple system messages are provided, they are concatenated. The underlying - Llama Stack code may also add other system messages (for example, for formatting - tool definitions). - """ +class ContentImageContentItemInputImage(TypedDict, total=False): + data: Optional[str] + + url: Optional[ContentImageContentItemInputImageURL] + """A URL reference to external content.""" + + +class ContentImageContentItemInput(TypedDict, total=False): + image: Required[ContentImageContentItemInputImage] + """A URL or a base64 encoded string""" + + type: Literal["image"] + + +class ContentTextContentItem(TypedDict, total=False): + text: Required[str] + + type: Literal["text"] + + +class ContentListImageContentItemInputTextContentItemImageContentItemInputImageURL(TypedDict, total=False): + uri: Required[str] + + +class ContentListImageContentItemInputTextContentItemImageContentItemInputImage(TypedDict, total=False): + data: Optional[str] + + url: Optional[ContentListImageContentItemInputTextContentItemImageContentItemInputImageURL] + """A URL reference to external content.""" + + +class ContentListImageContentItemInputTextContentItemImageContentItemInput(TypedDict, total=False): + image: Required[ContentListImageContentItemInputTextContentItemImageContentItemInputImage] + """A URL or a base64 encoded string""" + + type: Literal["image"] + + +class ContentListImageContentItemInputTextContentItemTextContentItem(TypedDict, total=False): + text: Required[str] + + type: Literal["text"] + + +ContentListImageContentItemInputTextContentItem: TypeAlias = Union[ + ContentListImageContentItemInputTextContentItemImageContentItemInput, + ContentListImageContentItemInputTextContentItemTextContentItem, +] + +Content: TypeAlias = Union[ + str, ContentImageContentItemInput, ContentTextContentItem, Iterable[ContentListImageContentItemInputTextContentItem] +] + + +class SystemMessage(TypedDict, total=False): + content: Required[Content] + """A image content item""" - role: Required[Literal["system"]] - """Must be "system" to identify this as a system message""" + role: Literal["system"] diff --git a/src/llama_stack_client/types/shield.py b/src/llama_stack_client/types/shield.py index 4eaf7652..1383e737 100644 --- a/src/llama_stack_client/types/shield.py +++ b/src/llama_stack_client/types/shield.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, Optional from typing_extensions import Literal from .._models import BaseModel @@ -16,13 +16,14 @@ class Shield(BaseModel): identifier: str + """Unique identifier for this resource in llama stack""" provider_id: str + """ID of the provider that owns this resource""" - type: Literal["shield"] - """The resource type, always shield""" - - params: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) Configuration parameters for the shield""" + params: Optional[Dict[str, object]] = None provider_resource_id: Optional[str] = None + """Unique identifier for this resource in the provider""" + + type: Optional[Literal["shield"]] = None diff --git a/src/llama_stack_client/types/shield_register_params.py b/src/llama_stack_client/types/shield_register_params.py index 7ae0b2c1..a6bac640 100644 --- a/src/llama_stack_client/types/shield_register_params.py +++ b/src/llama_stack_client/types/shield_register_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Optional from typing_extensions import Required, TypedDict __all__ = ["ShieldRegisterParams"] @@ -10,13 +10,9 @@ class ShieldRegisterParams(TypedDict, total=False): shield_id: Required[str] - """The identifier of the shield to register.""" - params: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """The parameters of the shield.""" + params: Optional[Dict[str, object]] - provider_id: str - """The identifier of the provider.""" + provider_id: Optional[str] - provider_shield_id: str - """The identifier of the shield in the provider.""" + provider_shield_id: Optional[str] diff --git a/src/llama_stack_client/types/tool_def.py b/src/llama_stack_client/types/tool_def.py index 087e2d78..ff0ede99 100644 --- a/src/llama_stack_client/types/tool_def.py +++ b/src/llama_stack_client/types/tool_def.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, Optional from .._models import BaseModel @@ -15,19 +15,13 @@ class ToolDef(BaseModel): name: str - """Name of the tool""" description: Optional[str] = None - """(Optional) Human-readable description of what the tool does""" - input_schema: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) JSON Schema for tool inputs (MCP inputSchema)""" + input_schema: Optional[Dict[str, object]] = None - metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) Additional metadata about the tool""" + metadata: Optional[Dict[str, object]] = None - output_schema: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) JSON Schema for tool outputs (MCP outputSchema)""" + output_schema: Optional[Dict[str, object]] = None toolgroup_id: Optional[str] = None - """(Optional) ID of the tool group this tool belongs to""" diff --git a/src/llama_stack_client/types/tool_group.py b/src/llama_stack_client/types/tool_group.py index a5e265f6..83b36cbb 100644 --- a/src/llama_stack_client/types/tool_group.py +++ b/src/llama_stack_client/types/tool_group.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, Optional from typing_extensions import Literal from .._models import BaseModel @@ -16,21 +16,21 @@ class McpEndpoint(BaseModel): uri: str - """The URL string pointing to the resource""" class ToolGroup(BaseModel): identifier: str + """Unique identifier for this resource in llama stack""" provider_id: str + """ID of the provider that owns this resource""" - type: Literal["tool_group"] - """Type of resource, always 'tool_group'""" - - args: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) Additional arguments for the tool group""" + args: Optional[Dict[str, object]] = None mcp_endpoint: Optional[McpEndpoint] = None - """(Optional) Model Context Protocol endpoint for remote tools""" + """A URL reference to external content.""" provider_resource_id: Optional[str] = None + """Unique identifier for this resource in the provider""" + + type: Optional[Literal["tool_group"]] = None diff --git a/src/llama_stack_client/types/tool_invocation_result.py b/src/llama_stack_client/types/tool_invocation_result.py index a20cb09d..727ca68a 100644 --- a/src/llama_stack_client/types/tool_invocation_result.py +++ b/src/llama_stack_client/types/tool_invocation_result.py @@ -7,22 +7,97 @@ # 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 .._utils import PropertyInfo from .._models import BaseModel -from .shared.interleaved_content import InterleavedContent -__all__ = ["ToolInvocationResult"] +__all__ = [ + "ToolInvocationResult", + "Content", + "ContentImageContentItemOutput", + "ContentImageContentItemOutputImage", + "ContentImageContentItemOutputImageURL", + "ContentTextContentItem", + "ContentListImageContentItemOutputTextContentItem", + "ContentListImageContentItemOutputTextContentItemImageContentItemOutput", + "ContentListImageContentItemOutputTextContentItemImageContentItemOutputImage", + "ContentListImageContentItemOutputTextContentItemImageContentItemOutputImageURL", + "ContentListImageContentItemOutputTextContentItemTextContentItem", +] + + +class ContentImageContentItemOutputImageURL(BaseModel): + uri: str + + +class ContentImageContentItemOutputImage(BaseModel): + data: Optional[str] = None + + url: Optional[ContentImageContentItemOutputImageURL] = None + """A URL reference to external content.""" + + +class ContentImageContentItemOutput(BaseModel): + image: ContentImageContentItemOutputImage + """A URL or a base64 encoded string""" + + type: Optional[Literal["image"]] = None + + +class ContentTextContentItem(BaseModel): + text: str + + type: Optional[Literal["text"]] = None + + +class ContentListImageContentItemOutputTextContentItemImageContentItemOutputImageURL(BaseModel): + uri: str + + +class ContentListImageContentItemOutputTextContentItemImageContentItemOutputImage(BaseModel): + data: Optional[str] = None + + url: Optional[ContentListImageContentItemOutputTextContentItemImageContentItemOutputImageURL] = None + """A URL reference to external content.""" + + +class ContentListImageContentItemOutputTextContentItemImageContentItemOutput(BaseModel): + image: ContentListImageContentItemOutputTextContentItemImageContentItemOutputImage + """A URL or a base64 encoded string""" + + type: Optional[Literal["image"]] = None + + +class ContentListImageContentItemOutputTextContentItemTextContentItem(BaseModel): + text: str + + type: Optional[Literal["text"]] = None + + +ContentListImageContentItemOutputTextContentItem: TypeAlias = Annotated[ + Union[ + ContentListImageContentItemOutputTextContentItemImageContentItemOutput, + ContentListImageContentItemOutputTextContentItemTextContentItem, + ], + PropertyInfo(discriminator="type"), +] + +Content: TypeAlias = Union[ + str, + ContentImageContentItemOutput, + ContentTextContentItem, + List[ContentListImageContentItemOutputTextContentItem], + None, +] class ToolInvocationResult(BaseModel): - content: Optional[InterleavedContent] = None - """(Optional) The output content from the tool execution""" + content: Optional[Content] = None + """A image content item""" error_code: Optional[int] = None - """(Optional) Numeric error code if the tool execution failed""" error_message: Optional[str] = None - """(Optional) Error message if the tool execution failed""" - metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """(Optional) Additional metadata about the tool execution""" + metadata: Optional[Dict[str, object]] = None diff --git a/src/llama_stack_client/types/tool_list_params.py b/src/llama_stack_client/types/tool_list_params.py index e13db358..acd34c77 100644 --- a/src/llama_stack_client/types/tool_list_params.py +++ b/src/llama_stack_client/types/tool_list_params.py @@ -8,11 +8,11 @@ from __future__ import annotations +from typing import Optional from typing_extensions import TypedDict __all__ = ["ToolListParams"] class ToolListParams(TypedDict, total=False): - toolgroup_id: str - """The ID of the tool group to list tools for.""" + toolgroup_id: Optional[str] diff --git a/src/llama_stack_client/types/tool_runtime/__init__.py b/src/llama_stack_client/types/tool_runtime/__init__.py deleted file mode 100644 index d14ed874..00000000 --- a/src/llama_stack_client/types/tool_runtime/__init__.py +++ /dev/null @@ -1,9 +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 diff --git a/src/llama_stack_client/types/tool_runtime_invoke_tool_params.py b/src/llama_stack_client/types/tool_runtime_invoke_tool_params.py index 1fc49629..3e1027eb 100644 --- a/src/llama_stack_client/types/tool_runtime_invoke_tool_params.py +++ b/src/llama_stack_client/types/tool_runtime_invoke_tool_params.py @@ -8,18 +8,15 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Optional from typing_extensions import Required, TypedDict __all__ = ["ToolRuntimeInvokeToolParams"] class ToolRuntimeInvokeToolParams(TypedDict, total=False): - kwargs: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """A dictionary of arguments to pass to the tool.""" + kwargs: Required[Dict[str, object]] tool_name: Required[str] - """The name of the tool to invoke.""" - authorization: str - """(Optional) OAuth access token for authenticating with the MCP server.""" + authorization: Optional[str] diff --git a/src/llama_stack_client/types/tool_runtime_list_tools_params.py b/src/llama_stack_client/types/tool_runtime_list_tools_params.py index 182bc2fb..33adce40 100644 --- a/src/llama_stack_client/types/tool_runtime_list_tools_params.py +++ b/src/llama_stack_client/types/tool_runtime_list_tools_params.py @@ -8,22 +8,20 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Required, TypedDict __all__ = ["ToolRuntimeListToolsParams", "McpEndpoint"] class ToolRuntimeListToolsParams(TypedDict, total=False): - authorization: str - """(Optional) OAuth access token for authenticating with the MCP server.""" + authorization: Optional[str] - mcp_endpoint: McpEndpoint - """The MCP endpoint to use for the tool group.""" + mcp_endpoint: Optional[McpEndpoint] + """A URL reference to external content.""" - tool_group_id: str - """The ID of the tool group to list tools for.""" + tool_group_id: Optional[str] class McpEndpoint(TypedDict, total=False): uri: Required[str] - """The URL string pointing to the resource""" diff --git a/src/llama_stack_client/types/toolgroup_register_params.py b/src/llama_stack_client/types/toolgroup_register_params.py index 2aa79960..2ac7e984 100644 --- a/src/llama_stack_client/types/toolgroup_register_params.py +++ b/src/llama_stack_client/types/toolgroup_register_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Optional from typing_extensions import Required, TypedDict __all__ = ["ToolgroupRegisterParams", "McpEndpoint"] @@ -10,18 +10,14 @@ class ToolgroupRegisterParams(TypedDict, total=False): provider_id: Required[str] - """The ID of the provider to use for the tool group.""" toolgroup_id: Required[str] - """The ID of the tool group to register.""" - args: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """A dictionary of arguments to pass to the tool group.""" + args: Optional[Dict[str, object]] - mcp_endpoint: McpEndpoint - """The MCP endpoint to use for the tool group.""" + mcp_endpoint: Optional[McpEndpoint] + """A URL reference to external content.""" class McpEndpoint(TypedDict, total=False): uri: Required[str] - """The URL string pointing to the resource""" diff --git a/src/llama_stack_client/types/vector_io_insert_params.py b/src/llama_stack_client/types/vector_io_insert_params.py index 520ad24b..15ba21e5 100644 --- a/src/llama_stack_client/types/vector_io_insert_params.py +++ b/src/llama_stack_client/types/vector_io_insert_params.py @@ -8,90 +8,135 @@ from __future__ import annotations -from typing import Dict, Union, Iterable -from typing_extensions import Required, TypedDict - -from .shared_params.interleaved_content import InterleavedContent - -__all__ = ["VectorIoInsertParams", "Chunk", "ChunkChunkMetadata"] +from typing import Dict, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict + +__all__ = [ + "VectorIoInsertParams", + "Chunk", + "ChunkContent", + "ChunkContentImageContentItemInput", + "ChunkContentImageContentItemInputImage", + "ChunkContentImageContentItemInputImageURL", + "ChunkContentTextContentItem", + "ChunkContentListImageContentItemInputTextContentItem", + "ChunkContentListImageContentItemInputTextContentItemImageContentItemInput", + "ChunkContentListImageContentItemInputTextContentItemImageContentItemInputImage", + "ChunkContentListImageContentItemInputTextContentItemImageContentItemInputImageURL", + "ChunkContentListImageContentItemInputTextContentItemTextContentItem", + "ChunkChunkMetadata", +] class VectorIoInsertParams(TypedDict, total=False): chunks: Required[Iterable[Chunk]] - """The chunks to insert. - - Each `Chunk` should contain content which can be interleaved text, images, or - other types. `metadata`: `dict[str, Any]` and `embedding`: `List[float]` are - optional. If `metadata` is provided, you configure how Llama Stack formats the - chunk during generation. If `embedding` is not provided, it will be computed - later. - """ vector_store_id: Required[str] - """The identifier of the vector database to insert the chunks into.""" - ttl_seconds: int - """The time to live of the chunks.""" + ttl_seconds: Optional[int] -class ChunkChunkMetadata(TypedDict, total=False): - chunk_embedding_dimension: int - """The dimension of the embedding vector for the chunk.""" +class ChunkContentImageContentItemInputImageURL(TypedDict, total=False): + uri: Required[str] - chunk_embedding_model: str - """The embedding model used to create the chunk's embedding.""" - chunk_id: str - """The ID of the chunk. +class ChunkContentImageContentItemInputImage(TypedDict, total=False): + data: Optional[str] + + url: Optional[ChunkContentImageContentItemInputImageURL] + """A URL reference to external content.""" + + +class ChunkContentImageContentItemInput(TypedDict, total=False): + image: Required[ChunkContentImageContentItemInputImage] + """A URL or a base64 encoded string""" + + type: Literal["image"] + + +class ChunkContentTextContentItem(TypedDict, total=False): + text: Required[str] + + type: Literal["text"] + + +class ChunkContentListImageContentItemInputTextContentItemImageContentItemInputImageURL(TypedDict, total=False): + uri: Required[str] + + +class ChunkContentListImageContentItemInputTextContentItemImageContentItemInputImage(TypedDict, total=False): + data: Optional[str] + + url: Optional[ChunkContentListImageContentItemInputTextContentItemImageContentItemInputImageURL] + """A URL reference to external content.""" - If not set, it will be generated based on the document ID and content. - """ - chunk_tokenizer: str - """The tokenizer used to create the chunk. Default is Tiktoken.""" +class ChunkContentListImageContentItemInputTextContentItemImageContentItemInput(TypedDict, total=False): + image: Required[ChunkContentListImageContentItemInputTextContentItemImageContentItemInputImage] + """A URL or a base64 encoded string""" - chunk_window: str - """The window of the chunk, which can be used to group related chunks together.""" + type: Literal["image"] - content_token_count: int - """The number of tokens in the content of the chunk.""" - created_timestamp: int - """An optional timestamp indicating when the chunk was created.""" +class ChunkContentListImageContentItemInputTextContentItemTextContentItem(TypedDict, total=False): + text: Required[str] - document_id: str - """The ID of the document this chunk belongs to.""" + type: Literal["text"] - metadata_token_count: int - """The number of tokens in the metadata of the chunk.""" - source: str - """The source of the content, such as a URL, file path, or other identifier.""" +ChunkContentListImageContentItemInputTextContentItem: TypeAlias = Union[ + ChunkContentListImageContentItemInputTextContentItemImageContentItemInput, + ChunkContentListImageContentItemInputTextContentItemTextContentItem, +] - updated_timestamp: int - """An optional timestamp indicating when the chunk was last updated.""" +ChunkContent: TypeAlias = Union[ + str, + ChunkContentImageContentItemInput, + ChunkContentTextContentItem, + Iterable[ChunkContentListImageContentItemInputTextContentItem], +] + + +class ChunkChunkMetadata(TypedDict, total=False): + chunk_embedding_dimension: Optional[int] + + chunk_embedding_model: Optional[str] + + chunk_id: Optional[str] + + chunk_tokenizer: Optional[str] + + chunk_window: Optional[str] + + content_token_count: Optional[int] + + created_timestamp: Optional[int] + + document_id: Optional[str] + + metadata_token_count: Optional[int] + + source: Optional[str] + + updated_timestamp: Optional[int] class Chunk(TypedDict, total=False): chunk_id: Required[str] - """Unique identifier for the chunk. Must be provided explicitly.""" - content: Required[InterleavedContent] - """ - The content of the chunk, which can be interleaved text, images, or other types. - """ + content: Required[ChunkContent] + """A image content item""" - metadata: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] + chunk_metadata: Optional[ChunkChunkMetadata] """ - Metadata associated with the chunk that will be used in the model context during - inference. + `ChunkMetadata` is backend metadata for a `Chunk` that is used to store + additional information about the chunk that will not be used in the context + during inference, but is required for backend functionality. The `ChunkMetadata` + is set during chunk creation in `MemoryToolRuntimeImpl().insert()`and is not + expected to change after. Use `Chunk.metadata` for metadata that will be used in + the context during inference. """ - chunk_metadata: ChunkChunkMetadata - """Metadata for the chunk that will NOT be used in the context during inference. - - The `chunk_metadata` is required backend functionality. - """ + embedding: Optional[Iterable[float]] - embedding: Iterable[float] - """Optional embedding for the chunk. If not provided, it will be computed later.""" + metadata: Dict[str, object] diff --git a/src/llama_stack_client/types/vector_io_query_params.py b/src/llama_stack_client/types/vector_io_query_params.py index 538604ac..5427a553 100644 --- a/src/llama_stack_client/types/vector_io_query_params.py +++ b/src/llama_stack_client/types/vector_io_query_params.py @@ -8,20 +8,86 @@ from __future__ import annotations -from typing import Dict, Union, Iterable -from typing_extensions import Required, TypedDict +from typing import Dict, Union, Iterable, Optional +from typing_extensions import Literal, Required, TypeAlias, TypedDict -from .shared_params.interleaved_content import InterleavedContent - -__all__ = ["VectorIoQueryParams"] +__all__ = [ + "VectorIoQueryParams", + "Query", + "QueryImageContentItemInput", + "QueryImageContentItemInputImage", + "QueryImageContentItemInputImageURL", + "QueryTextContentItem", + "QueryListImageContentItemInputTextContentItem", + "QueryListImageContentItemInputTextContentItemImageContentItemInput", + "QueryListImageContentItemInputTextContentItemImageContentItemInputImage", + "QueryListImageContentItemInputTextContentItemImageContentItemInputImageURL", + "QueryListImageContentItemInputTextContentItemTextContentItem", +] class VectorIoQueryParams(TypedDict, total=False): - query: Required[InterleavedContent] - """The query to search for.""" + query: Required[Query] + """A image content item""" vector_store_id: Required[str] - """The identifier of the vector database to query.""" - params: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """The parameters of the query.""" + params: Optional[Dict[str, object]] + + +class QueryImageContentItemInputImageURL(TypedDict, total=False): + uri: Required[str] + + +class QueryImageContentItemInputImage(TypedDict, total=False): + data: Optional[str] + + url: Optional[QueryImageContentItemInputImageURL] + """A URL reference to external content.""" + + +class QueryImageContentItemInput(TypedDict, total=False): + image: Required[QueryImageContentItemInputImage] + """A URL or a base64 encoded string""" + + type: Literal["image"] + + +class QueryTextContentItem(TypedDict, total=False): + text: Required[str] + + type: Literal["text"] + + +class QueryListImageContentItemInputTextContentItemImageContentItemInputImageURL(TypedDict, total=False): + uri: Required[str] + + +class QueryListImageContentItemInputTextContentItemImageContentItemInputImage(TypedDict, total=False): + data: Optional[str] + + url: Optional[QueryListImageContentItemInputTextContentItemImageContentItemInputImageURL] + """A URL reference to external content.""" + + +class QueryListImageContentItemInputTextContentItemImageContentItemInput(TypedDict, total=False): + image: Required[QueryListImageContentItemInputTextContentItemImageContentItemInputImage] + """A URL or a base64 encoded string""" + + type: Literal["image"] + + +class QueryListImageContentItemInputTextContentItemTextContentItem(TypedDict, total=False): + text: Required[str] + + type: Literal["text"] + + +QueryListImageContentItemInputTextContentItem: TypeAlias = Union[ + QueryListImageContentItemInputTextContentItemImageContentItemInput, + QueryListImageContentItemInputTextContentItemTextContentItem, +] + +Query: TypeAlias = Union[ + str, QueryImageContentItemInput, QueryTextContentItem, Iterable[QueryListImageContentItemInputTextContentItem] +] diff --git a/src/llama_stack_client/types/vector_store.py b/src/llama_stack_client/types/vector_store.py index 5b31e857..d07fe6e1 100644 --- a/src/llama_stack_client/types/vector_store.py +++ b/src/llama_stack_client/types/vector_store.py @@ -6,8 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import builtins -from typing import Dict, List, Union, Optional +from typing import Dict, Optional from .._models import BaseModel @@ -16,51 +15,36 @@ class FileCounts(BaseModel): cancelled: int - """Number of files that had their processing cancelled""" completed: int - """Number of files that have been successfully processed""" failed: int - """Number of files that failed to process""" in_progress: int - """Number of files currently being processed""" total: int - """Total number of files in the vector store""" class VectorStore(BaseModel): id: str - """Unique identifier for the vector store""" created_at: int - """Timestamp when the vector store was created""" file_counts: FileCounts - """File processing status counts for the vector store""" + """File processing status counts for a vector store.""" - metadata: Dict[str, Union[bool, float, str, List[object], object, None]] - """Set of key-value pairs that can be attached to the vector store""" + expires_after: Optional[Dict[str, object]] = None - object: str - """Object type identifier, always "vector_store" """ + expires_at: Optional[int] = None - status: str - """Current status of the vector store""" + last_active_at: Optional[int] = None - usage_bytes: int - """Storage space used by the vector store in bytes""" + metadata: Optional[Dict[str, object]] = None - expires_after: Optional[Dict[str, Union[bool, float, str, List[builtins.object], builtins.object, None]]] = None - """(Optional) Expiration policy for the vector store""" + name: Optional[str] = None - expires_at: Optional[int] = None - """(Optional) Timestamp when the vector store will expire""" + object: Optional[str] = None - last_active_at: Optional[int] = None - """(Optional) Timestamp of last activity on the vector store""" + status: Optional[str] = None - name: Optional[str] = None - """(Optional) Name of the vector store""" + usage_bytes: Optional[int] = None diff --git a/src/llama_stack_client/types/vector_store_create_params.py b/src/llama_stack_client/types/vector_store_create_params.py index 7798b5cb..d9438385 100644 --- a/src/llama_stack_client/types/vector_store_create_params.py +++ b/src/llama_stack_client/types/vector_store_create_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from .._types import SequenceNotStr @@ -23,41 +23,33 @@ class VectorStoreCreateParams(TypedDict, total=False): - chunking_strategy: ChunkingStrategy - """(Optional) Strategy for splitting files into chunks""" + chunking_strategy: Optional[ChunkingStrategy] + """Automatic chunking strategy for vector store files.""" - expires_after: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) Expiration policy for the vector store""" + expires_after: Optional[Dict[str, object]] - file_ids: SequenceNotStr[str] - """List of file IDs to include in the vector store""" + file_ids: Optional[SequenceNotStr[str]] - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """Set of key-value pairs that can be attached to the vector store""" + metadata: Optional[Dict[str, object]] - name: str - """(Optional) A name for the vector store""" + name: Optional[str] class ChunkingStrategyVectorStoreChunkingStrategyAuto(TypedDict, total=False): - type: Required[Literal["auto"]] - """Strategy type, always "auto" for automatic chunking""" + type: Literal["auto"] class ChunkingStrategyVectorStoreChunkingStrategyStaticStatic(TypedDict, total=False): - chunk_overlap_tokens: Required[int] - """Number of tokens to overlap between adjacent chunks""" + chunk_overlap_tokens: int - max_chunk_size_tokens: Required[int] - """Maximum number of tokens per chunk, must be between 100 and 4096""" + max_chunk_size_tokens: int class ChunkingStrategyVectorStoreChunkingStrategyStatic(TypedDict, total=False): static: Required[ChunkingStrategyVectorStoreChunkingStrategyStaticStatic] - """Configuration parameters for the static chunking strategy""" + """Configuration for static chunking strategy.""" - type: Required[Literal["static"]] - """Strategy type, always "static" for static chunking""" + type: Literal["static"] ChunkingStrategy: TypeAlias = Union[ diff --git a/src/llama_stack_client/types/vector_store_delete_response.py b/src/llama_stack_client/types/vector_store_delete_response.py index 85689115..09df003f 100644 --- a/src/llama_stack_client/types/vector_store_delete_response.py +++ b/src/llama_stack_client/types/vector_store_delete_response.py @@ -6,6 +6,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional + from .._models import BaseModel __all__ = ["VectorStoreDeleteResponse"] @@ -13,10 +15,7 @@ class VectorStoreDeleteResponse(BaseModel): id: str - """Unique identifier of the deleted vector store""" - deleted: bool - """Whether the deletion operation was successful""" + deleted: Optional[bool] = None - object: str - """Object type identifier for the deletion response""" + object: Optional[str] = None diff --git a/src/llama_stack_client/types/vector_store_list_params.py b/src/llama_stack_client/types/vector_store_list_params.py index b94f4150..60da6de0 100644 --- a/src/llama_stack_client/types/vector_store_list_params.py +++ b/src/llama_stack_client/types/vector_store_list_params.py @@ -8,32 +8,17 @@ from __future__ import annotations +from typing import Optional from typing_extensions import TypedDict __all__ = ["VectorStoreListParams"] class VectorStoreListParams(TypedDict, total=False): - after: str - """A cursor for use in pagination. + after: Optional[str] - `after` is an object ID that defines your place in the list. - """ + before: Optional[str] - before: str - """A cursor for use in pagination. + limit: Optional[int] - `before` is an object ID that defines your place in the list. - """ - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ - - order: str - """Sort order by the `created_at` timestamp of the objects. - - `asc` for ascending order and `desc` for descending order. - """ + order: Optional[str] diff --git a/src/llama_stack_client/types/vector_store_search_params.py b/src/llama_stack_client/types/vector_store_search_params.py index 0fd26224..ab4e7e7b 100644 --- a/src/llama_stack_client/types/vector_store_search_params.py +++ b/src/llama_stack_client/types/vector_store_search_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Optional from typing_extensions import Required, TypedDict from .._types import SequenceNotStr @@ -18,27 +18,20 @@ class VectorStoreSearchParams(TypedDict, total=False): query: Required[Union[str, SequenceNotStr[str]]] - """The query string or array for performing the search.""" - filters: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """Filters based on file attributes to narrow the search results.""" + filters: Optional[Dict[str, object]] - max_num_results: int - """Maximum number of results to return (1 to 50 inclusive, default 10).""" + max_num_results: Optional[int] - ranking_options: RankingOptions - """Ranking options for fine-tuning the search results.""" + ranking_options: Optional[RankingOptions] + """Options for ranking and filtering search results.""" - rewrite_query: bool - """Whether to rewrite the natural language query for vector search (default false)""" + rewrite_query: Optional[bool] - search_mode: str - """The search mode to use - "keyword", "vector", or "hybrid" (default "vector")""" + search_mode: Optional[str] class RankingOptions(TypedDict, total=False): - ranker: str - """(Optional) Name of the ranking algorithm to use""" + ranker: Optional[str] - score_threshold: float - """(Optional) Minimum relevance score threshold for results""" + score_threshold: Optional[float] diff --git a/src/llama_stack_client/types/vector_store_search_response.py b/src/llama_stack_client/types/vector_store_search_response.py index 4101d276..97549ffe 100644 --- a/src/llama_stack_client/types/vector_store_search_response.py +++ b/src/llama_stack_client/types/vector_store_search_response.py @@ -16,88 +16,67 @@ class DataContentChunkMetadata(BaseModel): chunk_embedding_dimension: Optional[int] = None - """The dimension of the embedding vector for the chunk.""" chunk_embedding_model: Optional[str] = None - """The embedding model used to create the chunk's embedding.""" chunk_id: Optional[str] = None - """The ID of the chunk. - - If not set, it will be generated based on the document ID and content. - """ chunk_tokenizer: Optional[str] = None - """The tokenizer used to create the chunk. Default is Tiktoken.""" chunk_window: Optional[str] = None - """The window of the chunk, which can be used to group related chunks together.""" content_token_count: Optional[int] = None - """The number of tokens in the content of the chunk.""" created_timestamp: Optional[int] = None - """An optional timestamp indicating when the chunk was created.""" document_id: Optional[str] = None - """The ID of the document this chunk belongs to.""" metadata_token_count: Optional[int] = None - """The number of tokens in the metadata of the chunk.""" source: Optional[str] = None - """The source of the content, such as a URL, file path, or other identifier.""" updated_timestamp: Optional[int] = None - """An optional timestamp indicating when the chunk was last updated.""" class DataContent(BaseModel): text: str - """The actual text content""" type: Literal["text"] - """Content type, currently only "text" is supported""" chunk_metadata: Optional[DataContentChunkMetadata] = None - """Optional chunk metadata""" + """ + `ChunkMetadata` is backend metadata for a `Chunk` that is used to store + additional information about the chunk that will not be used in the context + during inference, but is required for backend functionality. The `ChunkMetadata` + is set during chunk creation in `MemoryToolRuntimeImpl().insert()`and is not + expected to change after. Use `Chunk.metadata` for metadata that will be used in + the context during inference. + """ embedding: Optional[List[float]] = None - """Optional embedding vector for this content chunk""" - metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """Optional user-defined metadata""" + metadata: Optional[Dict[str, object]] = None class Data(BaseModel): content: List[DataContent] - """List of content items matching the search query""" file_id: str - """Unique identifier of the file containing the result""" filename: str - """Name of the file containing the result""" score: float - """Relevance score for this search result""" attributes: Optional[Dict[str, Union[str, float, bool]]] = None - """(Optional) Key-value attributes associated with the file""" class VectorStoreSearchResponse(BaseModel): data: List[Data] - """List of search result objects""" - - has_more: bool - """Whether there are more results available beyond this page""" - - object: str - """Object type identifier for the search results page""" search_query: List[str] - """The original search query that was executed""" + + has_more: Optional[bool] = None next_page: Optional[str] = None - """(Optional) Token for retrieving the next page of results""" + + object: Optional[str] = None diff --git a/src/llama_stack_client/types/vector_store_update_params.py b/src/llama_stack_client/types/vector_store_update_params.py index 6326c6df..de936fec 100644 --- a/src/llama_stack_client/types/vector_store_update_params.py +++ b/src/llama_stack_client/types/vector_store_update_params.py @@ -8,18 +8,15 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Optional from typing_extensions import TypedDict __all__ = ["VectorStoreUpdateParams"] class VectorStoreUpdateParams(TypedDict, total=False): - expires_after: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """The expiration policy for a vector store.""" + expires_after: Optional[Dict[str, object]] - metadata: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """Set of 16 key-value pairs that can be attached to an object.""" + metadata: Optional[Dict[str, object]] - name: str - """The name of the vector store.""" + name: Optional[str] diff --git a/src/llama_stack_client/types/vector_stores/file_batch_create_params.py b/src/llama_stack_client/types/vector_stores/file_batch_create_params.py index 030ef097..c350f827 100644 --- a/src/llama_stack_client/types/vector_stores/file_batch_create_params.py +++ b/src/llama_stack_client/types/vector_stores/file_batch_create_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict from ..._types import SequenceNotStr @@ -24,34 +24,28 @@ class FileBatchCreateParams(TypedDict, total=False): file_ids: Required[SequenceNotStr[str]] - """A list of File IDs that the vector store should use""" - attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """(Optional) Key-value attributes to store with the files""" + attributes: Optional[Dict[str, object]] - chunking_strategy: ChunkingStrategy - """(Optional) The chunking strategy used to chunk the file(s). Defaults to auto""" + chunking_strategy: Optional[ChunkingStrategy] + """Automatic chunking strategy for vector store files.""" class ChunkingStrategyVectorStoreChunkingStrategyAuto(TypedDict, total=False): - type: Required[Literal["auto"]] - """Strategy type, always "auto" for automatic chunking""" + type: Literal["auto"] class ChunkingStrategyVectorStoreChunkingStrategyStaticStatic(TypedDict, total=False): - chunk_overlap_tokens: Required[int] - """Number of tokens to overlap between adjacent chunks""" + chunk_overlap_tokens: int - max_chunk_size_tokens: Required[int] - """Maximum number of tokens per chunk, must be between 100 and 4096""" + max_chunk_size_tokens: int class ChunkingStrategyVectorStoreChunkingStrategyStatic(TypedDict, total=False): static: Required[ChunkingStrategyVectorStoreChunkingStrategyStaticStatic] - """Configuration parameters for the static chunking strategy""" + """Configuration for static chunking strategy.""" - type: Required[Literal["static"]] - """Strategy type, always "static" for static chunking""" + type: Literal["static"] ChunkingStrategy: TypeAlias = Union[ diff --git a/src/llama_stack_client/types/vector_stores/file_batch_list_files_params.py b/src/llama_stack_client/types/vector_stores/file_batch_list_files_params.py index 13cfde23..6b4a3921 100644 --- a/src/llama_stack_client/types/vector_stores/file_batch_list_files_params.py +++ b/src/llama_stack_client/types/vector_stores/file_batch_list_files_params.py @@ -8,6 +8,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Required, TypedDict __all__ = ["FileBatchListFilesParams"] @@ -16,29 +17,12 @@ class FileBatchListFilesParams(TypedDict, total=False): vector_store_id: Required[str] - after: str - """A cursor for use in pagination. + after: Optional[str] - `after` is an object ID that defines your place in the list. - """ + before: Optional[str] - before: str - """A cursor for use in pagination. + filter: Optional[str] - `before` is an object ID that defines your place in the list. - """ + limit: Optional[int] - filter: str - """Filter by file status. One of in_progress, completed, failed, cancelled.""" - - limit: int - """A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ - - order: str - """Sort order by the `created_at` timestamp of the objects. - - `asc` for ascending order and `desc` for descending order. - """ + order: Optional[str] diff --git a/src/llama_stack_client/types/vector_stores/file_content_params.py b/src/llama_stack_client/types/vector_stores/file_content_params.py index 3a2ab9f4..d911da9b 100644 --- a/src/llama_stack_client/types/vector_stores/file_content_params.py +++ b/src/llama_stack_client/types/vector_stores/file_content_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Required, TypedDict __all__ = ["FileContentParams"] @@ -10,8 +11,6 @@ class FileContentParams(TypedDict, total=False): vector_store_id: Required[str] - include_embeddings: bool - """Whether to include embedding vectors in the response.""" + include_embeddings: Optional[bool] - include_metadata: bool - """Whether to include chunk metadata in the response.""" + include_metadata: Optional[bool] diff --git a/src/llama_stack_client/types/vector_stores/file_content_response.py b/src/llama_stack_client/types/vector_stores/file_content_response.py index cb151457..70f67aa1 100644 --- a/src/llama_stack_client/types/vector_stores/file_content_response.py +++ b/src/llama_stack_client/types/vector_stores/file_content_response.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, List, Optional from typing_extensions import Literal from ..._models import BaseModel @@ -16,68 +16,53 @@ class DataChunkMetadata(BaseModel): chunk_embedding_dimension: Optional[int] = None - """The dimension of the embedding vector for the chunk.""" chunk_embedding_model: Optional[str] = None - """The embedding model used to create the chunk's embedding.""" chunk_id: Optional[str] = None - """The ID of the chunk. - - If not set, it will be generated based on the document ID and content. - """ chunk_tokenizer: Optional[str] = None - """The tokenizer used to create the chunk. Default is Tiktoken.""" chunk_window: Optional[str] = None - """The window of the chunk, which can be used to group related chunks together.""" content_token_count: Optional[int] = None - """The number of tokens in the content of the chunk.""" created_timestamp: Optional[int] = None - """An optional timestamp indicating when the chunk was created.""" document_id: Optional[str] = None - """The ID of the document this chunk belongs to.""" metadata_token_count: Optional[int] = None - """The number of tokens in the metadata of the chunk.""" source: Optional[str] = None - """The source of the content, such as a URL, file path, or other identifier.""" updated_timestamp: Optional[int] = None - """An optional timestamp indicating when the chunk was last updated.""" class Data(BaseModel): text: str - """The actual text content""" type: Literal["text"] - """Content type, currently only "text" is supported""" chunk_metadata: Optional[DataChunkMetadata] = None - """Optional chunk metadata""" + """ + `ChunkMetadata` is backend metadata for a `Chunk` that is used to store + additional information about the chunk that will not be used in the context + during inference, but is required for backend functionality. The `ChunkMetadata` + is set during chunk creation in `MemoryToolRuntimeImpl().insert()`and is not + expected to change after. Use `Chunk.metadata` for metadata that will be used in + the context during inference. + """ embedding: Optional[List[float]] = None - """Optional embedding vector for this content chunk""" - metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None - """Optional user-defined metadata""" + metadata: Optional[Dict[str, object]] = None class FileContentResponse(BaseModel): data: List[Data] - """Parsed content of the file""" - - has_more: bool - """Indicates if there are more content pages to fetch""" - object: Literal["vector_store.file_content.page"] - """The object type, which is always `vector_store.file_content.page`""" + has_more: Optional[bool] = None next_page: Optional[str] = None - """The token for the next page, if any""" + + object: Optional[Literal["vector_store.file_content.page"]] = None diff --git a/src/llama_stack_client/types/vector_stores/file_create_params.py b/src/llama_stack_client/types/vector_stores/file_create_params.py index 2220f3ad..7f81f880 100644 --- a/src/llama_stack_client/types/vector_stores/file_create_params.py +++ b/src/llama_stack_client/types/vector_stores/file_create_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict, Union, Optional from typing_extensions import Literal, Required, TypeAlias, TypedDict __all__ = [ @@ -22,34 +22,28 @@ class FileCreateParams(TypedDict, total=False): file_id: Required[str] - """The ID of the file to attach to the vector store.""" - attributes: Dict[str, Union[bool, float, str, Iterable[object], object, None]] - """The key-value attributes stored with the file, which can be used for filtering.""" + attributes: Optional[Dict[str, object]] - chunking_strategy: ChunkingStrategy - """The chunking strategy to use for the file.""" + chunking_strategy: Optional[ChunkingStrategy] + """Automatic chunking strategy for vector store files.""" class ChunkingStrategyVectorStoreChunkingStrategyAuto(TypedDict, total=False): - type: Required[Literal["auto"]] - """Strategy type, always "auto" for automatic chunking""" + type: Literal["auto"] class ChunkingStrategyVectorStoreChunkingStrategyStaticStatic(TypedDict, total=False): - chunk_overlap_tokens: Required[int] - """Number of tokens to overlap between adjacent chunks""" + chunk_overlap_tokens: int - max_chunk_size_tokens: Required[int] - """Maximum number of tokens per chunk, must be between 100 and 4096""" + max_chunk_size_tokens: int class ChunkingStrategyVectorStoreChunkingStrategyStatic(TypedDict, total=False): static: Required[ChunkingStrategyVectorStoreChunkingStrategyStaticStatic] - """Configuration parameters for the static chunking strategy""" + """Configuration for static chunking strategy.""" - type: Required[Literal["static"]] - """Strategy type, always "static" for static chunking""" + type: Literal["static"] ChunkingStrategy: TypeAlias = Union[ diff --git a/src/llama_stack_client/types/vector_stores/file_delete_response.py b/src/llama_stack_client/types/vector_stores/file_delete_response.py index 741ad38b..96e84afb 100644 --- a/src/llama_stack_client/types/vector_stores/file_delete_response.py +++ b/src/llama_stack_client/types/vector_stores/file_delete_response.py @@ -6,6 +6,8 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional + from ..._models import BaseModel __all__ = ["FileDeleteResponse"] @@ -13,10 +15,7 @@ class FileDeleteResponse(BaseModel): id: str - """Unique identifier of the deleted file""" - deleted: bool - """Whether the deletion operation was successful""" + deleted: Optional[bool] = None - object: str - """Object type identifier for the deletion response""" + object: Optional[str] = None diff --git a/src/llama_stack_client/types/vector_stores/file_list_params.py b/src/llama_stack_client/types/vector_stores/file_list_params.py index adfeac65..bd1ba301 100644 --- a/src/llama_stack_client/types/vector_stores/file_list_params.py +++ b/src/llama_stack_client/types/vector_stores/file_list_params.py @@ -8,37 +8,19 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Literal, TypedDict __all__ = ["FileListParams"] class FileListParams(TypedDict, total=False): - after: str - """(Optional) A cursor for use in pagination. + after: Optional[str] - `after` is an object ID that defines your place in the list. - """ + before: Optional[str] - before: str - """(Optional) A cursor for use in pagination. + filter: Optional[Literal["completed", "in_progress", "cancelled", "failed"]] - `before` is an object ID that defines your place in the list. - """ + limit: Optional[int] - filter: Literal["completed", "in_progress", "cancelled", "failed"] - """ - (Optional) Filter by file status to only return files with the specified status. - """ - - limit: int - """(Optional) A limit on the number of objects to be returned. - - Limit can range between 1 and 100, and the default is 20. - """ - - order: str - """(Optional) Sort order by the `created_at` timestamp of the objects. - - `asc` for ascending order and `desc` for descending order. - """ + order: Optional[str] diff --git a/src/llama_stack_client/types/vector_stores/file_update_params.py b/src/llama_stack_client/types/vector_stores/file_update_params.py index 511b804a..f981329e 100644 --- a/src/llama_stack_client/types/vector_stores/file_update_params.py +++ b/src/llama_stack_client/types/vector_stores/file_update_params.py @@ -8,7 +8,7 @@ from __future__ import annotations -from typing import Dict, Union, Iterable +from typing import Dict from typing_extensions import Required, TypedDict __all__ = ["FileUpdateParams"] @@ -17,5 +17,4 @@ class FileUpdateParams(TypedDict, total=False): vector_store_id: Required[str] - attributes: Required[Dict[str, Union[bool, float, str, Iterable[object], object, None]]] - """The updated key-value attributes to store with the file.""" + attributes: Required[Dict[str, object]] diff --git a/src/llama_stack_client/types/vector_stores/list_vector_store_files_in_batch_response.py b/src/llama_stack_client/types/vector_stores/list_vector_store_files_in_batch_response.py index 7a7c7dba..fe068361 100644 --- a/src/llama_stack_client/types/vector_stores/list_vector_store_files_in_batch_response.py +++ b/src/llama_stack_client/types/vector_stores/list_vector_store_files_in_batch_response.py @@ -16,16 +16,11 @@ class ListVectorStoreFilesInBatchResponse(BaseModel): data: List[VectorStoreFile] - """List of vector store file objects in the batch""" - - has_more: bool - """Whether there are more files available beyond this page""" - - object: str - """Object type identifier, always "list" """ first_id: Optional[str] = None - """(Optional) ID of the first file in the list for pagination""" + + has_more: Optional[bool] = None last_id: Optional[str] = None - """(Optional) ID of the last file in the list for pagination""" + + object: Optional[str] = None diff --git a/src/llama_stack_client/types/vector_stores/vector_store_file.py b/src/llama_stack_client/types/vector_stores/vector_store_file.py index 03aaef6d..4248e618 100644 --- a/src/llama_stack_client/types/vector_stores/vector_store_file.py +++ b/src/llama_stack_client/types/vector_stores/vector_store_file.py @@ -6,7 +6,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Dict, List, Union, Optional +from typing import Dict, Union, Optional from typing_extensions import Literal, Annotated, TypeAlias from ..._utils import PropertyInfo @@ -23,24 +23,20 @@ class ChunkingStrategyVectorStoreChunkingStrategyAuto(BaseModel): - type: Literal["auto"] - """Strategy type, always "auto" for automatic chunking""" + type: Optional[Literal["auto"]] = None class ChunkingStrategyVectorStoreChunkingStrategyStaticStatic(BaseModel): - chunk_overlap_tokens: int - """Number of tokens to overlap between adjacent chunks""" + chunk_overlap_tokens: Optional[int] = None - max_chunk_size_tokens: int - """Maximum number of tokens per chunk, must be between 100 and 4096""" + max_chunk_size_tokens: Optional[int] = None class ChunkingStrategyVectorStoreChunkingStrategyStatic(BaseModel): static: ChunkingStrategyVectorStoreChunkingStrategyStaticStatic - """Configuration parameters for the static chunking strategy""" + """Configuration for static chunking strategy.""" - type: Literal["static"] - """Strategy type, always "static" for static chunking""" + type: Optional[Literal["static"]] = None ChunkingStrategy: TypeAlias = Annotated[ @@ -51,36 +47,27 @@ class ChunkingStrategyVectorStoreChunkingStrategyStatic(BaseModel): class LastError(BaseModel): code: Literal["server_error", "rate_limit_exceeded"] - """Error code indicating the type of failure""" message: str - """Human-readable error message describing the failure""" class VectorStoreFile(BaseModel): id: str - """Unique identifier for the file""" - - attributes: Dict[str, Union[bool, float, str, List[object], object, None]] - """Key-value attributes associated with the file""" chunking_strategy: ChunkingStrategy - """Strategy used for splitting the file into chunks""" + """Automatic chunking strategy for vector store files.""" created_at: int - """Timestamp when the file was added to the vector store""" - - object: str - """Object type identifier, always "vector_store.file" """ status: Literal["completed", "in_progress", "cancelled", "failed"] - """Current processing status of the file""" - - usage_bytes: int - """Storage space used by this file in bytes""" vector_store_id: str - """ID of the vector store containing this file""" + + attributes: Optional[Dict[str, object]] = None last_error: Optional[LastError] = None - """(Optional) Error information if file processing failed""" + """Error information for failed vector store file processing.""" + + object: Optional[str] = None + + usage_bytes: Optional[int] = None diff --git a/src/llama_stack_client/types/vector_stores/vector_store_file_batches.py b/src/llama_stack_client/types/vector_stores/vector_store_file_batches.py index 07164609..ba7ac1c7 100644 --- a/src/llama_stack_client/types/vector_stores/vector_store_file_batches.py +++ b/src/llama_stack_client/types/vector_stores/vector_store_file_batches.py @@ -6,6 +6,7 @@ # 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 @@ -15,36 +16,26 @@ class FileCounts(BaseModel): cancelled: int - """Number of files that had their processing cancelled""" completed: int - """Number of files that have been successfully processed""" failed: int - """Number of files that failed to process""" in_progress: int - """Number of files currently being processed""" total: int - """Total number of files in the vector store""" class VectorStoreFileBatches(BaseModel): id: str - """Unique identifier for the file batch""" created_at: int - """Timestamp when the file batch was created""" file_counts: FileCounts - """File processing status counts for the batch""" - - object: str - """Object type identifier, always "vector_store.file_batch" """ + """File processing status counts for a vector store.""" status: Literal["completed", "in_progress", "cancelled", "failed"] - """Current processing status of the file batch""" vector_store_id: str - """ID of the vector store containing the file batch""" + + object: Optional[str] = None diff --git a/src/llama_stack_client/types/version_info.py b/src/llama_stack_client/types/version_info.py index d2d0c8fd..36cfcbbd 100644 --- a/src/llama_stack_client/types/version_info.py +++ b/src/llama_stack_client/types/version_info.py @@ -13,4 +13,3 @@ class VersionInfo(BaseModel): version: str - """Version number of the service""" diff --git a/tests/api_resources/alpha/test_benchmarks.py b/tests/api_resources/alpha/test_benchmarks.py index eeb6c2f2..dcb89351 100644 --- a/tests/api_resources/alpha/test_benchmarks.py +++ b/tests/api_resources/alpha/test_benchmarks.py @@ -106,7 +106,7 @@ def test_method_register_with_all_params(self, client: LlamaStackClient) -> None benchmark_id="benchmark_id", dataset_id="dataset_id", scoring_functions=["string"], - metadata={"foo": True}, + metadata={"foo": "bar"}, provider_benchmark_id="provider_benchmark_id", provider_id="provider_id", ) @@ -143,6 +143,49 @@ def test_streaming_response_register(self, client: LlamaStackClient) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_unregister(self, client: LlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + benchmark = client.alpha.benchmarks.unregister( + "benchmark_id", + ) + + assert benchmark is None + + @parametrize + def test_raw_response_unregister(self, client: LlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + response = client.alpha.benchmarks.with_raw_response.unregister( + "benchmark_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + benchmark = response.parse() + assert benchmark is None + + @parametrize + def test_streaming_response_unregister(self, client: LlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + with client.alpha.benchmarks.with_streaming_response.unregister( + "benchmark_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + benchmark = response.parse() + assert benchmark is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_unregister(self, client: LlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `benchmark_id` but received ''"): + client.alpha.benchmarks.with_raw_response.unregister( + "", + ) + class TestAsyncBenchmarks: parametrize = pytest.mark.parametrize( @@ -230,7 +273,7 @@ async def test_method_register_with_all_params(self, async_client: AsyncLlamaSta benchmark_id="benchmark_id", dataset_id="dataset_id", scoring_functions=["string"], - metadata={"foo": True}, + metadata={"foo": "bar"}, provider_benchmark_id="provider_benchmark_id", provider_id="provider_id", ) @@ -266,3 +309,46 @@ async def test_streaming_response_register(self, async_client: AsyncLlamaStackCl assert benchmark is None assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_unregister(self, async_client: AsyncLlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + benchmark = await async_client.alpha.benchmarks.unregister( + "benchmark_id", + ) + + assert benchmark is None + + @parametrize + async def test_raw_response_unregister(self, async_client: AsyncLlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + response = await async_client.alpha.benchmarks.with_raw_response.unregister( + "benchmark_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + benchmark = await response.parse() + assert benchmark is None + + @parametrize + async def test_streaming_response_unregister(self, async_client: AsyncLlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + async with async_client.alpha.benchmarks.with_streaming_response.unregister( + "benchmark_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + benchmark = await response.parse() + assert benchmark is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_unregister(self, async_client: AsyncLlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `benchmark_id` but received ''"): + await async_client.alpha.benchmarks.with_raw_response.unregister( + "", + ) diff --git a/tests/api_resources/alpha/test_eval.py b/tests/api_resources/alpha/test_eval.py index 1ee20010..bc172330 100644 --- a/tests/api_resources/alpha/test_eval.py +++ b/tests/api_resources/alpha/test_eval.py @@ -33,19 +33,10 @@ def test_method_evaluate_rows(self, client: LlamaStackClient) -> None: benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) assert_matches_type(EvaluateResponse, eval, path=["response"]) @@ -58,29 +49,29 @@ def test_method_evaluate_rows_with_all_params(self, client: LlamaStackClient) -> "eval_candidate": { "model": "model", "sampling_params": { - "strategy": {"type": "greedy"}, "max_tokens": 0, "repetition_penalty": 0, "stop": ["string"], + "strategy": {"type": "greedy"}, }, - "type": "model", "system_message": { "content": "string", "role": "system", }, + "type": "model", }, + "num_examples": 0, "scoring_params": { "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", + "aggregation_functions": ["average"], "judge_score_regexes": ["string"], - "type": "llm_as_judge", "prompt_template": "prompt_template", + "type": "llm_as_judge", } }, - "num_examples": 0, }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) assert_matches_type(EvaluateResponse, eval, path=["response"]) @@ -92,19 +83,10 @@ def test_raw_response_evaluate_rows(self, client: LlamaStackClient) -> None: benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) @@ -120,19 +102,10 @@ def test_streaming_response_evaluate_rows(self, client: LlamaStackClient) -> Non benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) as response: assert not response.is_closed @@ -151,19 +124,10 @@ def test_path_params_evaluate_rows(self, client: LlamaStackClient) -> None: benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) @@ -174,19 +138,10 @@ def test_method_evaluate_rows_alpha(self, client: LlamaStackClient) -> None: benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) assert_matches_type(EvaluateResponse, eval, path=["response"]) @@ -199,29 +154,29 @@ def test_method_evaluate_rows_alpha_with_all_params(self, client: LlamaStackClie "eval_candidate": { "model": "model", "sampling_params": { - "strategy": {"type": "greedy"}, "max_tokens": 0, "repetition_penalty": 0, "stop": ["string"], + "strategy": {"type": "greedy"}, }, - "type": "model", "system_message": { "content": "string", "role": "system", }, + "type": "model", }, + "num_examples": 0, "scoring_params": { "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", + "aggregation_functions": ["average"], "judge_score_regexes": ["string"], - "type": "llm_as_judge", "prompt_template": "prompt_template", + "type": "llm_as_judge", } }, - "num_examples": 0, }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) assert_matches_type(EvaluateResponse, eval, path=["response"]) @@ -233,19 +188,10 @@ def test_raw_response_evaluate_rows_alpha(self, client: LlamaStackClient) -> Non benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) @@ -261,19 +207,10 @@ def test_streaming_response_evaluate_rows_alpha(self, client: LlamaStackClient) benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) as response: assert not response.is_closed @@ -292,19 +229,10 @@ def test_path_params_evaluate_rows_alpha(self, client: LlamaStackClient) -> None benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) @@ -312,20 +240,9 @@ def test_path_params_evaluate_rows_alpha(self, client: LlamaStackClient) -> None def test_method_run_eval(self, client: LlamaStackClient) -> None: eval = client.alpha.eval.run_eval( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) assert_matches_type(Job, eval, path=["response"]) @@ -334,31 +251,29 @@ def test_method_run_eval(self, client: LlamaStackClient) -> None: def test_method_run_eval_with_all_params(self, client: LlamaStackClient) -> None: eval = client.alpha.eval.run_eval( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": { - "strategy": {"type": "greedy"}, - "max_tokens": 0, - "repetition_penalty": 0, - "stop": ["string"], - }, - "type": "model", - "system_message": { - "content": "string", - "role": "system", - }, - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - "prompt_template": "prompt_template", - } - }, - "num_examples": 0, + eval_candidate={ + "model": "model", + "sampling_params": { + "max_tokens": 0, + "repetition_penalty": 0, + "stop": ["string"], + "strategy": {"type": "greedy"}, + }, + "system_message": { + "content": "string", + "role": "system", + }, + "type": "model", + }, + num_examples=0, + scoring_params={ + "foo": { + "judge_model": "judge_model", + "aggregation_functions": ["average"], + "judge_score_regexes": ["string"], + "prompt_template": "prompt_template", + "type": "llm_as_judge", + } }, ) assert_matches_type(Job, eval, path=["response"]) @@ -367,20 +282,9 @@ def test_method_run_eval_with_all_params(self, client: LlamaStackClient) -> None def test_raw_response_run_eval(self, client: LlamaStackClient) -> None: response = client.alpha.eval.with_raw_response.run_eval( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) @@ -393,20 +297,9 @@ def test_raw_response_run_eval(self, client: LlamaStackClient) -> None: def test_streaming_response_run_eval(self, client: LlamaStackClient) -> None: with client.alpha.eval.with_streaming_response.run_eval( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) as response: assert not response.is_closed @@ -422,20 +315,9 @@ def test_path_params_run_eval(self, client: LlamaStackClient) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `benchmark_id` but received ''"): client.alpha.eval.with_raw_response.run_eval( benchmark_id="", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) @@ -443,20 +325,9 @@ def test_path_params_run_eval(self, client: LlamaStackClient) -> None: def test_method_run_eval_alpha(self, client: LlamaStackClient) -> None: eval = client.alpha.eval.run_eval_alpha( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) assert_matches_type(Job, eval, path=["response"]) @@ -465,31 +336,29 @@ def test_method_run_eval_alpha(self, client: LlamaStackClient) -> None: def test_method_run_eval_alpha_with_all_params(self, client: LlamaStackClient) -> None: eval = client.alpha.eval.run_eval_alpha( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": { - "strategy": {"type": "greedy"}, - "max_tokens": 0, - "repetition_penalty": 0, - "stop": ["string"], - }, - "type": "model", - "system_message": { - "content": "string", - "role": "system", - }, - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - "prompt_template": "prompt_template", - } - }, - "num_examples": 0, + eval_candidate={ + "model": "model", + "sampling_params": { + "max_tokens": 0, + "repetition_penalty": 0, + "stop": ["string"], + "strategy": {"type": "greedy"}, + }, + "system_message": { + "content": "string", + "role": "system", + }, + "type": "model", + }, + num_examples=0, + scoring_params={ + "foo": { + "judge_model": "judge_model", + "aggregation_functions": ["average"], + "judge_score_regexes": ["string"], + "prompt_template": "prompt_template", + "type": "llm_as_judge", + } }, ) assert_matches_type(Job, eval, path=["response"]) @@ -498,20 +367,9 @@ def test_method_run_eval_alpha_with_all_params(self, client: LlamaStackClient) - def test_raw_response_run_eval_alpha(self, client: LlamaStackClient) -> None: response = client.alpha.eval.with_raw_response.run_eval_alpha( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) @@ -524,20 +382,9 @@ def test_raw_response_run_eval_alpha(self, client: LlamaStackClient) -> None: def test_streaming_response_run_eval_alpha(self, client: LlamaStackClient) -> None: with client.alpha.eval.with_streaming_response.run_eval_alpha( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) as response: assert not response.is_closed @@ -553,20 +400,9 @@ def test_path_params_run_eval_alpha(self, client: LlamaStackClient) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `benchmark_id` but received ''"): client.alpha.eval.with_raw_response.run_eval_alpha( benchmark_id="", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) @@ -583,19 +419,10 @@ async def test_method_evaluate_rows(self, async_client: AsyncLlamaStackClient) - benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) assert_matches_type(EvaluateResponse, eval, path=["response"]) @@ -608,29 +435,29 @@ async def test_method_evaluate_rows_with_all_params(self, async_client: AsyncLla "eval_candidate": { "model": "model", "sampling_params": { - "strategy": {"type": "greedy"}, "max_tokens": 0, "repetition_penalty": 0, "stop": ["string"], + "strategy": {"type": "greedy"}, }, - "type": "model", "system_message": { "content": "string", "role": "system", }, + "type": "model", }, + "num_examples": 0, "scoring_params": { "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", + "aggregation_functions": ["average"], "judge_score_regexes": ["string"], - "type": "llm_as_judge", "prompt_template": "prompt_template", + "type": "llm_as_judge", } }, - "num_examples": 0, }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) assert_matches_type(EvaluateResponse, eval, path=["response"]) @@ -642,19 +469,10 @@ async def test_raw_response_evaluate_rows(self, async_client: AsyncLlamaStackCli benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) @@ -670,19 +488,10 @@ async def test_streaming_response_evaluate_rows(self, async_client: AsyncLlamaSt benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) as response: assert not response.is_closed @@ -701,19 +510,10 @@ async def test_path_params_evaluate_rows(self, async_client: AsyncLlamaStackClie benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) @@ -724,19 +524,10 @@ async def test_method_evaluate_rows_alpha(self, async_client: AsyncLlamaStackCli benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) assert_matches_type(EvaluateResponse, eval, path=["response"]) @@ -749,29 +540,29 @@ async def test_method_evaluate_rows_alpha_with_all_params(self, async_client: As "eval_candidate": { "model": "model", "sampling_params": { - "strategy": {"type": "greedy"}, "max_tokens": 0, "repetition_penalty": 0, "stop": ["string"], + "strategy": {"type": "greedy"}, }, - "type": "model", "system_message": { "content": "string", "role": "system", }, + "type": "model", }, + "num_examples": 0, "scoring_params": { "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", + "aggregation_functions": ["average"], "judge_score_regexes": ["string"], - "type": "llm_as_judge", "prompt_template": "prompt_template", + "type": "llm_as_judge", } }, - "num_examples": 0, }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) assert_matches_type(EvaluateResponse, eval, path=["response"]) @@ -783,19 +574,10 @@ async def test_raw_response_evaluate_rows_alpha(self, async_client: AsyncLlamaSt benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) @@ -811,19 +593,10 @@ async def test_streaming_response_evaluate_rows_alpha(self, async_client: AsyncL benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) as response: assert not response.is_closed @@ -842,19 +615,10 @@ async def test_path_params_evaluate_rows_alpha(self, async_client: AsyncLlamaSta benchmark_config={ "eval_candidate": { "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + "sampling_params": {}, + } }, - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions=["string"], ) @@ -862,20 +626,9 @@ async def test_path_params_evaluate_rows_alpha(self, async_client: AsyncLlamaSta async def test_method_run_eval(self, async_client: AsyncLlamaStackClient) -> None: eval = await async_client.alpha.eval.run_eval( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) assert_matches_type(Job, eval, path=["response"]) @@ -884,31 +637,29 @@ async def test_method_run_eval(self, async_client: AsyncLlamaStackClient) -> Non async def test_method_run_eval_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: eval = await async_client.alpha.eval.run_eval( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": { - "strategy": {"type": "greedy"}, - "max_tokens": 0, - "repetition_penalty": 0, - "stop": ["string"], - }, - "type": "model", - "system_message": { - "content": "string", - "role": "system", - }, - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - "prompt_template": "prompt_template", - } - }, - "num_examples": 0, + eval_candidate={ + "model": "model", + "sampling_params": { + "max_tokens": 0, + "repetition_penalty": 0, + "stop": ["string"], + "strategy": {"type": "greedy"}, + }, + "system_message": { + "content": "string", + "role": "system", + }, + "type": "model", + }, + num_examples=0, + scoring_params={ + "foo": { + "judge_model": "judge_model", + "aggregation_functions": ["average"], + "judge_score_regexes": ["string"], + "prompt_template": "prompt_template", + "type": "llm_as_judge", + } }, ) assert_matches_type(Job, eval, path=["response"]) @@ -917,20 +668,9 @@ async def test_method_run_eval_with_all_params(self, async_client: AsyncLlamaSta async def test_raw_response_run_eval(self, async_client: AsyncLlamaStackClient) -> None: response = await async_client.alpha.eval.with_raw_response.run_eval( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) @@ -943,20 +683,9 @@ async def test_raw_response_run_eval(self, async_client: AsyncLlamaStackClient) async def test_streaming_response_run_eval(self, async_client: AsyncLlamaStackClient) -> None: async with async_client.alpha.eval.with_streaming_response.run_eval( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) as response: assert not response.is_closed @@ -972,20 +701,9 @@ async def test_path_params_run_eval(self, async_client: AsyncLlamaStackClient) - with pytest.raises(ValueError, match=r"Expected a non-empty value for `benchmark_id` but received ''"): await async_client.alpha.eval.with_raw_response.run_eval( benchmark_id="", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) @@ -993,20 +711,9 @@ async def test_path_params_run_eval(self, async_client: AsyncLlamaStackClient) - async def test_method_run_eval_alpha(self, async_client: AsyncLlamaStackClient) -> None: eval = await async_client.alpha.eval.run_eval_alpha( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) assert_matches_type(Job, eval, path=["response"]) @@ -1015,31 +722,29 @@ async def test_method_run_eval_alpha(self, async_client: AsyncLlamaStackClient) async def test_method_run_eval_alpha_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: eval = await async_client.alpha.eval.run_eval_alpha( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": { - "strategy": {"type": "greedy"}, - "max_tokens": 0, - "repetition_penalty": 0, - "stop": ["string"], - }, - "type": "model", - "system_message": { - "content": "string", - "role": "system", - }, - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - "prompt_template": "prompt_template", - } - }, - "num_examples": 0, + eval_candidate={ + "model": "model", + "sampling_params": { + "max_tokens": 0, + "repetition_penalty": 0, + "stop": ["string"], + "strategy": {"type": "greedy"}, + }, + "system_message": { + "content": "string", + "role": "system", + }, + "type": "model", + }, + num_examples=0, + scoring_params={ + "foo": { + "judge_model": "judge_model", + "aggregation_functions": ["average"], + "judge_score_regexes": ["string"], + "prompt_template": "prompt_template", + "type": "llm_as_judge", + } }, ) assert_matches_type(Job, eval, path=["response"]) @@ -1048,20 +753,9 @@ async def test_method_run_eval_alpha_with_all_params(self, async_client: AsyncLl async def test_raw_response_run_eval_alpha(self, async_client: AsyncLlamaStackClient) -> None: response = await async_client.alpha.eval.with_raw_response.run_eval_alpha( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) @@ -1074,20 +768,9 @@ async def test_raw_response_run_eval_alpha(self, async_client: AsyncLlamaStackCl async def test_streaming_response_run_eval_alpha(self, async_client: AsyncLlamaStackClient) -> None: async with async_client.alpha.eval.with_streaming_response.run_eval_alpha( benchmark_id="benchmark_id", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) as response: assert not response.is_closed @@ -1103,19 +786,8 @@ async def test_path_params_run_eval_alpha(self, async_client: AsyncLlamaStackCli with pytest.raises(ValueError, match=r"Expected a non-empty value for `benchmark_id` but received ''"): await async_client.alpha.eval.with_raw_response.run_eval_alpha( benchmark_id="", - benchmark_config={ - "eval_candidate": { - "model": "model", - "sampling_params": {"strategy": {"type": "greedy"}}, - "type": "model", - }, - "scoring_params": { - "foo": { - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - } - }, + eval_candidate={ + "model": "model", + "sampling_params": {}, }, ) diff --git a/tests/api_resources/alpha/test_post_training.py b/tests/api_resources/alpha/test_post_training.py index 92f45593..21fdd345 100644 --- a/tests/api_resources/alpha/test_post_training.py +++ b/tests/api_resources/alpha/test_post_training.py @@ -28,19 +28,12 @@ class TestPostTraining: @parametrize def test_method_preference_optimize(self, client: LlamaStackClient) -> None: post_training = client.alpha.post_training.preference_optimize( - algorithm_config={ - "beta": 0, - "loss_type": "sigmoid", - }, + algorithm_config={"beta": 0}, finetuned_model="finetuned_model", - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) assert_matches_type(PostTrainingJob, post_training, path=["response"]) @@ -52,12 +45,10 @@ def test_method_preference_optimize_with_all_params(self, client: LlamaStackClie "loss_type": "sigmoid", }, finetuned_model="finetuned_model", - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, + logger_config={"foo": "bar"}, training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, "n_epochs": 0, "data_config": { "batch_size": 0, @@ -75,6 +66,8 @@ def test_method_preference_optimize_with_all_params(self, client: LlamaStackClie "fsdp_cpu_offload": True, "memory_efficient_fsdp_wrap": True, }, + "gradient_accumulation_steps": 0, + "max_steps_per_epoch": 0, "max_validation_steps": 0, "optimizer_config": { "lr": 0, @@ -89,19 +82,12 @@ def test_method_preference_optimize_with_all_params(self, client: LlamaStackClie @parametrize def test_raw_response_preference_optimize(self, client: LlamaStackClient) -> None: response = client.alpha.post_training.with_raw_response.preference_optimize( - algorithm_config={ - "beta": 0, - "loss_type": "sigmoid", - }, + algorithm_config={"beta": 0}, finetuned_model="finetuned_model", - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) assert response.is_closed is True @@ -112,19 +98,12 @@ def test_raw_response_preference_optimize(self, client: LlamaStackClient) -> Non @parametrize def test_streaming_response_preference_optimize(self, client: LlamaStackClient) -> None: with client.alpha.post_training.with_streaming_response.preference_optimize( - algorithm_config={ - "beta": 0, - "loss_type": "sigmoid", - }, + algorithm_config={"beta": 0}, finetuned_model="finetuned_model", - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -137,26 +116,20 @@ def test_streaming_response_preference_optimize(self, client: LlamaStackClient) @parametrize def test_method_supervised_fine_tune(self, client: LlamaStackClient) -> None: post_training = client.alpha.post_training.supervised_fine_tune( - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) assert_matches_type(PostTrainingJob, post_training, path=["response"]) @parametrize def test_method_supervised_fine_tune_with_all_params(self, client: LlamaStackClient) -> None: post_training = client.alpha.post_training.supervised_fine_tune( - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, + logger_config={"foo": "bar"}, training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, "n_epochs": 0, "data_config": { "batch_size": 0, @@ -174,6 +147,8 @@ def test_method_supervised_fine_tune_with_all_params(self, client: LlamaStackCli "fsdp_cpu_offload": True, "memory_efficient_fsdp_wrap": True, }, + "gradient_accumulation_steps": 0, + "max_steps_per_epoch": 0, "max_validation_steps": 0, "optimizer_config": { "lr": 0, @@ -188,8 +163,8 @@ def test_method_supervised_fine_tune_with_all_params(self, client: LlamaStackCli "apply_lora_to_output": True, "lora_attn_modules": ["string"], "rank": 0, - "type": "LoRA", "quantize_base": True, + "type": "LoRA", "use_dora": True, }, checkpoint_dir="checkpoint_dir", @@ -200,14 +175,10 @@ def test_method_supervised_fine_tune_with_all_params(self, client: LlamaStackCli @parametrize def test_raw_response_supervised_fine_tune(self, client: LlamaStackClient) -> None: response = client.alpha.post_training.with_raw_response.supervised_fine_tune( - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) assert response.is_closed is True @@ -218,14 +189,10 @@ def test_raw_response_supervised_fine_tune(self, client: LlamaStackClient) -> No @parametrize def test_streaming_response_supervised_fine_tune(self, client: LlamaStackClient) -> None: with client.alpha.post_training.with_streaming_response.supervised_fine_tune( - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -244,19 +211,12 @@ class TestAsyncPostTraining: @parametrize async def test_method_preference_optimize(self, async_client: AsyncLlamaStackClient) -> None: post_training = await async_client.alpha.post_training.preference_optimize( - algorithm_config={ - "beta": 0, - "loss_type": "sigmoid", - }, + algorithm_config={"beta": 0}, finetuned_model="finetuned_model", - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) assert_matches_type(PostTrainingJob, post_training, path=["response"]) @@ -268,12 +228,10 @@ async def test_method_preference_optimize_with_all_params(self, async_client: As "loss_type": "sigmoid", }, finetuned_model="finetuned_model", - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, + logger_config={"foo": "bar"}, training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, "n_epochs": 0, "data_config": { "batch_size": 0, @@ -291,6 +249,8 @@ async def test_method_preference_optimize_with_all_params(self, async_client: As "fsdp_cpu_offload": True, "memory_efficient_fsdp_wrap": True, }, + "gradient_accumulation_steps": 0, + "max_steps_per_epoch": 0, "max_validation_steps": 0, "optimizer_config": { "lr": 0, @@ -305,19 +265,12 @@ async def test_method_preference_optimize_with_all_params(self, async_client: As @parametrize async def test_raw_response_preference_optimize(self, async_client: AsyncLlamaStackClient) -> None: response = await async_client.alpha.post_training.with_raw_response.preference_optimize( - algorithm_config={ - "beta": 0, - "loss_type": "sigmoid", - }, + algorithm_config={"beta": 0}, finetuned_model="finetuned_model", - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) assert response.is_closed is True @@ -328,19 +281,12 @@ async def test_raw_response_preference_optimize(self, async_client: AsyncLlamaSt @parametrize async def test_streaming_response_preference_optimize(self, async_client: AsyncLlamaStackClient) -> None: async with async_client.alpha.post_training.with_streaming_response.preference_optimize( - algorithm_config={ - "beta": 0, - "loss_type": "sigmoid", - }, + algorithm_config={"beta": 0}, finetuned_model="finetuned_model", - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -353,26 +299,20 @@ async def test_streaming_response_preference_optimize(self, async_client: AsyncL @parametrize async def test_method_supervised_fine_tune(self, async_client: AsyncLlamaStackClient) -> None: post_training = await async_client.alpha.post_training.supervised_fine_tune( - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) assert_matches_type(PostTrainingJob, post_training, path=["response"]) @parametrize async def test_method_supervised_fine_tune_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: post_training = await async_client.alpha.post_training.supervised_fine_tune( - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, + logger_config={"foo": "bar"}, training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, "n_epochs": 0, "data_config": { "batch_size": 0, @@ -390,6 +330,8 @@ async def test_method_supervised_fine_tune_with_all_params(self, async_client: A "fsdp_cpu_offload": True, "memory_efficient_fsdp_wrap": True, }, + "gradient_accumulation_steps": 0, + "max_steps_per_epoch": 0, "max_validation_steps": 0, "optimizer_config": { "lr": 0, @@ -404,8 +346,8 @@ async def test_method_supervised_fine_tune_with_all_params(self, async_client: A "apply_lora_to_output": True, "lora_attn_modules": ["string"], "rank": 0, - "type": "LoRA", "quantize_base": True, + "type": "LoRA", "use_dora": True, }, checkpoint_dir="checkpoint_dir", @@ -416,14 +358,10 @@ async def test_method_supervised_fine_tune_with_all_params(self, async_client: A @parametrize async def test_raw_response_supervised_fine_tune(self, async_client: AsyncLlamaStackClient) -> None: response = await async_client.alpha.post_training.with_raw_response.supervised_fine_tune( - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) assert response.is_closed is True @@ -434,14 +372,10 @@ async def test_raw_response_supervised_fine_tune(self, async_client: AsyncLlamaS @parametrize async def test_streaming_response_supervised_fine_tune(self, async_client: AsyncLlamaStackClient) -> None: async with async_client.alpha.post_training.with_streaming_response.supervised_fine_tune( - hyperparam_search_config={"foo": True}, + hyperparam_search_config={"foo": "bar"}, job_uuid="job_uuid", - logger_config={"foo": True}, - training_config={ - "gradient_accumulation_steps": 0, - "max_steps_per_epoch": 0, - "n_epochs": 0, - }, + logger_config={"foo": "bar"}, + training_config={"n_epochs": 0}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/beta/test_datasets.py b/tests/api_resources/beta/test_datasets.py index 026bc23d..de5faf60 100644 --- a/tests/api_resources/beta/test_datasets.py +++ b/tests/api_resources/beta/test_datasets.py @@ -97,7 +97,7 @@ def test_streaming_response_list(self, client: LlamaStackClient) -> None: def test_method_appendrows(self, client: LlamaStackClient) -> None: dataset = client.beta.datasets.appendrows( dataset_id="dataset_id", - rows=[{"foo": True}], + rows=[{"foo": "bar"}], ) assert dataset is None @@ -105,7 +105,7 @@ def test_method_appendrows(self, client: LlamaStackClient) -> None: def test_raw_response_appendrows(self, client: LlamaStackClient) -> None: response = client.beta.datasets.with_raw_response.appendrows( dataset_id="dataset_id", - rows=[{"foo": True}], + rows=[{"foo": "bar"}], ) assert response.is_closed is True @@ -117,7 +117,7 @@ def test_raw_response_appendrows(self, client: LlamaStackClient) -> None: def test_streaming_response_appendrows(self, client: LlamaStackClient) -> None: with client.beta.datasets.with_streaming_response.appendrows( dataset_id="dataset_id", - rows=[{"foo": True}], + rows=[{"foo": "bar"}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -132,7 +132,7 @@ def test_path_params_appendrows(self, client: LlamaStackClient) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `dataset_id` but received ''"): client.beta.datasets.with_raw_response.appendrows( dataset_id="", - rows=[{"foo": True}], + rows=[{"foo": "bar"}], ) @parametrize @@ -186,11 +186,8 @@ def test_path_params_iterrows(self, client: LlamaStackClient) -> None: def test_method_register(self, client: LlamaStackClient) -> None: with pytest.warns(DeprecationWarning): dataset = client.beta.datasets.register( - purpose="post-training/messages", - source={ - "type": "uri", - "uri": "uri", - }, + purpose={}, + source={}, ) assert_matches_type(DatasetRegisterResponse, dataset, path=["response"]) @@ -199,13 +196,10 @@ def test_method_register(self, client: LlamaStackClient) -> None: def test_method_register_with_all_params(self, client: LlamaStackClient) -> None: with pytest.warns(DeprecationWarning): dataset = client.beta.datasets.register( - purpose="post-training/messages", - source={ - "type": "uri", - "uri": "uri", - }, - dataset_id="dataset_id", - metadata={"foo": True}, + purpose={}, + source={}, + dataset_id={}, + metadata={}, ) assert_matches_type(DatasetRegisterResponse, dataset, path=["response"]) @@ -214,11 +208,8 @@ def test_method_register_with_all_params(self, client: LlamaStackClient) -> None def test_raw_response_register(self, client: LlamaStackClient) -> None: with pytest.warns(DeprecationWarning): response = client.beta.datasets.with_raw_response.register( - purpose="post-training/messages", - source={ - "type": "uri", - "uri": "uri", - }, + purpose={}, + source={}, ) assert response.is_closed is True @@ -230,11 +221,8 @@ def test_raw_response_register(self, client: LlamaStackClient) -> None: def test_streaming_response_register(self, client: LlamaStackClient) -> None: with pytest.warns(DeprecationWarning): with client.beta.datasets.with_streaming_response.register( - purpose="post-training/messages", - source={ - "type": "uri", - "uri": "uri", - }, + purpose={}, + source={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -360,7 +348,7 @@ async def test_streaming_response_list(self, async_client: AsyncLlamaStackClient async def test_method_appendrows(self, async_client: AsyncLlamaStackClient) -> None: dataset = await async_client.beta.datasets.appendrows( dataset_id="dataset_id", - rows=[{"foo": True}], + rows=[{"foo": "bar"}], ) assert dataset is None @@ -368,7 +356,7 @@ async def test_method_appendrows(self, async_client: AsyncLlamaStackClient) -> N async def test_raw_response_appendrows(self, async_client: AsyncLlamaStackClient) -> None: response = await async_client.beta.datasets.with_raw_response.appendrows( dataset_id="dataset_id", - rows=[{"foo": True}], + rows=[{"foo": "bar"}], ) assert response.is_closed is True @@ -380,7 +368,7 @@ async def test_raw_response_appendrows(self, async_client: AsyncLlamaStackClient async def test_streaming_response_appendrows(self, async_client: AsyncLlamaStackClient) -> None: async with async_client.beta.datasets.with_streaming_response.appendrows( dataset_id="dataset_id", - rows=[{"foo": True}], + rows=[{"foo": "bar"}], ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -395,7 +383,7 @@ async def test_path_params_appendrows(self, async_client: AsyncLlamaStackClient) with pytest.raises(ValueError, match=r"Expected a non-empty value for `dataset_id` but received ''"): await async_client.beta.datasets.with_raw_response.appendrows( dataset_id="", - rows=[{"foo": True}], + rows=[{"foo": "bar"}], ) @parametrize @@ -449,11 +437,8 @@ async def test_path_params_iterrows(self, async_client: AsyncLlamaStackClient) - async def test_method_register(self, async_client: AsyncLlamaStackClient) -> None: with pytest.warns(DeprecationWarning): dataset = await async_client.beta.datasets.register( - purpose="post-training/messages", - source={ - "type": "uri", - "uri": "uri", - }, + purpose={}, + source={}, ) assert_matches_type(DatasetRegisterResponse, dataset, path=["response"]) @@ -462,13 +447,10 @@ async def test_method_register(self, async_client: AsyncLlamaStackClient) -> Non async def test_method_register_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: with pytest.warns(DeprecationWarning): dataset = await async_client.beta.datasets.register( - purpose="post-training/messages", - source={ - "type": "uri", - "uri": "uri", - }, - dataset_id="dataset_id", - metadata={"foo": True}, + purpose={}, + source={}, + dataset_id={}, + metadata={}, ) assert_matches_type(DatasetRegisterResponse, dataset, path=["response"]) @@ -477,11 +459,8 @@ async def test_method_register_with_all_params(self, async_client: AsyncLlamaSta async def test_raw_response_register(self, async_client: AsyncLlamaStackClient) -> None: with pytest.warns(DeprecationWarning): response = await async_client.beta.datasets.with_raw_response.register( - purpose="post-training/messages", - source={ - "type": "uri", - "uri": "uri", - }, + purpose={}, + source={}, ) assert response.is_closed is True @@ -493,11 +472,8 @@ async def test_raw_response_register(self, async_client: AsyncLlamaStackClient) async def test_streaming_response_register(self, async_client: AsyncLlamaStackClient) -> None: with pytest.warns(DeprecationWarning): async with async_client.beta.datasets.with_streaming_response.register( - purpose="post-training/messages", - source={ - "type": "uri", - "uri": "uri", - }, + purpose={}, + source={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/chat/test_completions.py b/tests/api_resources/chat/test_completions.py index 45d508c0..6515530b 100644 --- a/tests/api_resources/chat/test_completions.py +++ b/tests/api_resources/chat/test_completions.py @@ -15,7 +15,6 @@ from tests.utils import assert_matches_type from llama_stack_client import LlamaStackClient, AsyncLlamaStackClient -from llama_stack_client.pagination import SyncOpenAICursorPage, AsyncOpenAICursorPage from llama_stack_client.types.chat import ( CompletionListResponse, CompletionCreateResponse, @@ -47,14 +46,14 @@ def test_method_create_with_all_params_overload_1(self, client: LlamaStackClient messages=[ { "content": "string", - "role": "user", "name": "name", + "role": "user", } ], model="model", frequency_penalty=0, function_call="string", - functions=[{"foo": True}], + functions=[{"foo": "bar"}], logit_bias={"foo": 0}, logprobs=True, max_completion_tokens=0, @@ -66,10 +65,10 @@ def test_method_create_with_all_params_overload_1(self, client: LlamaStackClient seed=0, stop="string", stream=False, - stream_options={"foo": True}, + stream_options={"foo": "bar"}, temperature=0, tool_choice="string", - tools=[{"foo": True}], + tools=[{"foo": "bar"}], top_logprobs=0, top_p=0, user="user", @@ -132,15 +131,15 @@ def test_method_create_with_all_params_overload_2(self, client: LlamaStackClient messages=[ { "content": "string", - "role": "user", "name": "name", + "role": "user", } ], model="model", stream=True, frequency_penalty=0, function_call="string", - functions=[{"foo": True}], + functions=[{"foo": "bar"}], logit_bias={"foo": 0}, logprobs=True, max_completion_tokens=0, @@ -151,10 +150,10 @@ def test_method_create_with_all_params_overload_2(self, client: LlamaStackClient response_format={"type": "text"}, seed=0, stop="string", - stream_options={"foo": True}, + stream_options={"foo": "bar"}, temperature=0, tool_choice="string", - tools=[{"foo": True}], + tools=[{"foo": "bar"}], top_logprobs=0, top_p=0, user="user", @@ -239,7 +238,7 @@ def test_path_params_retrieve(self, client: LlamaStackClient) -> None: @parametrize def test_method_list(self, client: LlamaStackClient) -> None: completion = client.chat.completions.list() - assert_matches_type(SyncOpenAICursorPage[CompletionListResponse], completion, path=["response"]) + assert_matches_type(CompletionListResponse, completion, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: LlamaStackClient) -> None: @@ -249,7 +248,7 @@ def test_method_list_with_all_params(self, client: LlamaStackClient) -> None: model="model", order="asc", ) - assert_matches_type(SyncOpenAICursorPage[CompletionListResponse], completion, path=["response"]) + assert_matches_type(CompletionListResponse, completion, path=["response"]) @parametrize def test_raw_response_list(self, client: LlamaStackClient) -> None: @@ -258,7 +257,7 @@ def test_raw_response_list(self, client: LlamaStackClient) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" completion = response.parse() - assert_matches_type(SyncOpenAICursorPage[CompletionListResponse], completion, path=["response"]) + assert_matches_type(CompletionListResponse, completion, path=["response"]) @parametrize def test_streaming_response_list(self, client: LlamaStackClient) -> None: @@ -267,7 +266,7 @@ def test_streaming_response_list(self, client: LlamaStackClient) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" completion = response.parse() - assert_matches_type(SyncOpenAICursorPage[CompletionListResponse], completion, path=["response"]) + assert_matches_type(CompletionListResponse, completion, path=["response"]) assert cast(Any, response.is_closed) is True @@ -296,14 +295,14 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn messages=[ { "content": "string", - "role": "user", "name": "name", + "role": "user", } ], model="model", frequency_penalty=0, function_call="string", - functions=[{"foo": True}], + functions=[{"foo": "bar"}], logit_bias={"foo": 0}, logprobs=True, max_completion_tokens=0, @@ -315,10 +314,10 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn seed=0, stop="string", stream=False, - stream_options={"foo": True}, + stream_options={"foo": "bar"}, temperature=0, tool_choice="string", - tools=[{"foo": True}], + tools=[{"foo": "bar"}], top_logprobs=0, top_p=0, user="user", @@ -381,15 +380,15 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn messages=[ { "content": "string", - "role": "user", "name": "name", + "role": "user", } ], model="model", stream=True, frequency_penalty=0, function_call="string", - functions=[{"foo": True}], + functions=[{"foo": "bar"}], logit_bias={"foo": 0}, logprobs=True, max_completion_tokens=0, @@ -400,10 +399,10 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn response_format={"type": "text"}, seed=0, stop="string", - stream_options={"foo": True}, + stream_options={"foo": "bar"}, temperature=0, tool_choice="string", - tools=[{"foo": True}], + tools=[{"foo": "bar"}], top_logprobs=0, top_p=0, user="user", @@ -488,7 +487,7 @@ async def test_path_params_retrieve(self, async_client: AsyncLlamaStackClient) - @parametrize async def test_method_list(self, async_client: AsyncLlamaStackClient) -> None: completion = await async_client.chat.completions.list() - assert_matches_type(AsyncOpenAICursorPage[CompletionListResponse], completion, path=["response"]) + assert_matches_type(CompletionListResponse, completion, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: @@ -498,7 +497,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncLlamaStackCl model="model", order="asc", ) - assert_matches_type(AsyncOpenAICursorPage[CompletionListResponse], completion, path=["response"]) + assert_matches_type(CompletionListResponse, completion, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncLlamaStackClient) -> None: @@ -507,7 +506,7 @@ async def test_raw_response_list(self, async_client: AsyncLlamaStackClient) -> N assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" completion = await response.parse() - assert_matches_type(AsyncOpenAICursorPage[CompletionListResponse], completion, path=["response"]) + assert_matches_type(CompletionListResponse, completion, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncLlamaStackClient) -> None: @@ -516,6 +515,6 @@ async def test_streaming_response_list(self, async_client: AsyncLlamaStackClient assert response.http_request.headers.get("X-Stainless-Lang") == "python" completion = await response.parse() - assert_matches_type(AsyncOpenAICursorPage[CompletionListResponse], completion, path=["response"]) + assert_matches_type(CompletionListResponse, completion, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/conversations/test_items.py b/tests/api_resources/conversations/test_items.py index 2d2ce821..7938cdc4 100644 --- a/tests/api_resources/conversations/test_items.py +++ b/tests/api_resources/conversations/test_items.py @@ -20,6 +20,7 @@ ItemGetResponse, ItemListResponse, ItemCreateResponse, + ItemDeleteResponse, ) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -143,6 +144,54 @@ def test_path_params_list(self, client: LlamaStackClient) -> None: conversation_id="", ) + @parametrize + def test_method_delete(self, client: LlamaStackClient) -> None: + item = client.conversations.items.delete( + item_id="item_id", + conversation_id="conversation_id", + ) + assert_matches_type(ItemDeleteResponse, item, path=["response"]) + + @parametrize + def test_raw_response_delete(self, client: LlamaStackClient) -> None: + response = client.conversations.items.with_raw_response.delete( + item_id="item_id", + conversation_id="conversation_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + item = response.parse() + assert_matches_type(ItemDeleteResponse, item, path=["response"]) + + @parametrize + def test_streaming_response_delete(self, client: LlamaStackClient) -> None: + with client.conversations.items.with_streaming_response.delete( + item_id="item_id", + conversation_id="conversation_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + item = response.parse() + assert_matches_type(ItemDeleteResponse, item, path=["response"]) + + 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 `conversation_id` but received ''"): + client.conversations.items.with_raw_response.delete( + item_id="item_id", + conversation_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `item_id` but received ''"): + client.conversations.items.with_raw_response.delete( + item_id="", + conversation_id="conversation_id", + ) + @parametrize def test_method_get(self, client: LlamaStackClient) -> None: item = client.conversations.items.get( @@ -312,6 +361,54 @@ async def test_path_params_list(self, async_client: AsyncLlamaStackClient) -> No conversation_id="", ) + @parametrize + async def test_method_delete(self, async_client: AsyncLlamaStackClient) -> None: + item = await async_client.conversations.items.delete( + item_id="item_id", + conversation_id="conversation_id", + ) + assert_matches_type(ItemDeleteResponse, item, path=["response"]) + + @parametrize + async def test_raw_response_delete(self, async_client: AsyncLlamaStackClient) -> None: + response = await async_client.conversations.items.with_raw_response.delete( + item_id="item_id", + conversation_id="conversation_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + item = await response.parse() + assert_matches_type(ItemDeleteResponse, item, path=["response"]) + + @parametrize + async def test_streaming_response_delete(self, async_client: AsyncLlamaStackClient) -> None: + async with async_client.conversations.items.with_streaming_response.delete( + item_id="item_id", + conversation_id="conversation_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + item = await response.parse() + assert_matches_type(ItemDeleteResponse, item, path=["response"]) + + 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 `conversation_id` but received ''"): + await async_client.conversations.items.with_raw_response.delete( + item_id="item_id", + conversation_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `item_id` but received ''"): + await async_client.conversations.items.with_raw_response.delete( + item_id="", + conversation_id="conversation_id", + ) + @parametrize async def test_method_get(self, async_client: AsyncLlamaStackClient) -> None: item = await async_client.conversations.items.get( diff --git a/tests/api_resources/test_batches.py b/tests/api_resources/test_batches.py new file mode 100644 index 00000000..90dbfa26 --- /dev/null +++ b/tests/api_resources/test_batches.py @@ -0,0 +1,344 @@ +# 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 import ( + BatchListResponse, + BatchCancelResponse, + BatchCreateResponse, + BatchRetrieveResponse, +) +from llama_stack_client.pagination import SyncOpenAICursorPage, AsyncOpenAICursorPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBatches: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: LlamaStackClient) -> None: + batch = client.batches.create( + completion_window="24h", + endpoint="endpoint", + input_file_id="input_file_id", + ) + assert_matches_type(BatchCreateResponse, batch, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: LlamaStackClient) -> None: + batch = client.batches.create( + completion_window="24h", + endpoint="endpoint", + input_file_id="input_file_id", + idempotency_key="idempotency_key", + metadata={"foo": "string"}, + ) + assert_matches_type(BatchCreateResponse, batch, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: LlamaStackClient) -> None: + response = client.batches.with_raw_response.create( + completion_window="24h", + endpoint="endpoint", + input_file_id="input_file_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + batch = response.parse() + assert_matches_type(BatchCreateResponse, batch, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: LlamaStackClient) -> None: + with client.batches.with_streaming_response.create( + completion_window="24h", + endpoint="endpoint", + input_file_id="input_file_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + batch = response.parse() + assert_matches_type(BatchCreateResponse, batch, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: LlamaStackClient) -> None: + batch = client.batches.retrieve( + "batch_id", + ) + assert_matches_type(BatchRetrieveResponse, batch, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: LlamaStackClient) -> None: + response = client.batches.with_raw_response.retrieve( + "batch_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + batch = response.parse() + assert_matches_type(BatchRetrieveResponse, batch, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: LlamaStackClient) -> None: + with client.batches.with_streaming_response.retrieve( + "batch_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + batch = response.parse() + assert_matches_type(BatchRetrieveResponse, batch, 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 `batch_id` but received ''"): + client.batches.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: LlamaStackClient) -> None: + batch = client.batches.list() + assert_matches_type(SyncOpenAICursorPage[BatchListResponse], batch, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: LlamaStackClient) -> None: + batch = client.batches.list( + after="after", + limit=0, + ) + assert_matches_type(SyncOpenAICursorPage[BatchListResponse], batch, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: LlamaStackClient) -> None: + response = client.batches.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + batch = response.parse() + assert_matches_type(SyncOpenAICursorPage[BatchListResponse], batch, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: LlamaStackClient) -> None: + with client.batches.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + batch = response.parse() + assert_matches_type(SyncOpenAICursorPage[BatchListResponse], batch, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_cancel(self, client: LlamaStackClient) -> None: + batch = client.batches.cancel( + "batch_id", + ) + assert_matches_type(BatchCancelResponse, batch, path=["response"]) + + @parametrize + def test_raw_response_cancel(self, client: LlamaStackClient) -> None: + response = client.batches.with_raw_response.cancel( + "batch_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + batch = response.parse() + assert_matches_type(BatchCancelResponse, batch, path=["response"]) + + @parametrize + def test_streaming_response_cancel(self, client: LlamaStackClient) -> None: + with client.batches.with_streaming_response.cancel( + "batch_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + batch = response.parse() + assert_matches_type(BatchCancelResponse, batch, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_cancel(self, client: LlamaStackClient) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): + client.batches.with_raw_response.cancel( + "", + ) + + +class TestAsyncBatches: + 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: + batch = await async_client.batches.create( + completion_window="24h", + endpoint="endpoint", + input_file_id="input_file_id", + ) + assert_matches_type(BatchCreateResponse, batch, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: + batch = await async_client.batches.create( + completion_window="24h", + endpoint="endpoint", + input_file_id="input_file_id", + idempotency_key="idempotency_key", + metadata={"foo": "string"}, + ) + assert_matches_type(BatchCreateResponse, batch, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncLlamaStackClient) -> None: + response = await async_client.batches.with_raw_response.create( + completion_window="24h", + endpoint="endpoint", + input_file_id="input_file_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + batch = await response.parse() + assert_matches_type(BatchCreateResponse, batch, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncLlamaStackClient) -> None: + async with async_client.batches.with_streaming_response.create( + completion_window="24h", + endpoint="endpoint", + input_file_id="input_file_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + batch = await response.parse() + assert_matches_type(BatchCreateResponse, batch, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncLlamaStackClient) -> None: + batch = await async_client.batches.retrieve( + "batch_id", + ) + assert_matches_type(BatchRetrieveResponse, batch, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncLlamaStackClient) -> None: + response = await async_client.batches.with_raw_response.retrieve( + "batch_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + batch = await response.parse() + assert_matches_type(BatchRetrieveResponse, batch, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncLlamaStackClient) -> None: + async with async_client.batches.with_streaming_response.retrieve( + "batch_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + batch = await response.parse() + assert_matches_type(BatchRetrieveResponse, batch, 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 `batch_id` but received ''"): + await async_client.batches.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncLlamaStackClient) -> None: + batch = await async_client.batches.list() + assert_matches_type(AsyncOpenAICursorPage[BatchListResponse], batch, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: + batch = await async_client.batches.list( + after="after", + limit=0, + ) + assert_matches_type(AsyncOpenAICursorPage[BatchListResponse], batch, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncLlamaStackClient) -> None: + response = await async_client.batches.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + batch = await response.parse() + assert_matches_type(AsyncOpenAICursorPage[BatchListResponse], batch, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncLlamaStackClient) -> None: + async with async_client.batches.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + batch = await response.parse() + assert_matches_type(AsyncOpenAICursorPage[BatchListResponse], batch, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_cancel(self, async_client: AsyncLlamaStackClient) -> None: + batch = await async_client.batches.cancel( + "batch_id", + ) + assert_matches_type(BatchCancelResponse, batch, path=["response"]) + + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncLlamaStackClient) -> None: + response = await async_client.batches.with_raw_response.cancel( + "batch_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + batch = await response.parse() + assert_matches_type(BatchCancelResponse, batch, path=["response"]) + + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncLlamaStackClient) -> None: + async with async_client.batches.with_streaming_response.cancel( + "batch_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + batch = await response.parse() + assert_matches_type(BatchCancelResponse, batch, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_cancel(self, async_client: AsyncLlamaStackClient) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `batch_id` but received ''"): + await async_client.batches.with_raw_response.cancel( + "", + ) diff --git a/tests/api_resources/test_completions.py b/tests/api_resources/test_completions.py index 314c6d95..a40dbeb6 100644 --- a/tests/api_resources/test_completions.py +++ b/tests/api_resources/test_completions.py @@ -47,7 +47,7 @@ def test_method_create_with_all_params_overload_1(self, client: LlamaStackClient seed=0, stop="string", stream=False, - stream_options={"foo": True}, + stream_options={"foo": "bar"}, suffix="suffix", temperature=0, top_p=0, @@ -106,7 +106,7 @@ def test_method_create_with_all_params_overload_2(self, client: LlamaStackClient presence_penalty=0, seed=0, stop="string", - stream_options={"foo": True}, + stream_options={"foo": "bar"}, suffix="suffix", temperature=0, top_p=0, @@ -171,7 +171,7 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn seed=0, stop="string", stream=False, - stream_options={"foo": True}, + stream_options={"foo": "bar"}, suffix="suffix", temperature=0, top_p=0, @@ -230,7 +230,7 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn presence_penalty=0, seed=0, stop="string", - stream_options={"foo": True}, + stream_options={"foo": "bar"}, suffix="suffix", temperature=0, top_p=0, diff --git a/tests/api_resources/test_conversations.py b/tests/api_resources/test_conversations.py index 20eab5ac..dbe50dd1 100644 --- a/tests/api_resources/test_conversations.py +++ b/tests/api_resources/test_conversations.py @@ -38,9 +38,9 @@ def test_method_create_with_all_params(self, client: LlamaStackClient) -> None: { "content": "string", "role": "system", - "type": "message", "id": "id", "status": "status", + "type": "message", } ], metadata={"foo": "string"}, @@ -203,9 +203,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncLlamaStack { "content": "string", "role": "system", - "type": "message", "id": "id", "status": "status", + "type": "message", } ], metadata={"foo": "string"}, diff --git a/tests/api_resources/test_files.py b/tests/api_resources/test_files.py index d2c83ff0..f5dd9c37 100644 --- a/tests/api_resources/test_files.py +++ b/tests/api_resources/test_files.py @@ -39,7 +39,7 @@ def test_method_create_with_all_params(self, client: LlamaStackClient) -> None: purpose="assistants", expires_after={ "anchor": "created_at", - "seconds": 0, + "seconds": 3600, }, ) assert_matches_type(File, file, path=["response"]) @@ -240,7 +240,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncLlamaStack purpose="assistants", expires_after={ "anchor": "created_at", - "seconds": 0, + "seconds": 3600, }, ) assert_matches_type(File, file, path=["response"]) diff --git a/tests/api_resources/test_models.py b/tests/api_resources/test_models.py index 7f7b834f..40667956 100644 --- a/tests/api_resources/test_models.py +++ b/tests/api_resources/test_models.py @@ -106,7 +106,7 @@ def test_method_register_with_all_params(self, client: LlamaStackClient) -> None with pytest.warns(DeprecationWarning): model = client.models.register( model_id="model_id", - metadata={"foo": True}, + metadata={"foo": "bar"}, model_type="llm", provider_id="provider_id", provider_model_id="provider_model_id", @@ -266,7 +266,7 @@ async def test_method_register_with_all_params(self, async_client: AsyncLlamaSta with pytest.warns(DeprecationWarning): model = await async_client.models.register( model_id="model_id", - metadata={"foo": True}, + metadata={"foo": "bar"}, model_type="llm", provider_id="provider_id", provider_model_id="provider_model_id", diff --git a/tests/api_resources/test_prompts.py b/tests/api_resources/test_prompts.py index f09af45c..bf49479e 100644 --- a/tests/api_resources/test_prompts.py +++ b/tests/api_resources/test_prompts.py @@ -110,7 +110,6 @@ def test_method_update(self, client: LlamaStackClient) -> None: prompt = client.prompts.update( prompt_id="prompt_id", prompt="prompt", - set_as_default=True, version=0, ) assert_matches_type(Prompt, prompt, path=["response"]) @@ -120,8 +119,8 @@ def test_method_update_with_all_params(self, client: LlamaStackClient) -> None: prompt = client.prompts.update( prompt_id="prompt_id", prompt="prompt", - set_as_default=True, version=0, + set_as_default=True, variables=["string"], ) assert_matches_type(Prompt, prompt, path=["response"]) @@ -131,7 +130,6 @@ def test_raw_response_update(self, client: LlamaStackClient) -> None: response = client.prompts.with_raw_response.update( prompt_id="prompt_id", prompt="prompt", - set_as_default=True, version=0, ) @@ -145,7 +143,6 @@ def test_streaming_response_update(self, client: LlamaStackClient) -> None: with client.prompts.with_streaming_response.update( prompt_id="prompt_id", prompt="prompt", - set_as_default=True, version=0, ) as response: assert not response.is_closed @@ -162,7 +159,6 @@ def test_path_params_update(self, client: LlamaStackClient) -> None: client.prompts.with_raw_response.update( prompt_id="", prompt="prompt", - set_as_default=True, version=0, ) @@ -367,7 +363,6 @@ async def test_method_update(self, async_client: AsyncLlamaStackClient) -> None: prompt = await async_client.prompts.update( prompt_id="prompt_id", prompt="prompt", - set_as_default=True, version=0, ) assert_matches_type(Prompt, prompt, path=["response"]) @@ -377,8 +372,8 @@ async def test_method_update_with_all_params(self, async_client: AsyncLlamaStack prompt = await async_client.prompts.update( prompt_id="prompt_id", prompt="prompt", - set_as_default=True, version=0, + set_as_default=True, variables=["string"], ) assert_matches_type(Prompt, prompt, path=["response"]) @@ -388,7 +383,6 @@ async def test_raw_response_update(self, async_client: AsyncLlamaStackClient) -> response = await async_client.prompts.with_raw_response.update( prompt_id="prompt_id", prompt="prompt", - set_as_default=True, version=0, ) @@ -402,7 +396,6 @@ async def test_streaming_response_update(self, async_client: AsyncLlamaStackClie async with async_client.prompts.with_streaming_response.update( prompt_id="prompt_id", prompt="prompt", - set_as_default=True, version=0, ) as response: assert not response.is_closed @@ -419,7 +412,6 @@ async def test_path_params_update(self, async_client: AsyncLlamaStackClient) -> await async_client.prompts.with_raw_response.update( prompt_id="", prompt="prompt", - set_as_default=True, version=0, ) diff --git a/tests/api_resources/test_responses.py b/tests/api_resources/test_responses.py index 3e585ebb..f2497504 100644 --- a/tests/api_resources/test_responses.py +++ b/tests/api_resources/test_responses.py @@ -62,17 +62,17 @@ def test_method_create_with_all_params_overload_1(self, client: LlamaStackClient temperature=0, text={ "format": { - "type": "text", "description": "description", "name": "name", - "schema": {"foo": True}, + "schema": {"foo": "bar"}, "strict": True, + "type": "text", } }, tools=[ { + "search_context_size": 'S?oC"high', "type": "web_search", - "search_context_size": "search_context_size", } ], ) @@ -139,17 +139,17 @@ def test_method_create_with_all_params_overload_2(self, client: LlamaStackClient temperature=0, text={ "format": { - "type": "text", "description": "description", "name": "name", - "schema": {"foo": True}, + "schema": {"foo": "bar"}, "strict": True, + "type": "text", } }, tools=[ { + "search_context_size": 'S?oC"high', "type": "web_search", - "search_context_size": "search_context_size", } ], ) @@ -333,17 +333,17 @@ async def test_method_create_with_all_params_overload_1(self, async_client: Asyn temperature=0, text={ "format": { - "type": "text", "description": "description", "name": "name", - "schema": {"foo": True}, + "schema": {"foo": "bar"}, "strict": True, + "type": "text", } }, tools=[ { + "search_context_size": 'S?oC"high', "type": "web_search", - "search_context_size": "search_context_size", } ], ) @@ -410,17 +410,17 @@ async def test_method_create_with_all_params_overload_2(self, async_client: Asyn temperature=0, text={ "format": { - "type": "text", "description": "description", "name": "name", - "schema": {"foo": True}, + "schema": {"foo": "bar"}, "strict": True, + "type": "text", } }, tools=[ { + "search_context_size": 'S?oC"high', "type": "web_search", - "search_context_size": "search_context_size", } ], ) diff --git a/tests/api_resources/test_safety.py b/tests/api_resources/test_safety.py index f3c13a98..d5c8c27f 100644 --- a/tests/api_resources/test_safety.py +++ b/tests/api_resources/test_safety.py @@ -32,7 +32,7 @@ def test_method_run_shield(self, client: LlamaStackClient) -> None: "role": "user", } ], - params={"foo": True}, + params={"foo": "bar"}, shield_id="shield_id", ) assert_matches_type(RunShieldResponse, safety, path=["response"]) @@ -46,7 +46,7 @@ def test_raw_response_run_shield(self, client: LlamaStackClient) -> None: "role": "user", } ], - params={"foo": True}, + params={"foo": "bar"}, shield_id="shield_id", ) @@ -64,7 +64,7 @@ def test_streaming_response_run_shield(self, client: LlamaStackClient) -> None: "role": "user", } ], - params={"foo": True}, + params={"foo": "bar"}, shield_id="shield_id", ) as response: assert not response.is_closed @@ -90,7 +90,7 @@ async def test_method_run_shield(self, async_client: AsyncLlamaStackClient) -> N "role": "user", } ], - params={"foo": True}, + params={"foo": "bar"}, shield_id="shield_id", ) assert_matches_type(RunShieldResponse, safety, path=["response"]) @@ -104,7 +104,7 @@ async def test_raw_response_run_shield(self, async_client: AsyncLlamaStackClient "role": "user", } ], - params={"foo": True}, + params={"foo": "bar"}, shield_id="shield_id", ) @@ -122,7 +122,7 @@ async def test_streaming_response_run_shield(self, async_client: AsyncLlamaStack "role": "user", } ], - params={"foo": True}, + params={"foo": "bar"}, shield_id="shield_id", ) as response: assert not response.is_closed diff --git a/tests/api_resources/test_scoring.py b/tests/api_resources/test_scoring.py index 6f933ffc..634348a8 100644 --- a/tests/api_resources/test_scoring.py +++ b/tests/api_resources/test_scoring.py @@ -29,12 +29,10 @@ class TestScoring: @parametrize def test_method_score(self, client: LlamaStackClient) -> None: scoring = client.scoring.score( - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", - "judge_score_regexes": ["string"], "type": "llm_as_judge", } }, @@ -44,12 +42,10 @@ def test_method_score(self, client: LlamaStackClient) -> None: @parametrize def test_raw_response_score(self, client: LlamaStackClient) -> None: response = client.scoring.with_raw_response.score( - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", - "judge_score_regexes": ["string"], "type": "llm_as_judge", } }, @@ -63,12 +59,10 @@ def test_raw_response_score(self, client: LlamaStackClient) -> None: @parametrize def test_streaming_response_score(self, client: LlamaStackClient) -> None: with client.scoring.with_streaming_response.score( - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", - "judge_score_regexes": ["string"], "type": "llm_as_judge", } }, @@ -85,15 +79,29 @@ def test_streaming_response_score(self, client: LlamaStackClient) -> None: def test_method_score_batch(self, client: LlamaStackClient) -> None: scoring = client.scoring.score_batch( dataset_id="dataset_id", - save_results_dataset=True, scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", + "type": "llm_as_judge", + } + }, + ) + assert_matches_type(ScoringScoreBatchResponse, scoring, path=["response"]) + + @parametrize + def test_method_score_batch_with_all_params(self, client: LlamaStackClient) -> None: + scoring = client.scoring.score_batch( + dataset_id="dataset_id", + scoring_functions={ + "foo": { + "judge_model": "judge_model", + "aggregation_functions": ["average"], "judge_score_regexes": ["string"], + "prompt_template": "prompt_template", "type": "llm_as_judge", } }, + save_results_dataset=True, ) assert_matches_type(ScoringScoreBatchResponse, scoring, path=["response"]) @@ -101,12 +109,9 @@ def test_method_score_batch(self, client: LlamaStackClient) -> None: def test_raw_response_score_batch(self, client: LlamaStackClient) -> None: response = client.scoring.with_raw_response.score_batch( dataset_id="dataset_id", - save_results_dataset=True, scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", - "judge_score_regexes": ["string"], "type": "llm_as_judge", } }, @@ -121,12 +126,9 @@ def test_raw_response_score_batch(self, client: LlamaStackClient) -> None: def test_streaming_response_score_batch(self, client: LlamaStackClient) -> None: with client.scoring.with_streaming_response.score_batch( dataset_id="dataset_id", - save_results_dataset=True, scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", - "judge_score_regexes": ["string"], "type": "llm_as_judge", } }, @@ -148,12 +150,10 @@ class TestAsyncScoring: @parametrize async def test_method_score(self, async_client: AsyncLlamaStackClient) -> None: scoring = await async_client.scoring.score( - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", - "judge_score_regexes": ["string"], "type": "llm_as_judge", } }, @@ -163,12 +163,10 @@ async def test_method_score(self, async_client: AsyncLlamaStackClient) -> None: @parametrize async def test_raw_response_score(self, async_client: AsyncLlamaStackClient) -> None: response = await async_client.scoring.with_raw_response.score( - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", - "judge_score_regexes": ["string"], "type": "llm_as_judge", } }, @@ -182,12 +180,10 @@ async def test_raw_response_score(self, async_client: AsyncLlamaStackClient) -> @parametrize async def test_streaming_response_score(self, async_client: AsyncLlamaStackClient) -> None: async with async_client.scoring.with_streaming_response.score( - input_rows=[{"foo": True}], + input_rows=[{"foo": "bar"}], scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", - "judge_score_regexes": ["string"], "type": "llm_as_judge", } }, @@ -204,15 +200,29 @@ async def test_streaming_response_score(self, async_client: AsyncLlamaStackClien async def test_method_score_batch(self, async_client: AsyncLlamaStackClient) -> None: scoring = await async_client.scoring.score_batch( dataset_id="dataset_id", - save_results_dataset=True, scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", + "type": "llm_as_judge", + } + }, + ) + assert_matches_type(ScoringScoreBatchResponse, scoring, path=["response"]) + + @parametrize + async def test_method_score_batch_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: + scoring = await async_client.scoring.score_batch( + dataset_id="dataset_id", + scoring_functions={ + "foo": { + "judge_model": "judge_model", + "aggregation_functions": ["average"], "judge_score_regexes": ["string"], + "prompt_template": "prompt_template", "type": "llm_as_judge", } }, + save_results_dataset=True, ) assert_matches_type(ScoringScoreBatchResponse, scoring, path=["response"]) @@ -220,12 +230,9 @@ async def test_method_score_batch(self, async_client: AsyncLlamaStackClient) -> async def test_raw_response_score_batch(self, async_client: AsyncLlamaStackClient) -> None: response = await async_client.scoring.with_raw_response.score_batch( dataset_id="dataset_id", - save_results_dataset=True, scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", - "judge_score_regexes": ["string"], "type": "llm_as_judge", } }, @@ -240,12 +247,9 @@ async def test_raw_response_score_batch(self, async_client: AsyncLlamaStackClien async def test_streaming_response_score_batch(self, async_client: AsyncLlamaStackClient) -> None: async with async_client.scoring.with_streaming_response.score_batch( dataset_id="dataset_id", - save_results_dataset=True, scoring_functions={ "foo": { - "aggregation_functions": ["average"], "judge_model": "judge_model", - "judge_score_regexes": ["string"], "type": "llm_as_judge", } }, diff --git a/tests/api_resources/test_scoring_functions.py b/tests/api_resources/test_scoring_functions.py index 22470900..72bea56c 100644 --- a/tests/api_resources/test_scoring_functions.py +++ b/tests/api_resources/test_scoring_functions.py @@ -15,10 +15,7 @@ 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 # pyright: reportDeprecated=false @@ -95,9 +92,9 @@ def test_streaming_response_list(self, client: LlamaStackClient) -> None: def test_method_register(self, client: LlamaStackClient) -> None: with pytest.warns(DeprecationWarning): scoring_function = client.scoring_functions.register( - description="description", - return_type={"type": "string"}, - scoring_fn_id="scoring_fn_id", + description={}, + return_type={}, + scoring_fn_id={}, ) assert scoring_function is None @@ -106,18 +103,12 @@ def test_method_register(self, client: LlamaStackClient) -> None: def test_method_register_with_all_params(self, client: LlamaStackClient) -> None: with pytest.warns(DeprecationWarning): scoring_function = client.scoring_functions.register( - description="description", - return_type={"type": "string"}, - scoring_fn_id="scoring_fn_id", - params={ - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - "prompt_template": "prompt_template", - }, - provider_id="provider_id", - provider_scoring_fn_id="provider_scoring_fn_id", + description={}, + return_type={}, + scoring_fn_id={}, + params={}, + provider_id={}, + provider_scoring_fn_id={}, ) assert scoring_function is None @@ -126,9 +117,9 @@ def test_method_register_with_all_params(self, client: LlamaStackClient) -> None def test_raw_response_register(self, client: LlamaStackClient) -> None: with pytest.warns(DeprecationWarning): response = client.scoring_functions.with_raw_response.register( - description="description", - return_type={"type": "string"}, - scoring_fn_id="scoring_fn_id", + description={}, + return_type={}, + scoring_fn_id={}, ) assert response.is_closed is True @@ -140,9 +131,9 @@ def test_raw_response_register(self, client: LlamaStackClient) -> None: def test_streaming_response_register(self, client: LlamaStackClient) -> None: with pytest.warns(DeprecationWarning): with client.scoring_functions.with_streaming_response.register( - description="description", - return_type={"type": "string"}, - scoring_fn_id="scoring_fn_id", + description={}, + return_type={}, + scoring_fn_id={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -152,6 +143,49 @@ def test_streaming_response_register(self, client: LlamaStackClient) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_unregister(self, client: LlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + scoring_function = client.scoring_functions.unregister( + "scoring_fn_id", + ) + + assert scoring_function is None + + @parametrize + def test_raw_response_unregister(self, client: LlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + response = client.scoring_functions.with_raw_response.unregister( + "scoring_fn_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + scoring_function = response.parse() + assert scoring_function is None + + @parametrize + def test_streaming_response_unregister(self, client: LlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + with client.scoring_functions.with_streaming_response.unregister( + "scoring_fn_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + scoring_function = response.parse() + assert scoring_function is None + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_unregister(self, client: LlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `scoring_fn_id` but received ''"): + client.scoring_functions.with_raw_response.unregister( + "", + ) + class TestAsyncScoringFunctions: parametrize = pytest.mark.parametrize( @@ -225,9 +259,9 @@ async def test_streaming_response_list(self, async_client: AsyncLlamaStackClient async def test_method_register(self, async_client: AsyncLlamaStackClient) -> None: with pytest.warns(DeprecationWarning): scoring_function = await async_client.scoring_functions.register( - description="description", - return_type={"type": "string"}, - scoring_fn_id="scoring_fn_id", + description={}, + return_type={}, + scoring_fn_id={}, ) assert scoring_function is None @@ -236,18 +270,12 @@ async def test_method_register(self, async_client: AsyncLlamaStackClient) -> Non async def test_method_register_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: with pytest.warns(DeprecationWarning): scoring_function = await async_client.scoring_functions.register( - description="description", - return_type={"type": "string"}, - scoring_fn_id="scoring_fn_id", - params={ - "aggregation_functions": ["average"], - "judge_model": "judge_model", - "judge_score_regexes": ["string"], - "type": "llm_as_judge", - "prompt_template": "prompt_template", - }, - provider_id="provider_id", - provider_scoring_fn_id="provider_scoring_fn_id", + description={}, + return_type={}, + scoring_fn_id={}, + params={}, + provider_id={}, + provider_scoring_fn_id={}, ) assert scoring_function is None @@ -256,9 +284,9 @@ async def test_method_register_with_all_params(self, async_client: AsyncLlamaSta async def test_raw_response_register(self, async_client: AsyncLlamaStackClient) -> None: with pytest.warns(DeprecationWarning): response = await async_client.scoring_functions.with_raw_response.register( - description="description", - return_type={"type": "string"}, - scoring_fn_id="scoring_fn_id", + description={}, + return_type={}, + scoring_fn_id={}, ) assert response.is_closed is True @@ -270,9 +298,9 @@ async def test_raw_response_register(self, async_client: AsyncLlamaStackClient) async def test_streaming_response_register(self, async_client: AsyncLlamaStackClient) -> None: with pytest.warns(DeprecationWarning): async with async_client.scoring_functions.with_streaming_response.register( - description="description", - return_type={"type": "string"}, - scoring_fn_id="scoring_fn_id", + description={}, + return_type={}, + scoring_fn_id={}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -281,3 +309,46 @@ async def test_streaming_response_register(self, async_client: AsyncLlamaStackCl assert scoring_function is None assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_unregister(self, async_client: AsyncLlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + scoring_function = await async_client.scoring_functions.unregister( + "scoring_fn_id", + ) + + assert scoring_function is None + + @parametrize + async def test_raw_response_unregister(self, async_client: AsyncLlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + response = await async_client.scoring_functions.with_raw_response.unregister( + "scoring_fn_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + scoring_function = await response.parse() + assert scoring_function is None + + @parametrize + async def test_streaming_response_unregister(self, async_client: AsyncLlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + async with async_client.scoring_functions.with_streaming_response.unregister( + "scoring_fn_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + scoring_function = await response.parse() + assert scoring_function is None + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_unregister(self, async_client: AsyncLlamaStackClient) -> None: + with pytest.warns(DeprecationWarning): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `scoring_fn_id` but received ''"): + await async_client.scoring_functions.with_raw_response.unregister( + "", + ) diff --git a/tests/api_resources/test_shields.py b/tests/api_resources/test_shields.py index d2b12f1a..afcc128b 100644 --- a/tests/api_resources/test_shields.py +++ b/tests/api_resources/test_shields.py @@ -145,7 +145,7 @@ def test_method_register_with_all_params(self, client: LlamaStackClient) -> None with pytest.warns(DeprecationWarning): shield = client.shields.register( shield_id="shield_id", - params={"foo": True}, + params={"foo": "bar"}, provider_id="provider_id", provider_shield_id="provider_shield_id", ) @@ -304,7 +304,7 @@ async def test_method_register_with_all_params(self, async_client: AsyncLlamaSta with pytest.warns(DeprecationWarning): shield = await async_client.shields.register( shield_id="shield_id", - params={"foo": True}, + params={"foo": "bar"}, provider_id="provider_id", provider_shield_id="provider_shield_id", ) diff --git a/tests/api_resources/test_tool_runtime.py b/tests/api_resources/test_tool_runtime.py index 46e1900a..a30c46e3 100644 --- a/tests/api_resources/test_tool_runtime.py +++ b/tests/api_resources/test_tool_runtime.py @@ -29,7 +29,7 @@ class TestToolRuntime: @parametrize def test_method_invoke_tool(self, client: LlamaStackClient) -> None: tool_runtime = client.tool_runtime.invoke_tool( - kwargs={"foo": True}, + kwargs={"foo": "bar"}, tool_name="tool_name", ) assert_matches_type(ToolInvocationResult, tool_runtime, path=["response"]) @@ -37,7 +37,7 @@ def test_method_invoke_tool(self, client: LlamaStackClient) -> None: @parametrize def test_method_invoke_tool_with_all_params(self, client: LlamaStackClient) -> None: tool_runtime = client.tool_runtime.invoke_tool( - kwargs={"foo": True}, + kwargs={"foo": "bar"}, tool_name="tool_name", authorization="authorization", ) @@ -46,7 +46,7 @@ def test_method_invoke_tool_with_all_params(self, client: LlamaStackClient) -> N @parametrize def test_raw_response_invoke_tool(self, client: LlamaStackClient) -> None: response = client.tool_runtime.with_raw_response.invoke_tool( - kwargs={"foo": True}, + kwargs={"foo": "bar"}, tool_name="tool_name", ) @@ -58,7 +58,7 @@ def test_raw_response_invoke_tool(self, client: LlamaStackClient) -> None: @parametrize def test_streaming_response_invoke_tool(self, client: LlamaStackClient) -> None: with client.tool_runtime.with_streaming_response.invoke_tool( - kwargs={"foo": True}, + kwargs={"foo": "bar"}, tool_name="tool_name", ) as response: assert not response.is_closed @@ -112,7 +112,7 @@ class TestAsyncToolRuntime: @parametrize async def test_method_invoke_tool(self, async_client: AsyncLlamaStackClient) -> None: tool_runtime = await async_client.tool_runtime.invoke_tool( - kwargs={"foo": True}, + kwargs={"foo": "bar"}, tool_name="tool_name", ) assert_matches_type(ToolInvocationResult, tool_runtime, path=["response"]) @@ -120,7 +120,7 @@ async def test_method_invoke_tool(self, async_client: AsyncLlamaStackClient) -> @parametrize async def test_method_invoke_tool_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: tool_runtime = await async_client.tool_runtime.invoke_tool( - kwargs={"foo": True}, + kwargs={"foo": "bar"}, tool_name="tool_name", authorization="authorization", ) @@ -129,7 +129,7 @@ async def test_method_invoke_tool_with_all_params(self, async_client: AsyncLlama @parametrize async def test_raw_response_invoke_tool(self, async_client: AsyncLlamaStackClient) -> None: response = await async_client.tool_runtime.with_raw_response.invoke_tool( - kwargs={"foo": True}, + kwargs={"foo": "bar"}, tool_name="tool_name", ) @@ -141,7 +141,7 @@ async def test_raw_response_invoke_tool(self, async_client: AsyncLlamaStackClien @parametrize async def test_streaming_response_invoke_tool(self, async_client: AsyncLlamaStackClient) -> None: async with async_client.tool_runtime.with_streaming_response.invoke_tool( - kwargs={"foo": True}, + kwargs={"foo": "bar"}, tool_name="tool_name", ) as response: assert not response.is_closed diff --git a/tests/api_resources/test_toolgroups.py b/tests/api_resources/test_toolgroups.py index 060d6b3f..3b0ddad9 100644 --- a/tests/api_resources/test_toolgroups.py +++ b/tests/api_resources/test_toolgroups.py @@ -104,7 +104,7 @@ def test_method_register_with_all_params(self, client: LlamaStackClient) -> None toolgroup = client.toolgroups.register( provider_id="provider_id", toolgroup_id="toolgroup_id", - args={"foo": True}, + args={"foo": "bar"}, mcp_endpoint={"uri": "uri"}, ) @@ -266,7 +266,7 @@ async def test_method_register_with_all_params(self, async_client: AsyncLlamaSta toolgroup = await async_client.toolgroups.register( provider_id="provider_id", toolgroup_id="toolgroup_id", - args={"foo": True}, + args={"foo": "bar"}, mcp_endpoint={"uri": "uri"}, ) diff --git a/tests/api_resources/test_vector_io.py b/tests/api_resources/test_vector_io.py index b5ae697f..a3d14f90 100644 --- a/tests/api_resources/test_vector_io.py +++ b/tests/api_resources/test_vector_io.py @@ -30,7 +30,6 @@ def test_method_insert(self, client: LlamaStackClient) -> None: { "chunk_id": "chunk_id", "content": "string", - "metadata": {"foo": True}, } ], vector_store_id="vector_store_id", @@ -44,7 +43,6 @@ def test_method_insert_with_all_params(self, client: LlamaStackClient) -> None: { "chunk_id": "chunk_id", "content": "string", - "metadata": {"foo": True}, "chunk_metadata": { "chunk_embedding_dimension": 0, "chunk_embedding_model": "chunk_embedding_model", @@ -59,6 +57,7 @@ def test_method_insert_with_all_params(self, client: LlamaStackClient) -> None: "updated_timestamp": 0, }, "embedding": [0], + "metadata": {"foo": "bar"}, } ], vector_store_id="vector_store_id", @@ -73,7 +72,6 @@ def test_raw_response_insert(self, client: LlamaStackClient) -> None: { "chunk_id": "chunk_id", "content": "string", - "metadata": {"foo": True}, } ], vector_store_id="vector_store_id", @@ -91,7 +89,6 @@ def test_streaming_response_insert(self, client: LlamaStackClient) -> None: { "chunk_id": "chunk_id", "content": "string", - "metadata": {"foo": True}, } ], vector_store_id="vector_store_id", @@ -117,7 +114,7 @@ def test_method_query_with_all_params(self, client: LlamaStackClient) -> None: vector_io = client.vector_io.query( query="string", vector_store_id="vector_store_id", - params={"foo": True}, + params={"foo": "bar"}, ) assert_matches_type(QueryChunksResponse, vector_io, path=["response"]) @@ -160,7 +157,6 @@ async def test_method_insert(self, async_client: AsyncLlamaStackClient) -> None: { "chunk_id": "chunk_id", "content": "string", - "metadata": {"foo": True}, } ], vector_store_id="vector_store_id", @@ -174,7 +170,6 @@ async def test_method_insert_with_all_params(self, async_client: AsyncLlamaStack { "chunk_id": "chunk_id", "content": "string", - "metadata": {"foo": True}, "chunk_metadata": { "chunk_embedding_dimension": 0, "chunk_embedding_model": "chunk_embedding_model", @@ -189,6 +184,7 @@ async def test_method_insert_with_all_params(self, async_client: AsyncLlamaStack "updated_timestamp": 0, }, "embedding": [0], + "metadata": {"foo": "bar"}, } ], vector_store_id="vector_store_id", @@ -203,7 +199,6 @@ async def test_raw_response_insert(self, async_client: AsyncLlamaStackClient) -> { "chunk_id": "chunk_id", "content": "string", - "metadata": {"foo": True}, } ], vector_store_id="vector_store_id", @@ -221,7 +216,6 @@ async def test_streaming_response_insert(self, async_client: AsyncLlamaStackClie { "chunk_id": "chunk_id", "content": "string", - "metadata": {"foo": True}, } ], vector_store_id="vector_store_id", @@ -247,7 +241,7 @@ async def test_method_query_with_all_params(self, async_client: AsyncLlamaStackC vector_io = await async_client.vector_io.query( query="string", vector_store_id="vector_store_id", - params={"foo": True}, + params={"foo": "bar"}, ) assert_matches_type(QueryChunksResponse, vector_io, path=["response"]) diff --git a/tests/api_resources/test_vector_stores.py b/tests/api_resources/test_vector_stores.py index 6cfe7043..84614aca 100644 --- a/tests/api_resources/test_vector_stores.py +++ b/tests/api_resources/test_vector_stores.py @@ -37,9 +37,9 @@ def test_method_create(self, client: LlamaStackClient) -> None: def test_method_create_with_all_params(self, client: LlamaStackClient) -> None: vector_store = client.vector_stores.create( chunking_strategy={"type": "auto"}, - expires_after={"foo": True}, + expires_after={"foo": "bar"}, file_ids=["string"], - metadata={"foo": True}, + metadata={"foo": "bar"}, name="name", ) assert_matches_type(VectorStore, vector_store, path=["response"]) @@ -113,8 +113,8 @@ def test_method_update(self, client: LlamaStackClient) -> None: def test_method_update_with_all_params(self, client: LlamaStackClient) -> None: vector_store = client.vector_stores.update( vector_store_id="vector_store_id", - expires_after={"foo": True}, - metadata={"foo": True}, + expires_after={"foo": "bar"}, + metadata={"foo": "bar"}, name="name", ) assert_matches_type(VectorStore, vector_store, path=["response"]) @@ -236,7 +236,7 @@ def test_method_search_with_all_params(self, client: LlamaStackClient) -> None: vector_store = client.vector_stores.search( vector_store_id="vector_store_id", query="string", - filters={"foo": True}, + filters={"foo": "bar"}, max_num_results=0, ranking_options={ "ranker": "ranker", @@ -296,9 +296,9 @@ async def test_method_create(self, async_client: AsyncLlamaStackClient) -> None: async def test_method_create_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: vector_store = await async_client.vector_stores.create( chunking_strategy={"type": "auto"}, - expires_after={"foo": True}, + expires_after={"foo": "bar"}, file_ids=["string"], - metadata={"foo": True}, + metadata={"foo": "bar"}, name="name", ) assert_matches_type(VectorStore, vector_store, path=["response"]) @@ -372,8 +372,8 @@ async def test_method_update(self, async_client: AsyncLlamaStackClient) -> None: async def test_method_update_with_all_params(self, async_client: AsyncLlamaStackClient) -> None: vector_store = await async_client.vector_stores.update( vector_store_id="vector_store_id", - expires_after={"foo": True}, - metadata={"foo": True}, + expires_after={"foo": "bar"}, + metadata={"foo": "bar"}, name="name", ) assert_matches_type(VectorStore, vector_store, path=["response"]) @@ -495,7 +495,7 @@ async def test_method_search_with_all_params(self, async_client: AsyncLlamaStack vector_store = await async_client.vector_stores.search( vector_store_id="vector_store_id", query="string", - filters={"foo": True}, + filters={"foo": "bar"}, max_num_results=0, ranking_options={ "ranker": "ranker", diff --git a/tests/api_resources/tool_runtime/__init__.py b/tests/api_resources/tool_runtime/__init__.py deleted file mode 100644 index 6a8e62e9..00000000 --- a/tests/api_resources/tool_runtime/__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/vector_stores/test_file_batches.py b/tests/api_resources/vector_stores/test_file_batches.py index e9a36ea5..f4136e11 100644 --- a/tests/api_resources/vector_stores/test_file_batches.py +++ b/tests/api_resources/vector_stores/test_file_batches.py @@ -40,7 +40,7 @@ def test_method_create_with_all_params(self, client: LlamaStackClient) -> None: file_batch = client.vector_stores.file_batches.create( vector_store_id="vector_store_id", file_ids=["string"], - attributes={"foo": True}, + attributes={"foo": "bar"}, chunking_strategy={"type": "auto"}, ) assert_matches_type(VectorStoreFileBatches, file_batch, path=["response"]) @@ -255,7 +255,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncLlamaStack file_batch = await async_client.vector_stores.file_batches.create( vector_store_id="vector_store_id", file_ids=["string"], - attributes={"foo": True}, + attributes={"foo": "bar"}, chunking_strategy={"type": "auto"}, ) assert_matches_type(VectorStoreFileBatches, file_batch, path=["response"]) diff --git a/tests/api_resources/vector_stores/test_files.py b/tests/api_resources/vector_stores/test_files.py index be614140..20088595 100644 --- a/tests/api_resources/vector_stores/test_files.py +++ b/tests/api_resources/vector_stores/test_files.py @@ -41,7 +41,7 @@ def test_method_create_with_all_params(self, client: LlamaStackClient) -> None: file = client.vector_stores.files.create( vector_store_id="vector_store_id", file_id="file_id", - attributes={"foo": True}, + attributes={"foo": "bar"}, chunking_strategy={"type": "auto"}, ) assert_matches_type(VectorStoreFile, file, path=["response"]) @@ -133,7 +133,7 @@ def test_method_update(self, client: LlamaStackClient) -> None: file = client.vector_stores.files.update( file_id="file_id", vector_store_id="vector_store_id", - attributes={"foo": True}, + attributes={"foo": "bar"}, ) assert_matches_type(VectorStoreFile, file, path=["response"]) @@ -142,7 +142,7 @@ def test_raw_response_update(self, client: LlamaStackClient) -> None: response = client.vector_stores.files.with_raw_response.update( file_id="file_id", vector_store_id="vector_store_id", - attributes={"foo": True}, + attributes={"foo": "bar"}, ) assert response.is_closed is True @@ -155,7 +155,7 @@ def test_streaming_response_update(self, client: LlamaStackClient) -> None: with client.vector_stores.files.with_streaming_response.update( file_id="file_id", vector_store_id="vector_store_id", - attributes={"foo": True}, + attributes={"foo": "bar"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -171,14 +171,14 @@ def test_path_params_update(self, client: LlamaStackClient) -> None: client.vector_stores.files.with_raw_response.update( file_id="file_id", vector_store_id="", - attributes={"foo": True}, + attributes={"foo": "bar"}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): client.vector_stores.files.with_raw_response.update( file_id="", vector_store_id="vector_store_id", - attributes={"foo": True}, + attributes={"foo": "bar"}, ) @parametrize @@ -356,7 +356,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncLlamaStack file = await async_client.vector_stores.files.create( vector_store_id="vector_store_id", file_id="file_id", - attributes={"foo": True}, + attributes={"foo": "bar"}, chunking_strategy={"type": "auto"}, ) assert_matches_type(VectorStoreFile, file, path=["response"]) @@ -448,7 +448,7 @@ async def test_method_update(self, async_client: AsyncLlamaStackClient) -> None: file = await async_client.vector_stores.files.update( file_id="file_id", vector_store_id="vector_store_id", - attributes={"foo": True}, + attributes={"foo": "bar"}, ) assert_matches_type(VectorStoreFile, file, path=["response"]) @@ -457,7 +457,7 @@ async def test_raw_response_update(self, async_client: AsyncLlamaStackClient) -> response = await async_client.vector_stores.files.with_raw_response.update( file_id="file_id", vector_store_id="vector_store_id", - attributes={"foo": True}, + attributes={"foo": "bar"}, ) assert response.is_closed is True @@ -470,7 +470,7 @@ async def test_streaming_response_update(self, async_client: AsyncLlamaStackClie async with async_client.vector_stores.files.with_streaming_response.update( file_id="file_id", vector_store_id="vector_store_id", - attributes={"foo": True}, + attributes={"foo": "bar"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -486,14 +486,14 @@ async def test_path_params_update(self, async_client: AsyncLlamaStackClient) -> await async_client.vector_stores.files.with_raw_response.update( file_id="file_id", vector_store_id="", - attributes={"foo": True}, + attributes={"foo": "bar"}, ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `file_id` but received ''"): await async_client.vector_stores.files.with_raw_response.update( file_id="", vector_store_id="vector_store_id", - attributes={"foo": True}, + attributes={"foo": "bar"}, ) @parametrize