Skip to content

Commit 58379c6

Browse files
feat(api): manual updates
1 parent 6ea2c4e commit 58379c6

File tree

9 files changed

+185
-125
lines changed

9 files changed

+185
-125
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: de16e52db65de71ac35adcdb665a74f5
4+
config_hash: ddcbd66d7ac80290da208232a746e30f

api.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Types:
2020
- <code><a href="./src/resources/shared.ts">SafetyViolation</a></code>
2121
- <code><a href="./src/resources/shared.ts">SamplingParams</a></code>
2222
- <code><a href="./src/resources/shared.ts">ScoringResult</a></code>
23+
- <code><a href="./src/resources/shared.ts">SharedTokenLogProbs</a></code>
2324
- <code><a href="./src/resources/shared.ts">SystemMessage</a></code>
2425
- <code><a href="./src/resources/shared.ts">ToolCall</a></code>
2526
- <code><a href="./src/resources/shared.ts">ToolCallOrString</a></code>
@@ -59,7 +60,6 @@ Methods:
5960

6061
Types:
6162

62-
- <code><a href="./src/resources/tool-runtime/tool-runtime.ts">ToolDef</a></code>
6363
- <code><a href="./src/resources/tool-runtime/tool-runtime.ts">ToolInvocationResult</a></code>
6464
- <code><a href="./src/resources/tool-runtime/tool-runtime.ts">ToolRuntimeListToolsResponse</a></code>
6565

@@ -221,7 +221,6 @@ Methods:
221221
Types:
222222

223223
- <code><a href="./src/resources/inference.ts">ChatCompletionResponseStreamChunk</a></code>
224-
- <code><a href="./src/resources/inference.ts">CompletionResponse</a></code>
225224
- <code><a href="./src/resources/inference.ts">EmbeddingsResponse</a></code>
226225
- <code><a href="./src/resources/inference.ts">TokenLogProbs</a></code>
227226
- <code><a href="./src/resources/inference.ts">InferenceBatchChatCompletionResponse</a></code>

src/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import {
4545
} from './resources/files';
4646
import {
4747
ChatCompletionResponseStreamChunk,
48-
CompletionResponse,
4948
EmbeddingsResponse,
5049
Inference,
5150
InferenceBatchChatCompletionParams,
@@ -182,7 +181,6 @@ import {
182181
Responses,
183182
} from './resources/responses/responses';
184183
import {
185-
ToolDef,
186184
ToolInvocationResult,
187185
ToolRuntime,
188186
ToolRuntimeInvokeToolParams,
@@ -445,7 +443,6 @@ export declare namespace LlamaStackClient {
445443

446444
export {
447445
ToolRuntime as ToolRuntime,
448-
type ToolDef as ToolDef,
449446
type ToolInvocationResult as ToolInvocationResult,
450447
type ToolRuntimeListToolsResponse as ToolRuntimeListToolsResponse,
451448
type ToolRuntimeInvokeToolParams as ToolRuntimeInvokeToolParams,
@@ -512,7 +509,6 @@ export declare namespace LlamaStackClient {
512509
export {
513510
Inference as Inference,
514511
type ChatCompletionResponseStreamChunk as ChatCompletionResponseStreamChunk,
515-
type CompletionResponse as CompletionResponse,
516512
type EmbeddingsResponse as EmbeddingsResponse,
517513
type TokenLogProbs as TokenLogProbs,
518514
type InferenceBatchChatCompletionResponse as InferenceBatchChatCompletionResponse,
@@ -697,6 +693,7 @@ export declare namespace LlamaStackClient {
697693
export type SafetyViolation = API.SafetyViolation;
698694
export type SamplingParams = API.SamplingParams;
699695
export type ScoringResult = API.ScoringResult;
696+
export type SharedTokenLogProbs = API.SharedTokenLogProbs;
700697
export type SystemMessage = API.SystemMessage;
701698
export type ToolCall = API.ToolCall;
702699
export type ToolCallOrString = API.ToolCallOrString;

src/pagination.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,14 @@ export class DatasetsIterrows<Item> extends AbstractPage<Item> implements Datase
4848
}
4949

5050
nextPageInfo(): PageInfo | null {
51-
const cursor = this.next_index;
52-
if (!cursor) {
51+
const offset = this.next_index;
52+
if (!offset) {
5353
return null;
5454
}
5555

56-
return {
57-
params: {
58-
start_index: cursor,
59-
},
60-
};
56+
const length = this.getPaginatedItems().length;
57+
const currentCount = offset + length;
58+
59+
return { params: { start_index: currentCount } };
6160
}
6261
}

src/resources/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export {
6464
export {
6565
Inference,
6666
type ChatCompletionResponseStreamChunk,
67-
type CompletionResponse,
6867
type EmbeddingsResponse,
6968
type TokenLogProbs,
7069
type InferenceBatchChatCompletionResponse,
@@ -154,7 +153,6 @@ export {
154153
} from './telemetry';
155154
export {
156155
ToolRuntime,
157-
type ToolDef,
158156
type ToolInvocationResult,
159157
type ToolRuntimeListToolsResponse,
160158
type ToolRuntimeInvokeToolParams,

src/resources/inference.ts

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export namespace ChatCompletionResponseStreamChunk {
131131
/**
132132
* Optional log probabilities for generated tokens
133133
*/
134-
logprobs?: Array<InferenceAPI.TokenLogProbs>;
134+
logprobs?: Array<Shared.SharedTokenLogProbs>;
135135

136136
/**
137137
* Optional reason why generation stopped, if complete
@@ -160,53 +160,6 @@ export namespace ChatCompletionResponseStreamChunk {
160160
}
161161
}
162162

163-
/**
164-
* Response from a completion request.
165-
*/
166-
export interface CompletionResponse {
167-
/**
168-
* The generated completion text
169-
*/
170-
content: string;
171-
172-
/**
173-
* Reason why generation stopped
174-
*/
175-
stop_reason: 'end_of_turn' | 'end_of_message' | 'out_of_tokens';
176-
177-
/**
178-
* Optional log probabilities for generated tokens
179-
*/
180-
logprobs?: Array<TokenLogProbs>;
181-
182-
/**
183-
* (Optional) List of metrics associated with the API response
184-
*/
185-
metrics?: Array<CompletionResponse.Metric>;
186-
}
187-
188-
export namespace CompletionResponse {
189-
/**
190-
* A metric value included in API responses.
191-
*/
192-
export interface Metric {
193-
/**
194-
* The name of the metric
195-
*/
196-
metric: string;
197-
198-
/**
199-
* The numeric value of the metric
200-
*/
201-
value: number;
202-
203-
/**
204-
* (Optional) The unit of measurement for the metric value
205-
*/
206-
unit?: string;
207-
}
208-
}
209-
210163
/**
211164
* Response containing generated embeddings.
212165
*/
@@ -620,7 +573,6 @@ export interface InferenceEmbeddingsParams {
620573
export declare namespace Inference {
621574
export {
622575
type ChatCompletionResponseStreamChunk as ChatCompletionResponseStreamChunk,
623-
type CompletionResponse as CompletionResponse,
624576
type EmbeddingsResponse as EmbeddingsResponse,
625577
type TokenLogProbs as TokenLogProbs,
626578
type InferenceBatchChatCompletionResponse as InferenceBatchChatCompletionResponse,

src/resources/shared.ts

Lines changed: 119 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
import * as Shared from './shared';
4-
import * as InferenceAPI from './inference';
5-
import * as ToolRuntimeAPI from './tool-runtime/tool-runtime';
64

75
/**
86
* Configuration for an agent.
@@ -18,7 +16,7 @@ export interface AgentConfig {
1816
*/
1917
model: string;
2018

21-
client_tools?: Array<ToolRuntimeAPI.ToolDef>;
19+
client_tools?: Array<AgentConfig.ClientTool>;
2220

2321
/**
2422
* Optional flag indicating whether session data has to be persisted
@@ -67,6 +65,63 @@ export interface AgentConfig {
6765
}
6866

6967
export namespace AgentConfig {
68+
/**
69+
* Tool definition used in runtime contexts.
70+
*/
71+
export interface ClientTool {
72+
/**
73+
* Name of the tool
74+
*/
75+
name: string;
76+
77+
/**
78+
* (Optional) Human-readable description of what the tool does
79+
*/
80+
description?: string;
81+
82+
/**
83+
* (Optional) Additional metadata about the tool
84+
*/
85+
metadata?: { [key: string]: boolean | number | string | Array<unknown> | unknown | null };
86+
87+
/**
88+
* (Optional) List of parameters this tool accepts
89+
*/
90+
parameters?: Array<ClientTool.Parameter>;
91+
}
92+
93+
export namespace ClientTool {
94+
/**
95+
* Parameter definition for a tool.
96+
*/
97+
export interface Parameter {
98+
/**
99+
* Human-readable description of what the parameter does
100+
*/
101+
description: string;
102+
103+
/**
104+
* Name of the parameter
105+
*/
106+
name: string;
107+
108+
/**
109+
* Type of the parameter (e.g., string, integer)
110+
*/
111+
parameter_type: string;
112+
113+
/**
114+
* Whether this parameter is required for tool invocation
115+
*/
116+
required: boolean;
117+
118+
/**
119+
* (Optional) Default value for the parameter if not provided
120+
*/
121+
default?: boolean | number | string | Array<unknown> | unknown | null;
122+
}
123+
}
124+
70125
/**
71126
* Configuration for tool use.
72127
*/
@@ -112,7 +167,56 @@ export interface BatchCompletion {
112167
/**
113168
* List of completion responses, one for each input in the batch
114169
*/
115-
batch: Array<InferenceAPI.CompletionResponse>;
170+
batch: Array<BatchCompletion.Batch>;
171+
}
172+
173+
export namespace BatchCompletion {
174+
/**
175+
* Response from a completion request.
176+
*/
177+
export interface Batch {
178+
/**
179+
* The generated completion text
180+
*/
181+
content: string;
182+
183+
/**
184+
* Reason why generation stopped
185+
*/
186+
stop_reason: 'end_of_turn' | 'end_of_message' | 'out_of_tokens';
187+
188+
/**
189+
* Optional log probabilities for generated tokens
190+
*/
191+
logprobs?: Array<Shared.SharedTokenLogProbs>;
192+
193+
/**
194+
* (Optional) List of metrics associated with the API response
195+
*/
196+
metrics?: Array<Batch.Metric>;
197+
}
198+
199+
export namespace Batch {
200+
/**
201+
* A metric value included in API responses.
202+
*/
203+
export interface Metric {
204+
/**
205+
* The name of the metric
206+
*/
207+
metric: string;
208+
209+
/**
210+
* The numeric value of the metric
211+
*/
212+
value: number;
213+
214+
/**
215+
* (Optional) The unit of measurement for the metric value
216+
*/
217+
unit?: string;
218+
}
219+
}
116220
}
117221

118222
/**
@@ -127,7 +231,7 @@ export interface ChatCompletionResponse {
127231
/**
128232
* Optional log probabilities for generated tokens
129233
*/
130-
logprobs?: Array<InferenceAPI.TokenLogProbs>;
234+
logprobs?: Array<SharedTokenLogProbs>;
131235

132236
/**
133237
* (Optional) List of metrics associated with the API response
@@ -912,6 +1016,16 @@ export interface ScoringResult {
9121016
score_rows: Array<{ [key: string]: boolean | number | string | Array<unknown> | unknown | null }>;
9131017
}
9141018

1019+
/**
1020+
* Log probabilities for generated tokens.
1021+
*/
1022+
export interface SharedTokenLogProbs {
1023+
/**
1024+
* Dictionary mapping tokens to their log probabilities
1025+
*/
1026+
logprobs_by_token: { [key: string]: number };
1027+
}
1028+
9151029
/**
9161030
* A system message providing instructions or context to the model.
9171031
*/

src/resources/tool-runtime/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
export { RagTool, type RagToolInsertParams, type RagToolQueryParams } from './rag-tool';
44
export {
55
ToolRuntime,
6-
type ToolDef,
76
type ToolInvocationResult,
87
type ToolRuntimeListToolsResponse,
98
type ToolRuntimeInvokeToolParams,

0 commit comments

Comments
 (0)