Skip to content

Commit 119bdb2

Browse files
feat(api): manual updates
1 parent c17f3d6 commit 119bdb2

17 files changed

+197
-168
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 106
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-4f6633567c1a079df49d0cf58f37251a4bb0ee2f2a496ac83c9fee26eb325f9c.yml
33
openapi_spec_hash: af5b3d3bbecf48f15c90b982ccac852e
4-
config_hash: e67fd054e95c1e82f78f4b834e96bb65
4+
config_hash: ddcbd66d7ac80290da208232a746e30f

api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ from llama_stack_client.types import (
2020
SafetyViolation,
2121
SamplingParams,
2222
ScoringResult,
23+
SharedTokenLogProbs,
2324
SystemMessage,
2425
ToolCall,
2526
ToolCallOrString,
@@ -62,7 +63,7 @@ Methods:
6263
Types:
6364

6465
```python
65-
from llama_stack_client.types import ToolDef, ToolInvocationResult, ToolRuntimeListToolsResponse
66+
from llama_stack_client.types import ToolInvocationResult, ToolRuntimeListToolsResponse
6667
```
6768

6869
Methods:
@@ -239,7 +240,6 @@ Types:
239240
```python
240241
from llama_stack_client.types import (
241242
ChatCompletionResponseStreamChunk,
242-
CompletionResponse,
243243
EmbeddingsResponse,
244244
TokenLogProbs,
245245
InferenceBatchChatCompletionResponse,
@@ -251,7 +251,7 @@ Methods:
251251
- <code title="post /v1/inference/batch-chat-completion">client.inference.<a href="./src/llama_stack_client/resources/inference.py">batch_chat_completion</a>(\*\*<a href="src/llama_stack_client/types/inference_batch_chat_completion_params.py">params</a>) -> <a href="./src/llama_stack_client/types/inference_batch_chat_completion_response.py">InferenceBatchChatCompletionResponse</a></code>
252252
- <code title="post /v1/inference/batch-completion">client.inference.<a href="./src/llama_stack_client/resources/inference.py">batch_completion</a>(\*\*<a href="src/llama_stack_client/types/inference_batch_completion_params.py">params</a>) -> <a href="./src/llama_stack_client/types/shared/batch_completion.py">BatchCompletion</a></code>
253253
- <code title="post /v1/inference/chat-completion">client.inference.<a href="./src/llama_stack_client/resources/inference.py">chat_completion</a>(\*\*<a href="src/llama_stack_client/types/inference_chat_completion_params.py">params</a>) -> <a href="./src/llama_stack_client/types/shared/chat_completion_response.py">ChatCompletionResponse</a></code>
254-
- <code title="post /v1/inference/completion">client.inference.<a href="./src/llama_stack_client/resources/inference.py">completion</a>(\*\*<a href="src/llama_stack_client/types/inference_completion_params.py">params</a>) -> <a href="./src/llama_stack_client/types/completion_response.py">CompletionResponse</a></code>
254+
- <code title="post /v1/inference/completion">client.inference.<a href="./src/llama_stack_client/resources/inference.py">completion</a>(\*\*<a href="src/llama_stack_client/types/inference_completion_params.py">params</a>) -> UnnamedTypeWithNoPropertyInfoOrParent0</code>
255255
- <code title="post /v1/inference/embeddings">client.inference.<a href="./src/llama_stack_client/resources/inference.py">embeddings</a>(\*\*<a href="src/llama_stack_client/types/inference_embeddings_params.py">params</a>) -> <a href="./src/llama_stack_client/types/embeddings_response.py">EmbeddingsResponse</a></code>
256256

257257
# Embeddings

src/llama_stack_client/pagination.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ def _get_page_items(self) -> List[_T]:
2424
@override
2525
def next_page_info(self) -> Optional[PageInfo]:
2626
next_index = self.next_index
27-
if not next_index:
28-
return None
27+
if next_index is None:
28+
return None # type: ignore[unreachable]
29+
30+
length = len(self._get_page_items())
31+
current_count = next_index + length
2932

30-
return PageInfo(params={"start_index": next_index})
33+
return PageInfo(params={"start_index": current_count})
3134

3235

3336
class AsyncDatasetsIterrows(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
@@ -44,10 +47,13 @@ def _get_page_items(self) -> List[_T]:
4447
@override
4548
def next_page_info(self) -> Optional[PageInfo]:
4649
next_index = self.next_index
47-
if not next_index:
48-
return None
50+
if next_index is None:
51+
return None # type: ignore[unreachable]
52+
53+
length = len(self._get_page_items())
54+
current_count = next_index + length
4955

50-
return PageInfo(params={"start_index": next_index})
56+
return PageInfo(params={"start_index": current_count})
5157

5258

5359
class SyncOpenAICursorPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):

src/llama_stack_client/resources/inference.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
)
2828
from .._streaming import Stream, AsyncStream
2929
from .._base_client import make_request_options
30-
from ..types.completion_response import CompletionResponse
3130
from ..types.embeddings_response import EmbeddingsResponse
3231
from ..types.shared_params.message import Message
3332
from ..types.shared.batch_completion import BatchCompletion
33+
from ..types.inference_completion_params import UnnamedTypeWithNoPropertyInfoOrParent0
3434
from ..types.shared_params.response_format import ResponseFormat
3535
from ..types.shared_params.sampling_params import SamplingParams
3636
from ..types.shared.chat_completion_response import ChatCompletionResponse
@@ -467,7 +467,7 @@ def completion(
467467
extra_query: Query | None = None,
468468
extra_body: Body | None = None,
469469
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
470-
) -> CompletionResponse:
470+
) -> UnnamedTypeWithNoPropertyInfoOrParent0:
471471
"""
472472
Generate a completion for the given content using the specified model.
473473
@@ -514,7 +514,7 @@ def completion(
514514
extra_query: Query | None = None,
515515
extra_body: Body | None = None,
516516
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
517-
) -> Stream[CompletionResponse]:
517+
) -> Stream[UnnamedTypeWithNoPropertyInfoOrParent0]:
518518
"""
519519
Generate a completion for the given content using the specified model.
520520
@@ -561,7 +561,7 @@ def completion(
561561
extra_query: Query | None = None,
562562
extra_body: Body | None = None,
563563
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
564-
) -> CompletionResponse | Stream[CompletionResponse]:
564+
) -> UnnamedTypeWithNoPropertyInfoOrParent0 | Stream[UnnamedTypeWithNoPropertyInfoOrParent0]:
565565
"""
566566
Generate a completion for the given content using the specified model.
567567
@@ -608,7 +608,7 @@ def completion(
608608
extra_query: Query | None = None,
609609
extra_body: Body | None = None,
610610
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
611-
) -> CompletionResponse | Stream[CompletionResponse]:
611+
) -> UnnamedTypeWithNoPropertyInfoOrParent0 | Stream[UnnamedTypeWithNoPropertyInfoOrParent0]:
612612
if stream:
613613
extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})}
614614
return self._post(
@@ -629,9 +629,9 @@ def completion(
629629
options=make_request_options(
630630
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
631631
),
632-
cast_to=CompletionResponse,
632+
cast_to=UnnamedTypeWithNoPropertyInfoOrParent0,
633633
stream=stream or False,
634-
stream_cls=Stream[CompletionResponse],
634+
stream_cls=Stream[UnnamedTypeWithNoPropertyInfoOrParent0],
635635
)
636636

637637
@typing_extensions.deprecated("/v1/inference/embeddings is deprecated. Please use /v1/openai/v1/embeddings.")
@@ -1122,7 +1122,7 @@ async def completion(
11221122
extra_query: Query | None = None,
11231123
extra_body: Body | None = None,
11241124
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1125-
) -> CompletionResponse:
1125+
) -> UnnamedTypeWithNoPropertyInfoOrParent0:
11261126
"""
11271127
Generate a completion for the given content using the specified model.
11281128
@@ -1169,7 +1169,7 @@ async def completion(
11691169
extra_query: Query | None = None,
11701170
extra_body: Body | None = None,
11711171
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1172-
) -> AsyncStream[CompletionResponse]:
1172+
) -> AsyncStream[UnnamedTypeWithNoPropertyInfoOrParent0]:
11731173
"""
11741174
Generate a completion for the given content using the specified model.
11751175
@@ -1216,7 +1216,7 @@ async def completion(
12161216
extra_query: Query | None = None,
12171217
extra_body: Body | None = None,
12181218
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1219-
) -> CompletionResponse | AsyncStream[CompletionResponse]:
1219+
) -> UnnamedTypeWithNoPropertyInfoOrParent0 | AsyncStream[UnnamedTypeWithNoPropertyInfoOrParent0]:
12201220
"""
12211221
Generate a completion for the given content using the specified model.
12221222
@@ -1263,7 +1263,7 @@ async def completion(
12631263
extra_query: Query | None = None,
12641264
extra_body: Body | None = None,
12651265
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1266-
) -> CompletionResponse | AsyncStream[CompletionResponse]:
1266+
) -> UnnamedTypeWithNoPropertyInfoOrParent0 | AsyncStream[UnnamedTypeWithNoPropertyInfoOrParent0]:
12671267
if stream:
12681268
extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})}
12691269
return await self._post(
@@ -1284,9 +1284,9 @@ async def completion(
12841284
options=make_request_options(
12851285
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
12861286
),
1287-
cast_to=CompletionResponse,
1287+
cast_to=UnnamedTypeWithNoPropertyInfoOrParent0,
12881288
stream=stream or False,
1289-
stream_cls=AsyncStream[CompletionResponse],
1289+
stream_cls=AsyncStream[UnnamedTypeWithNoPropertyInfoOrParent0],
12901290
)
12911291

12921292
@typing_extensions.deprecated("/v1/inference/embeddings is deprecated. Please use /v1/openai/v1/embeddings.")

src/llama_stack_client/types/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
ToolCallOrString as ToolCallOrString,
2828
CompletionMessage as CompletionMessage,
2929
InterleavedContent as InterleavedContent,
30+
SharedTokenLogProbs as SharedTokenLogProbs,
3031
ToolParamDefinition as ToolParamDefinition,
3132
ToolResponseMessage as ToolResponseMessage,
3233
QueryGeneratorConfig as QueryGeneratorConfig,
3334
ChatCompletionResponse as ChatCompletionResponse,
3435
InterleavedContentItem as InterleavedContentItem,
3536
)
3637
from .shield import Shield as Shield
37-
from .tool_def import ToolDef as ToolDef
3838
from .benchmark import Benchmark as Benchmark
3939
from .route_info import RouteInfo as RouteInfo
4040
from .scoring_fn import ScoringFn as ScoringFn
@@ -46,10 +46,8 @@
4646
from .provider_info import ProviderInfo as ProviderInfo
4747
from .tool_response import ToolResponse as ToolResponse
4848
from .inference_step import InferenceStep as InferenceStep
49-
from .tool_def_param import ToolDefParam as ToolDefParam
5049
from .create_response import CreateResponse as CreateResponse
5150
from .response_object import ResponseObject as ResponseObject
52-
from .token_log_probs import TokenLogProbs as TokenLogProbs
5351
from .file_list_params import FileListParams as FileListParams
5452
from .shield_call_step import ShieldCallStep as ShieldCallStep
5553
from .span_with_status import SpanWithStatus as SpanWithStatus
@@ -62,7 +60,6 @@
6260
from .tool_list_response import ToolListResponse as ToolListResponse
6361
from .agent_create_params import AgentCreateParams as AgentCreateParams
6462
from .agent_list_response import AgentListResponse as AgentListResponse
65-
from .completion_response import CompletionResponse as CompletionResponse
6663
from .embeddings_response import EmbeddingsResponse as EmbeddingsResponse
6764
from .list_files_response import ListFilesResponse as ListFilesResponse
6865
from .list_tools_response import ListToolsResponse as ListToolsResponse

src/llama_stack_client/types/chat_completion_response_stream_chunk.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from typing_extensions import Literal
55

66
from .._models import BaseModel
7-
from .token_log_probs import TokenLogProbs
87
from .shared.content_delta import ContentDelta
8+
from .shared.shared_token_log_probs import SharedTokenLogProbs
99

1010
__all__ = ["ChatCompletionResponseStreamChunk", "Event", "Metric"]
1111

@@ -20,7 +20,7 @@ class Event(BaseModel):
2020
event_type: Literal["start", "complete", "progress"]
2121
"""Type of the event"""
2222

23-
logprobs: Optional[List[TokenLogProbs]] = None
23+
logprobs: Optional[List[SharedTokenLogProbs]] = None
2424
"""Optional log probabilities for generated tokens"""
2525

2626
stop_reason: Optional[Literal["end_of_turn", "end_of_message", "out_of_tokens"]] = None

src/llama_stack_client/types/completion_response.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/llama_stack_client/types/shared/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
from .tool_param_definition import ToolParamDefinition as ToolParamDefinition
2323
from .tool_response_message import ToolResponseMessage as ToolResponseMessage
2424
from .query_generator_config import QueryGeneratorConfig as QueryGeneratorConfig
25+
from .shared_token_log_probs import SharedTokenLogProbs as SharedTokenLogProbs
2526
from .chat_completion_response import ChatCompletionResponse as ChatCompletionResponse
2627
from .interleaved_content_item import InterleavedContentItem as InterleavedContentItem

src/llama_stack_client/types/shared/agent_config.py

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,48 @@
44
from typing_extensions import Literal, TypeAlias
55

66
from ..._models import BaseModel
7-
from ..tool_def import ToolDef
87
from .response_format import ResponseFormat
98
from .sampling_params import SamplingParams
109

11-
__all__ = ["AgentConfig", "ToolConfig", "Toolgroup", "ToolgroupAgentToolGroupWithArgs"]
10+
__all__ = [
11+
"AgentConfig",
12+
"ClientTool",
13+
"ClientToolParameter",
14+
"ToolConfig",
15+
"Toolgroup",
16+
"ToolgroupAgentToolGroupWithArgs",
17+
]
18+
19+
20+
class ClientToolParameter(BaseModel):
21+
description: str
22+
"""Human-readable description of what the parameter does"""
23+
24+
name: str
25+
"""Name of the parameter"""
26+
27+
parameter_type: str
28+
"""Type of the parameter (e.g., string, integer)"""
29+
30+
required: bool
31+
"""Whether this parameter is required for tool invocation"""
32+
33+
default: Union[bool, float, str, List[object], object, None] = None
34+
"""(Optional) Default value for the parameter if not provided"""
35+
36+
37+
class ClientTool(BaseModel):
38+
name: str
39+
"""Name of the tool"""
40+
41+
description: Optional[str] = None
42+
"""(Optional) Human-readable description of what the tool does"""
43+
44+
metadata: Optional[Dict[str, Union[bool, float, str, List[object], object, None]]] = None
45+
"""(Optional) Additional metadata about the tool"""
46+
47+
parameters: Optional[List[ClientToolParameter]] = None
48+
"""(Optional) List of parameters this tool accepts"""
1249

1350

1451
class ToolConfig(BaseModel):
@@ -56,7 +93,7 @@ class AgentConfig(BaseModel):
5693
model: str
5794
"""The model identifier to use for the agent"""
5895

59-
client_tools: Optional[List[ToolDef]] = None
96+
client_tools: Optional[List[ClientTool]] = None
6097

6198
enable_session_persistence: Optional[bool] = None
6299
"""Optional flag indicating whether session data has to be persisted"""
Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,39 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List
3+
from typing import List, Optional
4+
from typing_extensions import Literal
45

56
from ..._models import BaseModel
6-
from ..completion_response import CompletionResponse
7+
from .shared_token_log_probs import SharedTokenLogProbs
78

8-
__all__ = ["BatchCompletion"]
9+
__all__ = ["BatchCompletion", "Batch", "BatchMetric"]
10+
11+
12+
class BatchMetric(BaseModel):
13+
metric: str
14+
"""The name of the metric"""
15+
16+
value: float
17+
"""The numeric value of the metric"""
18+
19+
unit: Optional[str] = None
20+
"""(Optional) The unit of measurement for the metric value"""
21+
22+
23+
class Batch(BaseModel):
24+
content: str
25+
"""The generated completion text"""
26+
27+
stop_reason: Literal["end_of_turn", "end_of_message", "out_of_tokens"]
28+
"""Reason why generation stopped"""
29+
30+
logprobs: Optional[List[SharedTokenLogProbs]] = None
31+
"""Optional log probabilities for generated tokens"""
32+
33+
metrics: Optional[List[BatchMetric]] = None
34+
"""(Optional) List of metrics associated with the API response"""
935

1036

1137
class BatchCompletion(BaseModel):
12-
batch: List[CompletionResponse]
38+
batch: List[Batch]
1339
"""List of completion responses, one for each input in the batch"""

0 commit comments

Comments
 (0)