Skip to content

Commit 214d838

Browse files
feat(api): manual updates
1 parent 8549433 commit 214d838

17 files changed

+158
-187
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: 107
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/llamastack%2Fllama-stack-client-f252873ea1e1f38fd207331ef2621c511154d5be3f4076e59cc15754fc58eee4.yml
33
openapi_spec_hash: 10cbb4337a06a9fdd7d08612dd6044c3
4-
config_hash: c7d7508716a41fa92482b28d5976c43a
4+
config_hash: 40b8d777e1eb8b6ab05759b663edd2fb

api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ from llama_stack_client.types import (
2020
SafetyViolation,
2121
SamplingParams,
2222
ScoringResult,
23-
SharedTokenLogProbs,
2423
SystemMessage,
2524
ToolCall,
2625
ToolParamDefinition,
@@ -62,7 +61,7 @@ Methods:
6261
Types:
6362

6463
```python
65-
from llama_stack_client.types import ToolInvocationResult, ToolRuntimeListToolsResponse
64+
from llama_stack_client.types import ToolDef, ToolInvocationResult, ToolRuntimeListToolsResponse
6665
```
6766

6867
Methods:
@@ -239,6 +238,7 @@ Types:
239238
```python
240239
from llama_stack_client.types import (
241240
ChatCompletionResponseStreamChunk,
241+
CompletionResponse,
242242
EmbeddingsResponse,
243243
TokenLogProbs,
244244
InferenceBatchChatCompletionResponse,
@@ -250,7 +250,7 @@ Methods:
250250
- <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>
251251
- <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>
252252
- <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>
253-
- <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>
253+
- <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>
254254
- <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>
255255

256256
# Embeddings

src/llama_stack_client/pagination.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,10 @@ 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 next_index is None:
28-
return None # type: ignore[unreachable]
29-
30-
length = len(self._get_page_items())
31-
current_count = next_index + length
27+
if not next_index:
28+
return None
3229

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

3532

3633
class AsyncDatasetsIterrows(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
@@ -47,13 +44,10 @@ def _get_page_items(self) -> List[_T]:
4744
@override
4845
def next_page_info(self) -> Optional[PageInfo]:
4946
next_index = self.next_index
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
47+
if not next_index:
48+
return None
5549

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

5852

5953
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
3031
from ..types.embeddings_response import EmbeddingsResponse
3132
from ..types.shared_params.message import Message
3233
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-
) -> UnnamedTypeWithNoPropertyInfoOrParent0:
470+
) -> CompletionResponse:
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[UnnamedTypeWithNoPropertyInfoOrParent0]:
517+
) -> Stream[CompletionResponse]:
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-
) -> UnnamedTypeWithNoPropertyInfoOrParent0 | Stream[UnnamedTypeWithNoPropertyInfoOrParent0]:
564+
) -> CompletionResponse | Stream[CompletionResponse]:
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-
) -> UnnamedTypeWithNoPropertyInfoOrParent0 | Stream[UnnamedTypeWithNoPropertyInfoOrParent0]:
611+
) -> CompletionResponse | Stream[CompletionResponse]:
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=UnnamedTypeWithNoPropertyInfoOrParent0,
632+
cast_to=CompletionResponse,
633633
stream=stream or False,
634-
stream_cls=Stream[UnnamedTypeWithNoPropertyInfoOrParent0],
634+
stream_cls=Stream[CompletionResponse],
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-
) -> UnnamedTypeWithNoPropertyInfoOrParent0:
1125+
) -> CompletionResponse:
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[UnnamedTypeWithNoPropertyInfoOrParent0]:
1172+
) -> AsyncStream[CompletionResponse]:
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-
) -> UnnamedTypeWithNoPropertyInfoOrParent0 | AsyncStream[UnnamedTypeWithNoPropertyInfoOrParent0]:
1219+
) -> CompletionResponse | AsyncStream[CompletionResponse]:
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-
) -> UnnamedTypeWithNoPropertyInfoOrParent0 | AsyncStream[UnnamedTypeWithNoPropertyInfoOrParent0]:
1266+
) -> CompletionResponse | AsyncStream[CompletionResponse]:
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=UnnamedTypeWithNoPropertyInfoOrParent0,
1287+
cast_to=CompletionResponse,
12881288
stream=stream or False,
1289-
stream_cls=AsyncStream[UnnamedTypeWithNoPropertyInfoOrParent0],
1289+
stream_cls=AsyncStream[CompletionResponse],
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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@
2626
SafetyViolation as SafetyViolation,
2727
CompletionMessage as CompletionMessage,
2828
InterleavedContent as InterleavedContent,
29-
SharedTokenLogProbs as SharedTokenLogProbs,
3029
ToolParamDefinition as ToolParamDefinition,
3130
ToolResponseMessage as ToolResponseMessage,
3231
QueryGeneratorConfig as QueryGeneratorConfig,
3332
ChatCompletionResponse as ChatCompletionResponse,
3433
InterleavedContentItem as InterleavedContentItem,
3534
)
3635
from .shield import Shield as Shield
36+
from .tool_def import ToolDef as ToolDef
3737
from .benchmark import Benchmark as Benchmark
3838
from .route_info import RouteInfo as RouteInfo
3939
from .scoring_fn import ScoringFn as ScoringFn
@@ -45,8 +45,10 @@
4545
from .provider_info import ProviderInfo as ProviderInfo
4646
from .tool_response import ToolResponse as ToolResponse
4747
from .inference_step import InferenceStep as InferenceStep
48+
from .tool_def_param import ToolDefParam as ToolDefParam
4849
from .create_response import CreateResponse as CreateResponse
4950
from .response_object import ResponseObject as ResponseObject
51+
from .token_log_probs import TokenLogProbs as TokenLogProbs
5052
from .file_list_params import FileListParams as FileListParams
5153
from .shield_call_step import ShieldCallStep as ShieldCallStep
5254
from .span_with_status import SpanWithStatus as SpanWithStatus
@@ -59,6 +61,7 @@
5961
from .tool_list_response import ToolListResponse as ToolListResponse
6062
from .agent_create_params import AgentCreateParams as AgentCreateParams
6163
from .agent_list_response import AgentListResponse as AgentListResponse
64+
from .completion_response import CompletionResponse as CompletionResponse
6265
from .embeddings_response import EmbeddingsResponse as EmbeddingsResponse
6366
from .list_files_response import ListFilesResponse as ListFilesResponse
6467
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
@@ -5,8 +5,8 @@
55

66
from .._models import BaseModel
77
from .shared.metric import Metric
8+
from .token_log_probs import TokenLogProbs
89
from .shared.content_delta import ContentDelta
9-
from .shared.shared_token_log_probs import SharedTokenLogProbs
1010

1111
__all__ = ["ChatCompletionResponseStreamChunk", "Event"]
1212

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

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

2727
stop_reason: Optional[Literal["end_of_turn", "end_of_message", "out_of_tokens"]] = None
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Optional
4+
from typing_extensions import Literal
5+
6+
from .._models import BaseModel
7+
from .shared.metric import Metric
8+
from .token_log_probs import TokenLogProbs
9+
10+
__all__ = ["CompletionResponse"]
11+
12+
13+
class CompletionResponse(BaseModel):
14+
content: str
15+
"""The generated completion text"""
16+
17+
stop_reason: Literal["end_of_turn", "end_of_message", "out_of_tokens"]
18+
"""Reason why generation stopped"""
19+
20+
logprobs: Optional[List[TokenLogProbs]] = None
21+
"""Optional log probabilities for generated tokens"""
22+
23+
metrics: Optional[List[Metric]] = None
24+
"""(Optional) List of metrics associated with the API response"""

src/llama_stack_client/types/shared/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@
2121
from .tool_param_definition import ToolParamDefinition as ToolParamDefinition
2222
from .tool_response_message import ToolResponseMessage as ToolResponseMessage
2323
from .query_generator_config import QueryGeneratorConfig as QueryGeneratorConfig
24-
from .shared_token_log_probs import SharedTokenLogProbs as SharedTokenLogProbs
2524
from .chat_completion_response import ChatCompletionResponse as ChatCompletionResponse
2625
from .interleaved_content_item import InterleavedContentItem as InterleavedContentItem

src/llama_stack_client/types/shared/agent_config.py

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

66
from ..._models import BaseModel
7+
from ..tool_def import ToolDef
78
from .response_format import ResponseFormat
89
from .sampling_params import SamplingParams
910

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"""
11+
__all__ = ["AgentConfig", "ToolConfig", "Toolgroup", "ToolgroupAgentToolGroupWithArgs"]
4912

5013

5114
class ToolConfig(BaseModel):
@@ -93,7 +56,7 @@ class AgentConfig(BaseModel):
9356
model: str
9457
"""The model identifier to use for the agent"""
9558

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

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

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

6-
from .metric import Metric
75
from ..._models import BaseModel
8-
from .shared_token_log_probs import SharedTokenLogProbs
6+
from ..completion_response import CompletionResponse
97

10-
__all__ = ["BatchCompletion", "Batch"]
11-
12-
13-
class Batch(BaseModel):
14-
content: str
15-
"""The generated completion text"""
16-
17-
stop_reason: Literal["end_of_turn", "end_of_message", "out_of_tokens"]
18-
"""Reason why generation stopped"""
19-
20-
logprobs: Optional[List[SharedTokenLogProbs]] = None
21-
"""Optional log probabilities for generated tokens"""
22-
23-
metrics: Optional[List[Metric]] = None
24-
"""(Optional) List of metrics associated with the API response"""
8+
__all__ = ["BatchCompletion"]
259

2610

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

0 commit comments

Comments
 (0)