llama-stack-client 0.1.0 → 0.1.2
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 +8 -1
- package/index.d.ts +8 -1
- package/index.d.ts.map +1 -1
- package/index.js +10 -1
- package/index.js.map +1 -1
- package/index.mjs +10 -1
- package/index.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 +30 -0
- 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/datasets.d.ts +1 -12
- package/resources/datasets.d.ts.map +1 -1
- package/resources/eval/eval.d.ts +3 -0
- package/resources/eval/eval.d.ts.map +1 -1
- package/resources/eval/eval.js.map +1 -1
- package/resources/eval/eval.mjs.map +1 -1
- package/resources/eval-tasks.d.ts +1 -1
- package/resources/eval-tasks.d.ts.map +1 -1
- package/resources/inference.d.ts +47 -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 +68 -0
- 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 +1 -12
- 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 +3 -0
- 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 +1 -1
- package/resources/toolgroups.d.ts.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 +23 -1
- package/src/resources/agents/agents.ts +9 -0
- package/src/resources/agents/session.ts +3 -0
- package/src/resources/agents/turn.ts +30 -0
- package/src/resources/batch-inference.ts +14 -0
- package/src/resources/datasets.ts +1 -19
- package/src/resources/eval/eval.ts +3 -0
- package/src/resources/eval-tasks.ts +1 -1
- package/src/resources/inference.ts +51 -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 +68 -0
- package/src/resources/shields.ts +4 -1
- package/src/resources/synthetic-data-generation.ts +7 -0
- package/src/resources/telemetry.ts +1 -19
- package/src/resources/tool-runtime/rag-tool.ts +3 -0
- package/src/resources/tool-runtime/tool-runtime.ts +3 -0
- package/src/resources/toolgroups.ts +1 -1
- 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/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/index.ts
CHANGED
|
@@ -159,6 +159,11 @@ import {
|
|
|
159
159
|
} from './resources/tool-runtime/tool-runtime';
|
|
160
160
|
|
|
161
161
|
export interface ClientOptions {
|
|
162
|
+
/**
|
|
163
|
+
* Defaults to process.env['LLAMA_STACK_CLIENT_API_KEY'].
|
|
164
|
+
*/
|
|
165
|
+
apiKey?: string | null | undefined;
|
|
166
|
+
|
|
162
167
|
/**
|
|
163
168
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
164
169
|
*
|
|
@@ -220,11 +225,14 @@ export interface ClientOptions {
|
|
|
220
225
|
* API Client for interfacing with the Llama Stack Client API.
|
|
221
226
|
*/
|
|
222
227
|
export class LlamaStackClient extends Core.APIClient {
|
|
228
|
+
apiKey: string | null;
|
|
229
|
+
|
|
223
230
|
private _options: ClientOptions;
|
|
224
231
|
|
|
225
232
|
/**
|
|
226
233
|
* API Client for interfacing with the Llama Stack Client API.
|
|
227
234
|
*
|
|
235
|
+
* @param {string | null | undefined} [opts.apiKey=process.env['LLAMA_STACK_CLIENT_API_KEY'] ?? null]
|
|
228
236
|
* @param {string} [opts.baseURL=process.env['LLAMA_STACK_CLIENT_BASE_URL'] ?? http://any-hosted-llama-stack.com] - Override the default base URL for the API.
|
|
229
237
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
230
238
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
@@ -233,8 +241,13 @@ export class LlamaStackClient extends Core.APIClient {
|
|
|
233
241
|
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
234
242
|
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
235
243
|
*/
|
|
236
|
-
constructor({
|
|
244
|
+
constructor({
|
|
245
|
+
baseURL = Core.readEnv('LLAMA_STACK_CLIENT_BASE_URL'),
|
|
246
|
+
apiKey = Core.readEnv('LLAMA_STACK_CLIENT_API_KEY') ?? null,
|
|
247
|
+
...opts
|
|
248
|
+
}: ClientOptions = {}) {
|
|
237
249
|
const options: ClientOptions = {
|
|
250
|
+
apiKey,
|
|
238
251
|
...opts,
|
|
239
252
|
baseURL: baseURL || `http://any-hosted-llama-stack.com`,
|
|
240
253
|
};
|
|
@@ -248,6 +261,8 @@ export class LlamaStackClient extends Core.APIClient {
|
|
|
248
261
|
});
|
|
249
262
|
|
|
250
263
|
this._options = options;
|
|
264
|
+
|
|
265
|
+
this.apiKey = apiKey;
|
|
251
266
|
}
|
|
252
267
|
|
|
253
268
|
toolgroups: API.Toolgroups = new API.Toolgroups(this);
|
|
@@ -285,6 +300,13 @@ export class LlamaStackClient extends Core.APIClient {
|
|
|
285
300
|
};
|
|
286
301
|
}
|
|
287
302
|
|
|
303
|
+
protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers {
|
|
304
|
+
if (this.apiKey == null) {
|
|
305
|
+
return {};
|
|
306
|
+
}
|
|
307
|
+
return { Authorization: `Bearer ${this.apiKey}` };
|
|
308
|
+
}
|
|
309
|
+
|
|
288
310
|
protected override stringifyQuery(query: Record<string, unknown>): string {
|
|
289
311
|
return qs.stringify(query, { arrayFormat: 'comma' });
|
|
290
312
|
}
|
|
@@ -43,6 +43,9 @@ export class Agents extends APIResource {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export interface InferenceStep {
|
|
46
|
+
/**
|
|
47
|
+
* A message containing the model's (assistant) response in a chat conversation.
|
|
48
|
+
*/
|
|
46
49
|
model_response: Shared.CompletionMessage;
|
|
47
50
|
|
|
48
51
|
step_id: string;
|
|
@@ -57,6 +60,9 @@ export interface InferenceStep {
|
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
export interface MemoryRetrievalStep {
|
|
63
|
+
/**
|
|
64
|
+
* A image content item
|
|
65
|
+
*/
|
|
60
66
|
inserted_context: Shared.InterleavedContent;
|
|
61
67
|
|
|
62
68
|
step_id: string;
|
|
@@ -105,6 +111,9 @@ export interface ToolExecutionStep {
|
|
|
105
111
|
export interface ToolResponse {
|
|
106
112
|
call_id: string;
|
|
107
113
|
|
|
114
|
+
/**
|
|
115
|
+
* A image content item
|
|
116
|
+
*/
|
|
108
117
|
content: Shared.InterleavedContent;
|
|
109
118
|
|
|
110
119
|
tool_name: 'brave_search' | 'wolfram_alpha' | 'photogen' | 'code_interpreter' | (string & {});
|
|
@@ -50,15 +50,24 @@ export class TurnResource extends APIResource {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
/**
|
|
54
|
+
* streamed agent turn completion response.
|
|
55
|
+
*/
|
|
53
56
|
export interface AgentTurnResponseStreamChunk {
|
|
54
57
|
event: TurnResponseEvent;
|
|
55
58
|
}
|
|
56
59
|
|
|
60
|
+
/**
|
|
61
|
+
* A single turn in an interaction with an Agentic System.
|
|
62
|
+
*/
|
|
57
63
|
export interface Turn {
|
|
58
64
|
input_messages: Array<Shared.UserMessage | Shared.ToolResponseMessage>;
|
|
59
65
|
|
|
60
66
|
output_attachments: Array<Turn.OutputAttachment>;
|
|
61
67
|
|
|
68
|
+
/**
|
|
69
|
+
* A message containing the model's (assistant) response in a chat conversation.
|
|
70
|
+
*/
|
|
62
71
|
output_message: Shared.CompletionMessage;
|
|
63
72
|
|
|
64
73
|
session_id: string;
|
|
@@ -79,6 +88,9 @@ export interface Turn {
|
|
|
79
88
|
|
|
80
89
|
export namespace Turn {
|
|
81
90
|
export interface OutputAttachment {
|
|
91
|
+
/**
|
|
92
|
+
* A image content item
|
|
93
|
+
*/
|
|
82
94
|
content:
|
|
83
95
|
| string
|
|
84
96
|
| OutputAttachment.ImageContentItem
|
|
@@ -90,6 +102,9 @@ export namespace Turn {
|
|
|
90
102
|
}
|
|
91
103
|
|
|
92
104
|
export namespace OutputAttachment {
|
|
105
|
+
/**
|
|
106
|
+
* A image content item
|
|
107
|
+
*/
|
|
93
108
|
export interface ImageContentItem {
|
|
94
109
|
/**
|
|
95
110
|
* Image as a base64 encoded string or an URL
|
|
@@ -120,6 +135,9 @@ export namespace Turn {
|
|
|
120
135
|
}
|
|
121
136
|
}
|
|
122
137
|
|
|
138
|
+
/**
|
|
139
|
+
* A text content item
|
|
140
|
+
*/
|
|
123
141
|
export interface TextContentItem {
|
|
124
142
|
/**
|
|
125
143
|
* Text content
|
|
@@ -189,6 +207,9 @@ export namespace TurnResponseEventPayload {
|
|
|
189
207
|
export interface AgentTurnResponseTurnCompletePayload {
|
|
190
208
|
event_type: 'turn_complete';
|
|
191
209
|
|
|
210
|
+
/**
|
|
211
|
+
* A single turn in an interaction with an Agentic System.
|
|
212
|
+
*/
|
|
192
213
|
turn: TurnAPI.Turn;
|
|
193
214
|
}
|
|
194
215
|
}
|
|
@@ -207,6 +228,9 @@ export interface TurnCreateParamsBase {
|
|
|
207
228
|
|
|
208
229
|
export namespace TurnCreateParams {
|
|
209
230
|
export interface Document {
|
|
231
|
+
/**
|
|
232
|
+
* A image content item
|
|
233
|
+
*/
|
|
210
234
|
content:
|
|
211
235
|
| string
|
|
212
236
|
| Document.ImageContentItem
|
|
@@ -218,6 +242,9 @@ export namespace TurnCreateParams {
|
|
|
218
242
|
}
|
|
219
243
|
|
|
220
244
|
export namespace Document {
|
|
245
|
+
/**
|
|
246
|
+
* A image content item
|
|
247
|
+
*/
|
|
221
248
|
export interface ImageContentItem {
|
|
222
249
|
/**
|
|
223
250
|
* Image as a base64 encoded string or an URL
|
|
@@ -248,6 +275,9 @@ export namespace TurnCreateParams {
|
|
|
248
275
|
}
|
|
249
276
|
}
|
|
250
277
|
|
|
278
|
+
/**
|
|
279
|
+
* A text content item
|
|
280
|
+
*/
|
|
251
281
|
export interface TextContentItem {
|
|
252
282
|
/**
|
|
253
283
|
* Text content
|
|
@@ -31,12 +31,23 @@ export interface BatchInferenceChatCompletionParams {
|
|
|
31
31
|
|
|
32
32
|
logprobs?: BatchInferenceChatCompletionParams.Logprobs;
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for JSON schema-guided response generation.
|
|
36
|
+
*/
|
|
34
37
|
response_format?: Shared.ResponseFormat;
|
|
35
38
|
|
|
36
39
|
sampling_params?: Shared.SamplingParams;
|
|
37
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Whether tool use is required or automatic. This is a hint to the model which may
|
|
43
|
+
* not be followed. It depends on the Instruction Following capabilities of the
|
|
44
|
+
* model.
|
|
45
|
+
*/
|
|
38
46
|
tool_choice?: 'auto' | 'required';
|
|
39
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Prompt format for calling custom / zero shot tools.
|
|
50
|
+
*/
|
|
40
51
|
tool_prompt_format?: 'json' | 'function_tag' | 'python_list';
|
|
41
52
|
|
|
42
53
|
tools?: Array<BatchInferenceChatCompletionParams.Tool>;
|
|
@@ -66,6 +77,9 @@ export interface BatchInferenceCompletionParams {
|
|
|
66
77
|
|
|
67
78
|
logprobs?: BatchInferenceCompletionParams.Logprobs;
|
|
68
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Configuration for JSON schema-guided response generation.
|
|
82
|
+
*/
|
|
69
83
|
response_format?: Shared.ResponseFormat;
|
|
70
84
|
|
|
71
85
|
sampling_params?: Shared.SamplingParams;
|
|
@@ -35,25 +35,7 @@ export class Datasets extends APIResource {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export interface ListDatasetsResponse {
|
|
38
|
-
data:
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export namespace ListDatasetsResponse {
|
|
42
|
-
export interface Data {
|
|
43
|
-
dataset_schema: Record<string, Shared.ParamType>;
|
|
44
|
-
|
|
45
|
-
identifier: string;
|
|
46
|
-
|
|
47
|
-
metadata: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
|
|
48
|
-
|
|
49
|
-
provider_id: string;
|
|
50
|
-
|
|
51
|
-
provider_resource_id: string;
|
|
52
|
-
|
|
53
|
-
type: 'dataset';
|
|
54
|
-
|
|
55
|
-
url: Shared.URL;
|
|
56
|
-
}
|
|
38
|
+
data: DatasetListResponse;
|
|
57
39
|
}
|
|
58
40
|
|
|
59
41
|
export interface DatasetRetrieveResponse {
|
|
@@ -71,6 +71,9 @@ export class Inference extends APIResource {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* A chunk of a streamed chat completion response.
|
|
76
|
+
*/
|
|
74
77
|
export interface ChatCompletionResponseStreamChunk {
|
|
75
78
|
/**
|
|
76
79
|
* The event containing the new content
|
|
@@ -106,6 +109,9 @@ export namespace ChatCompletionResponseStreamChunk {
|
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Response from a completion request.
|
|
114
|
+
*/
|
|
109
115
|
export interface CompletionResponse {
|
|
110
116
|
/**
|
|
111
117
|
* The generated completion text
|
|
@@ -123,6 +129,9 @@ export interface CompletionResponse {
|
|
|
123
129
|
logprobs?: Array<TokenLogProbs>;
|
|
124
130
|
}
|
|
125
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Response containing generated embeddings.
|
|
134
|
+
*/
|
|
126
135
|
export interface EmbeddingsResponse {
|
|
127
136
|
/**
|
|
128
137
|
* List of embedding vectors, one per input content. Each embedding is a list of
|
|
@@ -132,6 +141,9 @@ export interface EmbeddingsResponse {
|
|
|
132
141
|
embeddings: Array<Array<number>>;
|
|
133
142
|
}
|
|
134
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Log probabilities for generated tokens.
|
|
146
|
+
*/
|
|
135
147
|
export interface TokenLogProbs {
|
|
136
148
|
/**
|
|
137
149
|
* Dictionary mapping tokens to their log probabilities
|
|
@@ -182,17 +194,23 @@ export interface InferenceChatCompletionParamsBase {
|
|
|
182
194
|
|
|
183
195
|
/**
|
|
184
196
|
* (Optional) Whether tool use is required or automatic. Defaults to
|
|
185
|
-
* ToolChoice.auto.
|
|
197
|
+
* ToolChoice.auto. .. deprecated:: Use tool_config instead.
|
|
186
198
|
*/
|
|
187
199
|
tool_choice?: 'auto' | 'required';
|
|
188
200
|
|
|
201
|
+
/**
|
|
202
|
+
* (Optional) Configuration for tool use.
|
|
203
|
+
*/
|
|
204
|
+
tool_config?: InferenceChatCompletionParams.ToolConfig;
|
|
205
|
+
|
|
189
206
|
/**
|
|
190
207
|
* (Optional) Instructs the model how to format tool calls. By default, Llama Stack
|
|
191
208
|
* will attempt to use a format that is best adapted to the model. -
|
|
192
209
|
* `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. -
|
|
193
210
|
* `ToolPromptFormat.function_tag`: The tool calls are enclosed in a
|
|
194
211
|
* <function=function_name> tag. - `ToolPromptFormat.python_list`: The tool calls
|
|
195
|
-
* are output as Python syntax -- a list of function calls.
|
|
212
|
+
* are output as Python syntax -- a list of function calls. .. deprecated:: Use
|
|
213
|
+
* tool_config instead.
|
|
196
214
|
*/
|
|
197
215
|
tool_prompt_format?: 'json' | 'function_tag' | 'python_list';
|
|
198
216
|
|
|
@@ -214,6 +232,37 @@ export namespace InferenceChatCompletionParams {
|
|
|
214
232
|
top_k?: number;
|
|
215
233
|
}
|
|
216
234
|
|
|
235
|
+
/**
|
|
236
|
+
* (Optional) Configuration for tool use.
|
|
237
|
+
*/
|
|
238
|
+
export interface ToolConfig {
|
|
239
|
+
/**
|
|
240
|
+
* (Optional) Config for how to override the default system prompt. -
|
|
241
|
+
* `SystemMessageBehavior.append`: Appends the provided system message to the
|
|
242
|
+
* default system prompt. - `SystemMessageBehavior.replace`: Replaces the default
|
|
243
|
+
* system prompt with the provided system message. The system message can include
|
|
244
|
+
* the string '{{function_definitions}}' to indicate where the function definitions
|
|
245
|
+
* should be inserted.
|
|
246
|
+
*/
|
|
247
|
+
system_message_behavior: 'append' | 'replace';
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* (Optional) Whether tool use is required or automatic. Defaults to
|
|
251
|
+
* ToolChoice.auto.
|
|
252
|
+
*/
|
|
253
|
+
tool_choice?: 'auto' | 'required';
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* (Optional) Instructs the model how to format tool calls. By default, Llama Stack
|
|
257
|
+
* will attempt to use a format that is best adapted to the model. -
|
|
258
|
+
* `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. -
|
|
259
|
+
* `ToolPromptFormat.function_tag`: The tool calls are enclosed in a
|
|
260
|
+
* <function=function_name> tag. - `ToolPromptFormat.python_list`: The tool calls
|
|
261
|
+
* are output as Python syntax -- a list of function calls.
|
|
262
|
+
*/
|
|
263
|
+
tool_prompt_format?: 'json' | 'function_tag' | 'python_list';
|
|
264
|
+
}
|
|
265
|
+
|
|
217
266
|
export interface Tool {
|
|
218
267
|
tool_name: 'brave_search' | 'wolfram_alpha' | 'photogen' | 'code_interpreter' | (string & {});
|
|
219
268
|
|
package/src/resources/models.ts
CHANGED
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
4
|
import * as Core from '../../core';
|
|
5
|
+
import { ListPostTrainingJobsResponse } from './post-training';
|
|
6
|
+
import * as PostTrainingAPI from './post-training';
|
|
5
7
|
|
|
6
8
|
export class Job extends APIResource {
|
|
7
|
-
list(
|
|
9
|
+
list(
|
|
10
|
+
options?: Core.RequestOptions,
|
|
11
|
+
): Core.APIPromise<Array<PostTrainingAPI.ListPostTrainingJobsResponse.Data>> {
|
|
8
12
|
return (
|
|
9
|
-
this._client.get('/v1/post-training/jobs', options) as Core.APIPromise<{
|
|
13
|
+
this._client.get('/v1/post-training/jobs', options) as Core.APIPromise<{
|
|
14
|
+
data: Array<PostTrainingAPI.ListPostTrainingJobsResponse.Data>;
|
|
15
|
+
}>
|
|
10
16
|
)._thenUnwrap((obj) => obj.data);
|
|
11
17
|
}
|
|
12
18
|
|
|
@@ -38,12 +44,18 @@ export namespace JobListResponse {
|
|
|
38
44
|
}
|
|
39
45
|
}
|
|
40
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Artifacts of a finetuning job.
|
|
49
|
+
*/
|
|
41
50
|
export interface JobArtifactsResponse {
|
|
42
51
|
checkpoints: Array<unknown>;
|
|
43
52
|
|
|
44
53
|
job_uuid: string;
|
|
45
54
|
}
|
|
46
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Status of a finetuning job.
|
|
58
|
+
*/
|
|
47
59
|
export interface JobStatusResponse {
|
|
48
60
|
checkpoints: Array<unknown>;
|
|
49
61
|
|
package/src/resources/routes.ts
CHANGED
package/src/resources/shared.ts
CHANGED
|
@@ -19,12 +19,23 @@ export interface AgentConfig {
|
|
|
19
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
|
+
* Prompt format for calling custom / zero shot tools.
|
|
38
|
+
*/
|
|
28
39
|
tool_prompt_format?: 'json' | 'function_tag' | 'python_list';
|
|
29
40
|
|
|
30
41
|
toolgroups?: Array<string | AgentConfig.UnionMember1>;
|
|
@@ -42,6 +53,9 @@ export interface BatchCompletion {
|
|
|
42
53
|
batch: Array<InferenceAPI.CompletionResponse>;
|
|
43
54
|
}
|
|
44
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Response from a chat completion request.
|
|
58
|
+
*/
|
|
45
59
|
export interface ChatCompletionResponse {
|
|
46
60
|
/**
|
|
47
61
|
* The complete response message
|
|
@@ -54,6 +68,9 @@ export interface ChatCompletionResponse {
|
|
|
54
68
|
logprobs?: Array<InferenceAPI.TokenLogProbs>;
|
|
55
69
|
}
|
|
56
70
|
|
|
71
|
+
/**
|
|
72
|
+
* A message containing the model's (assistant) response in a chat conversation.
|
|
73
|
+
*/
|
|
57
74
|
export interface CompletionMessage {
|
|
58
75
|
/**
|
|
59
76
|
* The content of the model's response
|
|
@@ -106,6 +123,9 @@ export namespace ContentDelta {
|
|
|
106
123
|
}
|
|
107
124
|
|
|
108
125
|
export interface Document {
|
|
126
|
+
/**
|
|
127
|
+
* A image content item
|
|
128
|
+
*/
|
|
109
129
|
content:
|
|
110
130
|
| string
|
|
111
131
|
| Document.ImageContentItem
|
|
@@ -121,6 +141,9 @@ export interface Document {
|
|
|
121
141
|
}
|
|
122
142
|
|
|
123
143
|
export namespace Document {
|
|
144
|
+
/**
|
|
145
|
+
* A image content item
|
|
146
|
+
*/
|
|
124
147
|
export interface ImageContentItem {
|
|
125
148
|
/**
|
|
126
149
|
* Image as a base64 encoded string or an URL
|
|
@@ -151,6 +174,9 @@ export namespace Document {
|
|
|
151
174
|
}
|
|
152
175
|
}
|
|
153
176
|
|
|
177
|
+
/**
|
|
178
|
+
* A text content item
|
|
179
|
+
*/
|
|
154
180
|
export interface TextContentItem {
|
|
155
181
|
/**
|
|
156
182
|
* Text content
|
|
@@ -164,6 +190,9 @@ export namespace Document {
|
|
|
164
190
|
}
|
|
165
191
|
}
|
|
166
192
|
|
|
193
|
+
/**
|
|
194
|
+
* A image content item
|
|
195
|
+
*/
|
|
167
196
|
export type InterleavedContent =
|
|
168
197
|
| string
|
|
169
198
|
| InterleavedContent.ImageContentItem
|
|
@@ -171,6 +200,9 @@ export type InterleavedContent =
|
|
|
171
200
|
| Array<InterleavedContentItem>;
|
|
172
201
|
|
|
173
202
|
export namespace InterleavedContent {
|
|
203
|
+
/**
|
|
204
|
+
* A image content item
|
|
205
|
+
*/
|
|
174
206
|
export interface ImageContentItem {
|
|
175
207
|
/**
|
|
176
208
|
* Image as a base64 encoded string or an URL
|
|
@@ -201,6 +233,9 @@ export namespace InterleavedContent {
|
|
|
201
233
|
}
|
|
202
234
|
}
|
|
203
235
|
|
|
236
|
+
/**
|
|
237
|
+
* A text content item
|
|
238
|
+
*/
|
|
204
239
|
export interface TextContentItem {
|
|
205
240
|
/**
|
|
206
241
|
* Text content
|
|
@@ -214,11 +249,17 @@ export namespace InterleavedContent {
|
|
|
214
249
|
}
|
|
215
250
|
}
|
|
216
251
|
|
|
252
|
+
/**
|
|
253
|
+
* A image content item
|
|
254
|
+
*/
|
|
217
255
|
export type InterleavedContentItem =
|
|
218
256
|
| InterleavedContentItem.ImageContentItem
|
|
219
257
|
| InterleavedContentItem.TextContentItem;
|
|
220
258
|
|
|
221
259
|
export namespace InterleavedContentItem {
|
|
260
|
+
/**
|
|
261
|
+
* A image content item
|
|
262
|
+
*/
|
|
222
263
|
export interface ImageContentItem {
|
|
223
264
|
/**
|
|
224
265
|
* Image as a base64 encoded string or an URL
|
|
@@ -249,6 +290,9 @@ export namespace InterleavedContentItem {
|
|
|
249
290
|
}
|
|
250
291
|
}
|
|
251
292
|
|
|
293
|
+
/**
|
|
294
|
+
* A text content item
|
|
295
|
+
*/
|
|
252
296
|
export interface TextContentItem {
|
|
253
297
|
/**
|
|
254
298
|
* Text content
|
|
@@ -262,6 +306,9 @@ export namespace InterleavedContentItem {
|
|
|
262
306
|
}
|
|
263
307
|
}
|
|
264
308
|
|
|
309
|
+
/**
|
|
310
|
+
* A message from the user in a chat conversation.
|
|
311
|
+
*/
|
|
265
312
|
export type Message = UserMessage | SystemMessage | ToolResponseMessage | CompletionMessage;
|
|
266
313
|
|
|
267
314
|
export type ParamType =
|
|
@@ -347,12 +394,21 @@ export namespace QueryGeneratorConfig {
|
|
|
347
394
|
}
|
|
348
395
|
|
|
349
396
|
export interface QueryResult {
|
|
397
|
+
/**
|
|
398
|
+
* A image content item
|
|
399
|
+
*/
|
|
350
400
|
content?: InterleavedContent;
|
|
351
401
|
}
|
|
352
402
|
|
|
403
|
+
/**
|
|
404
|
+
* Configuration for JSON schema-guided response generation.
|
|
405
|
+
*/
|
|
353
406
|
export type ResponseFormat = ResponseFormat.JsonSchemaResponseFormat | ResponseFormat.GrammarResponseFormat;
|
|
354
407
|
|
|
355
408
|
export namespace ResponseFormat {
|
|
409
|
+
/**
|
|
410
|
+
* Configuration for JSON schema-guided response generation.
|
|
411
|
+
*/
|
|
356
412
|
export interface JsonSchemaResponseFormat {
|
|
357
413
|
/**
|
|
358
414
|
* The JSON schema the response should conform to. In a Python SDK, this is often a
|
|
@@ -366,6 +422,9 @@ export namespace ResponseFormat {
|
|
|
366
422
|
type: 'json_schema';
|
|
367
423
|
}
|
|
368
424
|
|
|
425
|
+
/**
|
|
426
|
+
* Configuration for grammar-guided response generation.
|
|
427
|
+
*/
|
|
369
428
|
export interface GrammarResponseFormat {
|
|
370
429
|
/**
|
|
371
430
|
* The BNF grammar specification the response should conform to
|
|
@@ -438,6 +497,9 @@ export interface ScoringResult {
|
|
|
438
497
|
score_rows: Array<Record<string, boolean | number | string | Array<unknown> | unknown | null>>;
|
|
439
498
|
}
|
|
440
499
|
|
|
500
|
+
/**
|
|
501
|
+
* A system message providing instructions or context to the model.
|
|
502
|
+
*/
|
|
441
503
|
export interface SystemMessage {
|
|
442
504
|
/**
|
|
443
505
|
* The content of the "system prompt". If multiple system messages are provided,
|
|
@@ -478,6 +540,9 @@ export interface ToolParamDefinition {
|
|
|
478
540
|
required?: boolean;
|
|
479
541
|
}
|
|
480
542
|
|
|
543
|
+
/**
|
|
544
|
+
* A message representing the result of a tool invocation.
|
|
545
|
+
*/
|
|
481
546
|
export interface ToolResponseMessage {
|
|
482
547
|
/**
|
|
483
548
|
* Unique identifier for the tool call this response is for
|
|
@@ -504,6 +569,9 @@ export interface URL {
|
|
|
504
569
|
uri: string;
|
|
505
570
|
}
|
|
506
571
|
|
|
572
|
+
/**
|
|
573
|
+
* A message from the user in a chat conversation.
|
|
574
|
+
*/
|
|
507
575
|
export interface UserMessage {
|
|
508
576
|
/**
|
|
509
577
|
* 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;
|