llama-stack-client 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.d.ts.map +1 -1
- package/core.js +12 -6
- package/core.js.map +1 -1
- package/core.mjs +12 -6
- package/core.mjs.map +1 -1
- package/index.d.mts +16 -6
- package/index.d.ts +16 -6
- package/index.d.ts.map +1 -1
- package/index.js +13 -1
- package/index.js.map +1 -1
- package/index.mjs +14 -2
- package/index.mjs.map +1 -1
- package/internal/decoders/line.d.ts +2 -2
- package/internal/decoders/line.d.ts.map +1 -1
- package/internal/decoders/line.js +69 -34
- package/internal/decoders/line.js.map +1 -1
- package/internal/decoders/line.mjs +69 -34
- package/internal/decoders/line.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agents/agents.d.ts +9 -0
- package/resources/agents/agents.d.ts.map +1 -1
- package/resources/agents/agents.js.map +1 -1
- package/resources/agents/agents.mjs.map +1 -1
- package/resources/agents/session.d.ts +3 -0
- package/resources/agents/session.d.ts.map +1 -1
- package/resources/agents/turn.d.ts +91 -5
- package/resources/agents/turn.d.ts.map +1 -1
- package/resources/batch-inference.d.ts +14 -0
- package/resources/batch-inference.d.ts.map +1 -1
- package/resources/benchmarks.d.ts +32 -0
- package/resources/benchmarks.d.ts.map +1 -0
- package/resources/benchmarks.js +22 -0
- package/resources/benchmarks.js.map +1 -0
- package/resources/benchmarks.mjs +18 -0
- package/resources/benchmarks.mjs.map +1 -0
- package/resources/datasets.d.ts +19 -15
- package/resources/datasets.d.ts.map +1 -1
- package/resources/eval/eval.d.ts +22 -18
- package/resources/eval/eval.d.ts.map +1 -1
- package/resources/eval/eval.js +6 -0
- package/resources/eval/eval.js.map +1 -1
- package/resources/eval/eval.mjs +6 -0
- package/resources/eval/eval.mjs.map +1 -1
- package/resources/eval/index.d.ts +1 -1
- package/resources/eval/index.d.ts.map +1 -1
- package/resources/eval/index.js.map +1 -1
- package/resources/eval/index.mjs.map +1 -1
- package/resources/eval/jobs.d.ts +3 -3
- package/resources/eval/jobs.d.ts.map +1 -1
- package/resources/eval/jobs.js +6 -6
- package/resources/eval/jobs.js.map +1 -1
- package/resources/eval/jobs.mjs +6 -6
- package/resources/eval/jobs.mjs.map +1 -1
- package/resources/eval-tasks.d.ts +6 -17
- package/resources/eval-tasks.d.ts.map +1 -1
- package/resources/eval-tasks.js.map +1 -1
- package/resources/eval-tasks.mjs.map +1 -1
- package/resources/index.d.ts +3 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/inference.d.ts +58 -2
- package/resources/inference.d.ts.map +1 -1
- package/resources/models.d.ts +1 -1
- package/resources/models.d.ts.map +1 -1
- package/resources/post-training/job.d.ts +8 -1
- package/resources/post-training/job.d.ts.map +1 -1
- package/resources/post-training/job.js.map +1 -1
- package/resources/post-training/job.mjs.map +1 -1
- package/resources/providers.d.ts +1 -1
- package/resources/providers.d.ts.map +1 -1
- package/resources/routes.d.ts +1 -1
- package/resources/routes.d.ts.map +1 -1
- package/resources/scoring-functions.d.ts +1 -1
- package/resources/scoring-functions.d.ts.map +1 -1
- package/resources/shared.d.ts +152 -11
- package/resources/shared.d.ts.map +1 -1
- package/resources/shields.d.ts +4 -1
- package/resources/shields.d.ts.map +1 -1
- package/resources/synthetic-data-generation.d.ts +7 -0
- package/resources/synthetic-data-generation.d.ts.map +1 -1
- package/resources/telemetry.d.ts +4 -15
- package/resources/telemetry.d.ts.map +1 -1
- package/resources/tool-runtime/rag-tool.d.ts +3 -0
- package/resources/tool-runtime/rag-tool.d.ts.map +1 -1
- package/resources/tool-runtime/tool-runtime.d.ts +9 -1
- package/resources/tool-runtime/tool-runtime.d.ts.map +1 -1
- package/resources/tool-runtime/tool-runtime.js.map +1 -1
- package/resources/tool-runtime/tool-runtime.mjs.map +1 -1
- package/resources/toolgroups.d.ts +13 -4
- package/resources/toolgroups.d.ts.map +1 -1
- package/resources/toolgroups.js.map +1 -1
- package/resources/toolgroups.mjs.map +1 -1
- package/resources/tools.d.ts +1 -1
- package/resources/tools.d.ts.map +1 -1
- package/resources/vector-dbs.d.ts +1 -11
- package/resources/vector-dbs.d.ts.map +1 -1
- package/resources/vector-io.d.ts +9 -0
- package/resources/vector-io.d.ts.map +1 -1
- package/src/core.ts +14 -6
- package/src/index.ts +48 -13
- package/src/internal/decoders/line.ts +69 -38
- package/src/resources/agents/agents.ts +9 -0
- package/src/resources/agents/session.ts +3 -0
- package/src/resources/agents/turn.ts +100 -6
- package/src/resources/batch-inference.ts +14 -0
- package/src/resources/benchmarks.ts +69 -0
- package/src/resources/datasets.ts +22 -22
- package/src/resources/eval/eval.ts +46 -26
- package/src/resources/eval/index.ts +3 -1
- package/src/resources/eval/jobs.ts +6 -6
- package/src/resources/eval-tasks.ts +11 -27
- package/src/resources/index.ts +11 -8
- package/src/resources/inference.ts +71 -2
- package/src/resources/models.ts +1 -1
- package/src/resources/post-training/job.ts +14 -2
- package/src/resources/providers.ts +1 -1
- package/src/resources/routes.ts +1 -1
- package/src/resources/scoring-functions.ts +1 -1
- package/src/resources/shared.ts +172 -14
- package/src/resources/shields.ts +4 -1
- package/src/resources/synthetic-data-generation.ts +7 -0
- package/src/resources/telemetry.ts +4 -22
- package/src/resources/tool-runtime/rag-tool.ts +3 -0
- package/src/resources/tool-runtime/tool-runtime.ts +10 -1
- package/src/resources/toolgroups.ts +15 -4
- package/src/resources/tools.ts +1 -1
- package/src/resources/vector-dbs.ts +1 -17
- package/src/resources/vector-io.ts +9 -0
- package/src/streaming.ts +5 -1
- package/src/version.ts +1 -1
- package/streaming.d.ts +3 -1
- package/streaming.d.ts.map +1 -1
- package/streaming.js +4 -1
- package/streaming.js.map +1 -1
- package/streaming.mjs +4 -1
- package/streaming.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/resources/shared.ts
CHANGED
|
@@ -5,32 +5,79 @@ import * as InferenceAPI from './inference';
|
|
|
5
5
|
import * as ToolRuntimeAPI from './tool-runtime/tool-runtime';
|
|
6
6
|
|
|
7
7
|
export interface AgentConfig {
|
|
8
|
-
enable_session_persistence: boolean;
|
|
9
|
-
|
|
10
8
|
instructions: string;
|
|
11
9
|
|
|
12
|
-
max_infer_iters: number;
|
|
13
|
-
|
|
14
10
|
model: string;
|
|
15
11
|
|
|
16
12
|
client_tools?: Array<ToolRuntimeAPI.ToolDef>;
|
|
17
13
|
|
|
14
|
+
enable_session_persistence?: boolean;
|
|
15
|
+
|
|
18
16
|
input_shields?: Array<string>;
|
|
19
17
|
|
|
18
|
+
max_infer_iters?: number;
|
|
19
|
+
|
|
20
20
|
output_shields?: Array<string>;
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Configuration for JSON schema-guided response generation.
|
|
24
|
+
*/
|
|
22
25
|
response_format?: ResponseFormat;
|
|
23
26
|
|
|
24
27
|
sampling_params?: SamplingParams;
|
|
25
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Whether tool use is required or automatic. This is a hint to the model which may
|
|
31
|
+
* not be followed. It depends on the Instruction Following capabilities of the
|
|
32
|
+
* model.
|
|
33
|
+
*/
|
|
26
34
|
tool_choice?: 'auto' | 'required';
|
|
27
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Configuration for tool use.
|
|
38
|
+
*/
|
|
39
|
+
tool_config?: AgentConfig.ToolConfig;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Prompt format for calling custom / zero shot tools.
|
|
43
|
+
*/
|
|
28
44
|
tool_prompt_format?: 'json' | 'function_tag' | 'python_list';
|
|
29
45
|
|
|
30
46
|
toolgroups?: Array<string | AgentConfig.UnionMember1>;
|
|
31
47
|
}
|
|
32
48
|
|
|
33
49
|
export namespace AgentConfig {
|
|
50
|
+
/**
|
|
51
|
+
* Configuration for tool use.
|
|
52
|
+
*/
|
|
53
|
+
export interface ToolConfig {
|
|
54
|
+
/**
|
|
55
|
+
* (Optional) Config for how to override the default system prompt. -
|
|
56
|
+
* `SystemMessageBehavior.append`: Appends the provided system message to the
|
|
57
|
+
* default system prompt. - `SystemMessageBehavior.replace`: Replaces the default
|
|
58
|
+
* system prompt with the provided system message. The system message can include
|
|
59
|
+
* the string '{{function_definitions}}' to indicate where the function definitions
|
|
60
|
+
* should be inserted.
|
|
61
|
+
*/
|
|
62
|
+
system_message_behavior: 'append' | 'replace';
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* (Optional) Whether tool use is required or automatic. Defaults to
|
|
66
|
+
* ToolChoice.auto.
|
|
67
|
+
*/
|
|
68
|
+
tool_choice?: 'auto' | 'required';
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* (Optional) Instructs the model how to format tool calls. By default, Llama Stack
|
|
72
|
+
* will attempt to use a format that is best adapted to the model. -
|
|
73
|
+
* `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. -
|
|
74
|
+
* `ToolPromptFormat.function_tag`: The tool calls are enclosed in a
|
|
75
|
+
* <function=function_name> tag. - `ToolPromptFormat.python_list`: The tool calls
|
|
76
|
+
* are output as Python syntax -- a list of function calls.
|
|
77
|
+
*/
|
|
78
|
+
tool_prompt_format?: 'json' | 'function_tag' | 'python_list';
|
|
79
|
+
}
|
|
80
|
+
|
|
34
81
|
export interface UnionMember1 {
|
|
35
82
|
args: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
|
|
36
83
|
|
|
@@ -42,6 +89,9 @@ export interface BatchCompletion {
|
|
|
42
89
|
batch: Array<InferenceAPI.CompletionResponse>;
|
|
43
90
|
}
|
|
44
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Response from a chat completion request.
|
|
94
|
+
*/
|
|
45
95
|
export interface ChatCompletionResponse {
|
|
46
96
|
/**
|
|
47
97
|
* The complete response message
|
|
@@ -52,8 +102,33 @@ export interface ChatCompletionResponse {
|
|
|
52
102
|
* Optional log probabilities for generated tokens
|
|
53
103
|
*/
|
|
54
104
|
logprobs?: Array<InferenceAPI.TokenLogProbs>;
|
|
105
|
+
|
|
106
|
+
metrics?: Array<ChatCompletionResponse.Metric>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export namespace ChatCompletionResponse {
|
|
110
|
+
export interface Metric {
|
|
111
|
+
metric: string;
|
|
112
|
+
|
|
113
|
+
span_id: string;
|
|
114
|
+
|
|
115
|
+
timestamp: string;
|
|
116
|
+
|
|
117
|
+
trace_id: string;
|
|
118
|
+
|
|
119
|
+
type: 'metric';
|
|
120
|
+
|
|
121
|
+
unit: string;
|
|
122
|
+
|
|
123
|
+
value: number;
|
|
124
|
+
|
|
125
|
+
attributes?: Record<string, string | number | boolean | null>;
|
|
126
|
+
}
|
|
55
127
|
}
|
|
56
128
|
|
|
129
|
+
/**
|
|
130
|
+
* A message containing the model's (assistant) response in a chat conversation.
|
|
131
|
+
*/
|
|
57
132
|
export interface CompletionMessage {
|
|
58
133
|
/**
|
|
59
134
|
* The content of the model's response
|
|
@@ -78,7 +153,7 @@ export interface CompletionMessage {
|
|
|
78
153
|
/**
|
|
79
154
|
* List of tool calls. Each tool call is a ToolCall object.
|
|
80
155
|
*/
|
|
81
|
-
tool_calls
|
|
156
|
+
tool_calls?: Array<ToolCall>;
|
|
82
157
|
}
|
|
83
158
|
|
|
84
159
|
export type ContentDelta = ContentDelta.TextDelta | ContentDelta.ImageDelta | ContentDelta.ToolCallDelta;
|
|
@@ -99,19 +174,22 @@ export namespace ContentDelta {
|
|
|
99
174
|
export interface ToolCallDelta {
|
|
100
175
|
parse_status: 'started' | 'in_progress' | 'failed' | 'succeeded';
|
|
101
176
|
|
|
102
|
-
tool_call:
|
|
177
|
+
tool_call: Shared.ToolCallOrString;
|
|
103
178
|
|
|
104
179
|
type: 'tool_call';
|
|
105
180
|
}
|
|
106
181
|
}
|
|
107
182
|
|
|
108
183
|
export interface Document {
|
|
184
|
+
/**
|
|
185
|
+
* A image content item
|
|
186
|
+
*/
|
|
109
187
|
content:
|
|
110
188
|
| string
|
|
111
189
|
| Document.ImageContentItem
|
|
112
190
|
| Document.TextContentItem
|
|
113
191
|
| Array<InterleavedContentItem>
|
|
114
|
-
| URL;
|
|
192
|
+
| Document.URL;
|
|
115
193
|
|
|
116
194
|
document_id: string;
|
|
117
195
|
|
|
@@ -121,6 +199,9 @@ export interface Document {
|
|
|
121
199
|
}
|
|
122
200
|
|
|
123
201
|
export namespace Document {
|
|
202
|
+
/**
|
|
203
|
+
* A image content item
|
|
204
|
+
*/
|
|
124
205
|
export interface ImageContentItem {
|
|
125
206
|
/**
|
|
126
207
|
* Image as a base64 encoded string or an URL
|
|
@@ -147,10 +228,23 @@ export namespace Document {
|
|
|
147
228
|
* A URL of the image or data URL in the format of data:image/{type};base64,{data}.
|
|
148
229
|
* Note that URL could have length limits.
|
|
149
230
|
*/
|
|
150
|
-
url?:
|
|
231
|
+
url?: Image.URL;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export namespace Image {
|
|
235
|
+
/**
|
|
236
|
+
* A URL of the image or data URL in the format of data:image/{type};base64,{data}.
|
|
237
|
+
* Note that URL could have length limits.
|
|
238
|
+
*/
|
|
239
|
+
export interface URL {
|
|
240
|
+
uri: string;
|
|
241
|
+
}
|
|
151
242
|
}
|
|
152
243
|
}
|
|
153
244
|
|
|
245
|
+
/**
|
|
246
|
+
* A text content item
|
|
247
|
+
*/
|
|
154
248
|
export interface TextContentItem {
|
|
155
249
|
/**
|
|
156
250
|
* Text content
|
|
@@ -162,8 +256,15 @@ export namespace Document {
|
|
|
162
256
|
*/
|
|
163
257
|
type: 'text';
|
|
164
258
|
}
|
|
259
|
+
|
|
260
|
+
export interface URL {
|
|
261
|
+
uri: string;
|
|
262
|
+
}
|
|
165
263
|
}
|
|
166
264
|
|
|
265
|
+
/**
|
|
266
|
+
* A image content item
|
|
267
|
+
*/
|
|
167
268
|
export type InterleavedContent =
|
|
168
269
|
| string
|
|
169
270
|
| InterleavedContent.ImageContentItem
|
|
@@ -171,6 +272,9 @@ export type InterleavedContent =
|
|
|
171
272
|
| Array<InterleavedContentItem>;
|
|
172
273
|
|
|
173
274
|
export namespace InterleavedContent {
|
|
275
|
+
/**
|
|
276
|
+
* A image content item
|
|
277
|
+
*/
|
|
174
278
|
export interface ImageContentItem {
|
|
175
279
|
/**
|
|
176
280
|
* Image as a base64 encoded string or an URL
|
|
@@ -197,10 +301,23 @@ export namespace InterleavedContent {
|
|
|
197
301
|
* A URL of the image or data URL in the format of data:image/{type};base64,{data}.
|
|
198
302
|
* Note that URL could have length limits.
|
|
199
303
|
*/
|
|
200
|
-
url?:
|
|
304
|
+
url?: Image.URL;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export namespace Image {
|
|
308
|
+
/**
|
|
309
|
+
* A URL of the image or data URL in the format of data:image/{type};base64,{data}.
|
|
310
|
+
* Note that URL could have length limits.
|
|
311
|
+
*/
|
|
312
|
+
export interface URL {
|
|
313
|
+
uri: string;
|
|
314
|
+
}
|
|
201
315
|
}
|
|
202
316
|
}
|
|
203
317
|
|
|
318
|
+
/**
|
|
319
|
+
* A text content item
|
|
320
|
+
*/
|
|
204
321
|
export interface TextContentItem {
|
|
205
322
|
/**
|
|
206
323
|
* Text content
|
|
@@ -214,11 +331,17 @@ export namespace InterleavedContent {
|
|
|
214
331
|
}
|
|
215
332
|
}
|
|
216
333
|
|
|
334
|
+
/**
|
|
335
|
+
* A image content item
|
|
336
|
+
*/
|
|
217
337
|
export type InterleavedContentItem =
|
|
218
338
|
| InterleavedContentItem.ImageContentItem
|
|
219
339
|
| InterleavedContentItem.TextContentItem;
|
|
220
340
|
|
|
221
341
|
export namespace InterleavedContentItem {
|
|
342
|
+
/**
|
|
343
|
+
* A image content item
|
|
344
|
+
*/
|
|
222
345
|
export interface ImageContentItem {
|
|
223
346
|
/**
|
|
224
347
|
* Image as a base64 encoded string or an URL
|
|
@@ -245,10 +368,23 @@ export namespace InterleavedContentItem {
|
|
|
245
368
|
* A URL of the image or data URL in the format of data:image/{type};base64,{data}.
|
|
246
369
|
* Note that URL could have length limits.
|
|
247
370
|
*/
|
|
248
|
-
url?:
|
|
371
|
+
url?: Image.URL;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export namespace Image {
|
|
375
|
+
/**
|
|
376
|
+
* A URL of the image or data URL in the format of data:image/{type};base64,{data}.
|
|
377
|
+
* Note that URL could have length limits.
|
|
378
|
+
*/
|
|
379
|
+
export interface URL {
|
|
380
|
+
uri: string;
|
|
381
|
+
}
|
|
249
382
|
}
|
|
250
383
|
}
|
|
251
384
|
|
|
385
|
+
/**
|
|
386
|
+
* A text content item
|
|
387
|
+
*/
|
|
252
388
|
export interface TextContentItem {
|
|
253
389
|
/**
|
|
254
390
|
* Text content
|
|
@@ -262,6 +398,9 @@ export namespace InterleavedContentItem {
|
|
|
262
398
|
}
|
|
263
399
|
}
|
|
264
400
|
|
|
401
|
+
/**
|
|
402
|
+
* A message from the user in a chat conversation.
|
|
403
|
+
*/
|
|
265
404
|
export type Message = UserMessage | SystemMessage | ToolResponseMessage | CompletionMessage;
|
|
266
405
|
|
|
267
406
|
export type ParamType =
|
|
@@ -347,12 +486,21 @@ export namespace QueryGeneratorConfig {
|
|
|
347
486
|
}
|
|
348
487
|
|
|
349
488
|
export interface QueryResult {
|
|
489
|
+
/**
|
|
490
|
+
* A image content item
|
|
491
|
+
*/
|
|
350
492
|
content?: InterleavedContent;
|
|
351
493
|
}
|
|
352
494
|
|
|
495
|
+
/**
|
|
496
|
+
* Configuration for JSON schema-guided response generation.
|
|
497
|
+
*/
|
|
353
498
|
export type ResponseFormat = ResponseFormat.JsonSchemaResponseFormat | ResponseFormat.GrammarResponseFormat;
|
|
354
499
|
|
|
355
500
|
export namespace ResponseFormat {
|
|
501
|
+
/**
|
|
502
|
+
* Configuration for JSON schema-guided response generation.
|
|
503
|
+
*/
|
|
356
504
|
export interface JsonSchemaResponseFormat {
|
|
357
505
|
/**
|
|
358
506
|
* The JSON schema the response should conform to. In a Python SDK, this is often a
|
|
@@ -366,6 +514,9 @@ export namespace ResponseFormat {
|
|
|
366
514
|
type: 'json_schema';
|
|
367
515
|
}
|
|
368
516
|
|
|
517
|
+
/**
|
|
518
|
+
* Configuration for grammar-guided response generation.
|
|
519
|
+
*/
|
|
369
520
|
export interface GrammarResponseFormat {
|
|
370
521
|
/**
|
|
371
522
|
* The BNF grammar specification the response should conform to
|
|
@@ -438,6 +589,9 @@ export interface ScoringResult {
|
|
|
438
589
|
score_rows: Array<Record<string, boolean | number | string | Array<unknown> | unknown | null>>;
|
|
439
590
|
}
|
|
440
591
|
|
|
592
|
+
/**
|
|
593
|
+
* A system message providing instructions or context to the model.
|
|
594
|
+
*/
|
|
441
595
|
export interface SystemMessage {
|
|
442
596
|
/**
|
|
443
597
|
* The content of the "system prompt". If multiple system messages are provided,
|
|
@@ -468,6 +622,8 @@ export interface ToolCall {
|
|
|
468
622
|
tool_name: 'brave_search' | 'wolfram_alpha' | 'photogen' | 'code_interpreter' | (string & {});
|
|
469
623
|
}
|
|
470
624
|
|
|
625
|
+
export type ToolCallOrString = string | ToolCall;
|
|
626
|
+
|
|
471
627
|
export interface ToolParamDefinition {
|
|
472
628
|
param_type: string;
|
|
473
629
|
|
|
@@ -478,6 +634,9 @@ export interface ToolParamDefinition {
|
|
|
478
634
|
required?: boolean;
|
|
479
635
|
}
|
|
480
636
|
|
|
637
|
+
/**
|
|
638
|
+
* A message representing the result of a tool invocation.
|
|
639
|
+
*/
|
|
481
640
|
export interface ToolResponseMessage {
|
|
482
641
|
/**
|
|
483
642
|
* Unique identifier for the tool call this response is for
|
|
@@ -500,10 +659,9 @@ export interface ToolResponseMessage {
|
|
|
500
659
|
tool_name: 'brave_search' | 'wolfram_alpha' | 'photogen' | 'code_interpreter' | (string & {});
|
|
501
660
|
}
|
|
502
661
|
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
662
|
+
/**
|
|
663
|
+
* A message from the user in a chat conversation.
|
|
664
|
+
*/
|
|
507
665
|
export interface UserMessage {
|
|
508
666
|
/**
|
|
509
667
|
* The content of the message, which can include text and other media
|
package/src/resources/shields.ts
CHANGED
|
@@ -20,9 +20,12 @@ export class Shields extends APIResource {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export interface ListShieldsResponse {
|
|
23
|
-
data:
|
|
23
|
+
data: ShieldListResponse;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* A safety shield resource that can be used to check content
|
|
28
|
+
*/
|
|
26
29
|
export interface Shield {
|
|
27
30
|
identifier: string;
|
|
28
31
|
|
|
@@ -13,6 +13,10 @@ export class SyntheticDataGeneration extends APIResource {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Response from the synthetic data generation. Batch of (prompt, response, score)
|
|
18
|
+
* tuples that pass the threshold.
|
|
19
|
+
*/
|
|
16
20
|
export interface SyntheticDataGenerationResponse {
|
|
17
21
|
synthetic_data: Array<Record<string, boolean | number | string | Array<unknown> | unknown | null>>;
|
|
18
22
|
|
|
@@ -22,6 +26,9 @@ export interface SyntheticDataGenerationResponse {
|
|
|
22
26
|
export interface SyntheticDataGenerationGenerateParams {
|
|
23
27
|
dialogs: Array<Shared.Message>;
|
|
24
28
|
|
|
29
|
+
/**
|
|
30
|
+
* The type of filtering function.
|
|
31
|
+
*/
|
|
25
32
|
filtering_function: 'none' | 'random' | 'top_k' | 'top_p' | 'top_k_top_p' | 'sigmoid';
|
|
26
33
|
|
|
27
34
|
model?: string;
|
|
@@ -104,7 +104,7 @@ export namespace Event {
|
|
|
104
104
|
|
|
105
105
|
type: 'unstructured_log';
|
|
106
106
|
|
|
107
|
-
attributes?: Record<string,
|
|
107
|
+
attributes?: Record<string, string | number | boolean | null>;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
export interface MetricEvent {
|
|
@@ -122,7 +122,7 @@ export namespace Event {
|
|
|
122
122
|
|
|
123
123
|
value: number;
|
|
124
124
|
|
|
125
|
-
attributes?: Record<string,
|
|
125
|
+
attributes?: Record<string, string | number | boolean | null>;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
export interface StructuredLogEvent {
|
|
@@ -136,7 +136,7 @@ export namespace Event {
|
|
|
136
136
|
|
|
137
137
|
type: 'structured_log';
|
|
138
138
|
|
|
139
|
-
attributes?: Record<string,
|
|
139
|
+
attributes?: Record<string, string | number | boolean | null>;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
export namespace StructuredLogEvent {
|
|
@@ -165,25 +165,7 @@ export interface QueryCondition {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
export interface QuerySpansResponse {
|
|
168
|
-
data:
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export namespace QuerySpansResponse {
|
|
172
|
-
export interface Data {
|
|
173
|
-
name: string;
|
|
174
|
-
|
|
175
|
-
span_id: string;
|
|
176
|
-
|
|
177
|
-
start_time: string;
|
|
178
|
-
|
|
179
|
-
trace_id: string;
|
|
180
|
-
|
|
181
|
-
attributes?: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
|
|
182
|
-
|
|
183
|
-
end_time?: string;
|
|
184
|
-
|
|
185
|
-
parent_span_id?: string;
|
|
186
|
-
}
|
|
168
|
+
data: TelemetryQuerySpansResponse;
|
|
187
169
|
}
|
|
188
170
|
|
|
189
171
|
export interface SpanWithStatus {
|
|
@@ -69,6 +69,9 @@ export namespace ToolDef {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export interface ToolInvocationResult {
|
|
72
|
+
/**
|
|
73
|
+
* A image content item
|
|
74
|
+
*/
|
|
72
75
|
content: Shared.InterleavedContent;
|
|
73
76
|
|
|
74
77
|
error_code?: number;
|
|
@@ -83,11 +86,17 @@ export interface ToolRuntimeInvokeToolParams {
|
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
export interface ToolRuntimeListToolsParams {
|
|
86
|
-
mcp_endpoint?:
|
|
89
|
+
mcp_endpoint?: ToolRuntimeListToolsParams.McpEndpoint;
|
|
87
90
|
|
|
88
91
|
tool_group_id?: string;
|
|
89
92
|
}
|
|
90
93
|
|
|
94
|
+
export namespace ToolRuntimeListToolsParams {
|
|
95
|
+
export interface McpEndpoint {
|
|
96
|
+
uri: string;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
91
100
|
ToolRuntime.RagTool = RagTool;
|
|
92
101
|
|
|
93
102
|
export declare namespace ToolRuntime {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../resource';
|
|
4
4
|
import * as Core from '../core';
|
|
5
|
-
import * as Shared from './shared';
|
|
6
5
|
|
|
7
6
|
export class Toolgroups extends APIResource {
|
|
8
7
|
/**
|
|
@@ -41,7 +40,7 @@ export class Toolgroups extends APIResource {
|
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
export interface ListToolGroupsResponse {
|
|
44
|
-
data:
|
|
43
|
+
data: ToolgroupListResponse;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
export interface ToolGroup {
|
|
@@ -55,7 +54,13 @@ export interface ToolGroup {
|
|
|
55
54
|
|
|
56
55
|
args?: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
|
|
57
56
|
|
|
58
|
-
mcp_endpoint?:
|
|
57
|
+
mcp_endpoint?: ToolGroup.McpEndpoint;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export namespace ToolGroup {
|
|
61
|
+
export interface McpEndpoint {
|
|
62
|
+
uri: string;
|
|
63
|
+
}
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
export type ToolgroupListResponse = Array<ToolGroup>;
|
|
@@ -67,7 +72,13 @@ export interface ToolgroupRegisterParams {
|
|
|
67
72
|
|
|
68
73
|
args?: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
|
|
69
74
|
|
|
70
|
-
mcp_endpoint?:
|
|
75
|
+
mcp_endpoint?: ToolgroupRegisterParams.McpEndpoint;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export namespace ToolgroupRegisterParams {
|
|
79
|
+
export interface McpEndpoint {
|
|
80
|
+
uri: string;
|
|
81
|
+
}
|
|
71
82
|
}
|
|
72
83
|
|
|
73
84
|
export declare namespace Toolgroups {
|
package/src/resources/tools.ts
CHANGED
|
@@ -33,23 +33,7 @@ export class VectorDBs extends APIResource {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export interface ListVectorDBsResponse {
|
|
36
|
-
data:
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export namespace ListVectorDBsResponse {
|
|
40
|
-
export interface Data {
|
|
41
|
-
embedding_dimension: number;
|
|
42
|
-
|
|
43
|
-
embedding_model: string;
|
|
44
|
-
|
|
45
|
-
identifier: string;
|
|
46
|
-
|
|
47
|
-
provider_id: string;
|
|
48
|
-
|
|
49
|
-
provider_resource_id: string;
|
|
50
|
-
|
|
51
|
-
type: 'vector_db';
|
|
52
|
-
}
|
|
36
|
+
data: VectorDBListResponse;
|
|
53
37
|
}
|
|
54
38
|
|
|
55
39
|
export interface VectorDBRetrieveResponse {
|
|
@@ -26,6 +26,9 @@ export interface QueryChunksResponse {
|
|
|
26
26
|
|
|
27
27
|
export namespace QueryChunksResponse {
|
|
28
28
|
export interface Chunk {
|
|
29
|
+
/**
|
|
30
|
+
* A image content item
|
|
31
|
+
*/
|
|
29
32
|
content: Shared.InterleavedContent;
|
|
30
33
|
|
|
31
34
|
metadata: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
|
|
@@ -42,6 +45,9 @@ export interface VectorIoInsertParams {
|
|
|
42
45
|
|
|
43
46
|
export namespace VectorIoInsertParams {
|
|
44
47
|
export interface Chunk {
|
|
48
|
+
/**
|
|
49
|
+
* A image content item
|
|
50
|
+
*/
|
|
45
51
|
content: Shared.InterleavedContent;
|
|
46
52
|
|
|
47
53
|
metadata: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
|
|
@@ -49,6 +55,9 @@ export namespace VectorIoInsertParams {
|
|
|
49
55
|
}
|
|
50
56
|
|
|
51
57
|
export interface VectorIoQueryParams {
|
|
58
|
+
/**
|
|
59
|
+
* A image content item
|
|
60
|
+
*/
|
|
52
61
|
query: Shared.InterleavedContent;
|
|
53
62
|
|
|
54
63
|
vector_db_id: string;
|
package/src/streaming.ts
CHANGED
|
@@ -313,13 +313,17 @@ class SSEDecoder {
|
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
/** This is an internal helper function that's just used for testing */
|
|
316
|
-
export function _decodeChunks(chunks: string[]): string[] {
|
|
316
|
+
export function _decodeChunks(chunks: string[], { flush }: { flush: boolean } = { flush: false }): string[] {
|
|
317
317
|
const decoder = new LineDecoder();
|
|
318
318
|
const lines: string[] = [];
|
|
319
319
|
for (const chunk of chunks) {
|
|
320
320
|
lines.push(...decoder.decode(chunk));
|
|
321
321
|
}
|
|
322
322
|
|
|
323
|
+
if (flush) {
|
|
324
|
+
lines.push(...decoder.flush());
|
|
325
|
+
}
|
|
326
|
+
|
|
323
327
|
return lines;
|
|
324
328
|
}
|
|
325
329
|
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.1.
|
|
1
|
+
export const VERSION = '0.1.3';
|
package/streaming.d.ts
CHANGED
|
@@ -30,5 +30,7 @@ export declare class Stream<Item> implements AsyncIterable<Item> {
|
|
|
30
30
|
}
|
|
31
31
|
export declare function _iterSSEMessages(response: Response, controller: AbortController): AsyncGenerator<ServerSentEvent, void, unknown>;
|
|
32
32
|
/** This is an internal helper function that's just used for testing */
|
|
33
|
-
export declare function _decodeChunks(chunks: string[]
|
|
33
|
+
export declare function _decodeChunks(chunks: string[], { flush }?: {
|
|
34
|
+
flush: boolean;
|
|
35
|
+
}): string[];
|
|
34
36
|
//# sourceMappingURL=streaming.d.ts.map
|
package/streaming.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{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 -269,12 +269,15 @@ class SSEDecoder {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
/** This is an internal helper function that's just used for testing */
|
|
272
|
-
function _decodeChunks(chunks) {
|
|
272
|
+
function _decodeChunks(chunks, { flush } = { flush: false }) {
|
|
273
273
|
const decoder = new line_1.LineDecoder();
|
|
274
274
|
const lines = [];
|
|
275
275
|
for (const chunk of chunks) {
|
|
276
276
|
lines.push(...decoder.decode(chunk));
|
|
277
277
|
}
|
|
278
|
+
if (flush) {
|
|
279
|
+
lines.push(...decoder.flush());
|
|
280
|
+
}
|
|
278
281
|
return lines;
|
|
279
282
|
}
|
|
280
283
|
exports._decodeChunks = _decodeChunks;
|