Skip to content

Commit c000af0

Browse files
feat(api): manual updates
1 parent c12897d commit c000af0

File tree

9 files changed

+103
-163
lines changed

9 files changed

+103
-163
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ 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>
2423
- <code><a href="./src/resources/shared.ts">SystemMessage</a></code>
2524
- <code><a href="./src/resources/shared.ts">ToolCall</a></code>
2625
- <code><a href="./src/resources/shared.ts">ToolParamDefinition</a></code>
@@ -59,6 +58,7 @@ Methods:
5958

6059
Types:
6160

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

@@ -220,6 +220,7 @@ Methods:
220220
Types:
221221

222222
- <code><a href="./src/resources/inference.ts">ChatCompletionResponseStreamChunk</a></code>
223+
- <code><a href="./src/resources/inference.ts">CompletionResponse</a></code>
223224
- <code><a href="./src/resources/inference.ts">EmbeddingsResponse</a></code>
224225
- <code><a href="./src/resources/inference.ts">TokenLogProbs</a></code>
225226
- <code><a href="./src/resources/inference.ts">InferenceBatchChatCompletionResponse</a></code>

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import {
5151
} from './resources/files';
5252
import {
5353
ChatCompletionResponseStreamChunk,
54+
CompletionResponse,
5455
EmbeddingsResponse,
5556
Inference,
5657
InferenceBatchChatCompletionParams,
@@ -190,6 +191,7 @@ import {
190191
Responses,
191192
} from './resources/responses/responses';
192193
import {
194+
ToolDef,
193195
ToolInvocationResult,
194196
ToolRuntime,
195197
ToolRuntimeInvokeToolParams,
@@ -463,6 +465,7 @@ export declare namespace LlamaStackClient {
463465

464466
export {
465467
ToolRuntime as ToolRuntime,
468+
type ToolDef as ToolDef,
466469
type ToolInvocationResult as ToolInvocationResult,
467470
type ToolRuntimeListToolsResponse as ToolRuntimeListToolsResponse,
468471
type ToolRuntimeInvokeToolParams as ToolRuntimeInvokeToolParams,
@@ -530,6 +533,7 @@ export declare namespace LlamaStackClient {
530533
export {
531534
Inference as Inference,
532535
type ChatCompletionResponseStreamChunk as ChatCompletionResponseStreamChunk,
536+
type CompletionResponse as CompletionResponse,
533537
type EmbeddingsResponse as EmbeddingsResponse,
534538
type TokenLogProbs as TokenLogProbs,
535539
type InferenceBatchChatCompletionResponse as InferenceBatchChatCompletionResponse,
@@ -718,7 +722,6 @@ export declare namespace LlamaStackClient {
718722
export type SafetyViolation = API.SafetyViolation;
719723
export type SamplingParams = API.SamplingParams;
720724
export type ScoringResult = API.ScoringResult;
721-
export type SharedTokenLogProbs = API.SharedTokenLogProbs;
722725
export type SystemMessage = API.SystemMessage;
723726
export type ToolCall = API.ToolCall;
724727
export type ToolParamDefinition = API.ToolParamDefinition;

src/pagination.ts

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

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

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

src/resources/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export {
6565
export {
6666
Inference,
6767
type ChatCompletionResponseStreamChunk,
68+
type CompletionResponse,
6869
type EmbeddingsResponse,
6970
type TokenLogProbs,
7071
type InferenceBatchChatCompletionResponse,
@@ -157,6 +158,7 @@ export {
157158
} from './telemetry';
158159
export {
159160
ToolRuntime,
161+
type ToolDef,
160162
type ToolInvocationResult,
161163
type ToolRuntimeListToolsResponse,
162164
type ToolRuntimeInvokeToolParams,

src/resources/inference.ts

Lines changed: 27 additions & 1 deletion
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<Shared.SharedTokenLogProbs>;
134+
logprobs?: Array<InferenceAPI.TokenLogProbs>;
135135

136136
/**
137137
* Optional reason why generation stopped, if complete
@@ -140,6 +140,31 @@ export namespace ChatCompletionResponseStreamChunk {
140140
}
141141
}
142142

143+
/**
144+
* Response from a completion request.
145+
*/
146+
export interface CompletionResponse {
147+
/**
148+
* The generated completion text
149+
*/
150+
content: string;
151+
152+
/**
153+
* Reason why generation stopped
154+
*/
155+
stop_reason: 'end_of_turn' | 'end_of_message' | 'out_of_tokens';
156+
157+
/**
158+
* Optional log probabilities for generated tokens
159+
*/
160+
logprobs?: Array<TokenLogProbs>;
161+
162+
/**
163+
* (Optional) List of metrics associated with the API response
164+
*/
165+
metrics?: Array<Shared.Metric>;
166+
}
167+
143168
/**
144169
* Response containing generated embeddings.
145170
*/
@@ -553,6 +578,7 @@ export interface InferenceEmbeddingsParams {
553578
export declare namespace Inference {
554579
export {
555580
type ChatCompletionResponseStreamChunk as ChatCompletionResponseStreamChunk,
581+
type CompletionResponse as CompletionResponse,
556582
type EmbeddingsResponse as EmbeddingsResponse,
557583
type TokenLogProbs as TokenLogProbs,
558584
type InferenceBatchChatCompletionResponse as InferenceBatchChatCompletionResponse,

src/resources/shared.ts

Lines changed: 5 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
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';
46

57
/**
68
* Configuration for an agent.
@@ -16,7 +18,7 @@ export interface AgentConfig {
1618
*/
1719
model: string;
1820

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

2123
/**
2224
* Optional flag indicating whether session data has to be persisted
@@ -65,63 +67,6 @@ export interface AgentConfig {
6567
}
6668

6769
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-
12570
/**
12671
* Configuration for tool use.
12772
*/
@@ -167,34 +112,7 @@ export interface BatchCompletion {
167112
/**
168113
* List of completion responses, one for each input in the batch
169114
*/
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<Shared.Metric>;
197-
}
115+
batch: Array<InferenceAPI.CompletionResponse>;
198116
}
199117

200118
/**
@@ -209,7 +127,7 @@ export interface ChatCompletionResponse {
209127
/**
210128
* Optional log probabilities for generated tokens
211129
*/
212-
logprobs?: Array<SharedTokenLogProbs>;
130+
logprobs?: Array<InferenceAPI.TokenLogProbs>;
213131

214132
/**
215133
* (Optional) List of metrics associated with the API response
@@ -978,16 +896,6 @@ export interface ScoringResult {
978896
score_rows: Array<{ [key: string]: boolean | number | string | Array<unknown> | unknown | null }>;
979897
}
980898

981-
/**
982-
* Log probabilities for generated tokens.
983-
*/
984-
export interface SharedTokenLogProbs {
985-
/**
986-
* Dictionary mapping tokens to their log probabilities
987-
*/
988-
logprobs_by_token: { [key: string]: number };
989-
}
990-
991899
/**
992900
* A system message providing instructions or context to the model.
993901
*/

src/resources/tool-runtime/index.ts

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

0 commit comments

Comments
 (0)