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
|
@@ -7,17 +7,7 @@ export declare class VectorDBs extends APIResource {
|
|
|
7
7
|
unregister(vectorDBId: string, options?: Core.RequestOptions): Core.APIPromise<void>;
|
|
8
8
|
}
|
|
9
9
|
export interface ListVectorDBsResponse {
|
|
10
|
-
data:
|
|
11
|
-
}
|
|
12
|
-
export declare namespace ListVectorDBsResponse {
|
|
13
|
-
interface Data {
|
|
14
|
-
embedding_dimension: number;
|
|
15
|
-
embedding_model: string;
|
|
16
|
-
identifier: string;
|
|
17
|
-
provider_id: string;
|
|
18
|
-
provider_resource_id: string;
|
|
19
|
-
type: 'vector_db';
|
|
20
|
-
}
|
|
10
|
+
data: VectorDBListResponse;
|
|
21
11
|
}
|
|
22
12
|
export interface VectorDBRetrieveResponse {
|
|
23
13
|
embedding_dimension: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-dbs.d.ts","sourceRoot":"","sources":["../src/resources/vector-dbs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAEhC,qBAAa,SAAU,SAAQ,WAAW;IACxC,QAAQ,CACN,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,wBAAwB,GAAG,IAAI,CAAC;IAInD,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC;IAM1E,QAAQ,CACN,IAAI,EAAE,sBAAsB,EAC5B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,wBAAwB,CAAC;IAI5C,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;CAMrF;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,
|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MAAM,CAAC;QAEpB,oBAAoB,EAAE,MAAM,CAAC;QAE7B,IAAI,EAAE,WAAW,CAAC;KACnB;CACF;AAED,MAAM,WAAW,wBAAwB;IACvC,mBAAmB,EAAE,MAAM,CAAC;IAE5B,eAAe,EAAE,MAAM,CAAC;IAExB,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,MAAM,CAAC;IAEpB,oBAAoB,EAAE,MAAM,CAAC;IAE7B,IAAI,EAAE,WAAW,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAC;IAExB,YAAY,EAAE,MAAM,CAAC;IAErB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
|
package/resources/vector-io.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ export interface QueryChunksResponse {
|
|
|
11
11
|
}
|
|
12
12
|
export declare namespace QueryChunksResponse {
|
|
13
13
|
interface Chunk {
|
|
14
|
+
/**
|
|
15
|
+
* A image content item
|
|
16
|
+
*/
|
|
14
17
|
content: Shared.InterleavedContent;
|
|
15
18
|
metadata: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
|
|
16
19
|
}
|
|
@@ -22,11 +25,17 @@ export interface VectorIoInsertParams {
|
|
|
22
25
|
}
|
|
23
26
|
export declare namespace VectorIoInsertParams {
|
|
24
27
|
interface Chunk {
|
|
28
|
+
/**
|
|
29
|
+
* A image content item
|
|
30
|
+
*/
|
|
25
31
|
content: Shared.InterleavedContent;
|
|
26
32
|
metadata: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
export interface VectorIoQueryParams {
|
|
36
|
+
/**
|
|
37
|
+
* A image content item
|
|
38
|
+
*/
|
|
30
39
|
query: Shared.InterleavedContent;
|
|
31
40
|
vector_db_id: string;
|
|
32
41
|
params?: Record<string, boolean | number | string | Array<unknown> | unknown | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-io.d.ts","sourceRoot":"","sources":["../src/resources/vector-io.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,qBAAa,QAAS,SAAQ,WAAW;IACvC,MAAM,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAQxF,KAAK,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;CAGtG;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAEzC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACvB;AAED,yBAAiB,mBAAmB,CAAC;IACnC,UAAiB,KAAK;QACpB,OAAO,EAAE,MAAM,CAAC,kBAAkB,CAAC;QAEnC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;KACvF;CACF;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,K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C/C,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/src/core.ts
CHANGED
|
@@ -294,6 +294,7 @@ export abstract class APIClient {
|
|
|
294
294
|
options: FinalRequestOptions<Req>,
|
|
295
295
|
{ retryCount = 0 }: { retryCount?: number } = {},
|
|
296
296
|
): { req: RequestInit; url: string; timeout: number } {
|
|
297
|
+
options = { ...options };
|
|
297
298
|
const { method, path, query, headers: headers = {} } = options;
|
|
298
299
|
|
|
299
300
|
const body =
|
|
@@ -306,9 +307,9 @@ export abstract class APIClient {
|
|
|
306
307
|
|
|
307
308
|
const url = this.buildURL(path!, query);
|
|
308
309
|
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
|
|
309
|
-
|
|
310
|
+
options.timeout = options.timeout ?? this.timeout;
|
|
310
311
|
const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url);
|
|
311
|
-
const minAgentTimeout = timeout + 1000;
|
|
312
|
+
const minAgentTimeout = options.timeout + 1000;
|
|
312
313
|
if (
|
|
313
314
|
typeof (httpAgent as any)?.options?.timeout === 'number' &&
|
|
314
315
|
minAgentTimeout > ((httpAgent as any).options.timeout ?? 0)
|
|
@@ -337,7 +338,7 @@ export abstract class APIClient {
|
|
|
337
338
|
signal: options.signal ?? null,
|
|
338
339
|
};
|
|
339
340
|
|
|
340
|
-
return { req, url, timeout };
|
|
341
|
+
return { req, url, timeout: options.timeout };
|
|
341
342
|
}
|
|
342
343
|
|
|
343
344
|
private buildHeaders({
|
|
@@ -365,15 +366,22 @@ export abstract class APIClient {
|
|
|
365
366
|
delete reqHeaders['content-type'];
|
|
366
367
|
}
|
|
367
368
|
|
|
368
|
-
// Don't set
|
|
369
|
-
//
|
|
370
|
-
//
|
|
369
|
+
// Don't set theses headers if they were already set or removed through default headers or by the caller.
|
|
370
|
+
// We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to account
|
|
371
|
+
// for the removal case.
|
|
371
372
|
if (
|
|
372
373
|
getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined &&
|
|
373
374
|
getHeader(headers, 'x-stainless-retry-count') === undefined
|
|
374
375
|
) {
|
|
375
376
|
reqHeaders['x-stainless-retry-count'] = String(retryCount);
|
|
376
377
|
}
|
|
378
|
+
if (
|
|
379
|
+
getHeader(defaultHeaders, 'x-stainless-timeout') === undefined &&
|
|
380
|
+
getHeader(headers, 'x-stainless-timeout') === undefined &&
|
|
381
|
+
options.timeout
|
|
382
|
+
) {
|
|
383
|
+
reqHeaders['x-stainless-timeout'] = String(options.timeout);
|
|
384
|
+
}
|
|
377
385
|
|
|
378
386
|
this.validateHeaders(reqHeaders, headers);
|
|
379
387
|
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,13 @@ import {
|
|
|
12
12
|
BatchInferenceChatCompletionResponse,
|
|
13
13
|
BatchInferenceCompletionParams,
|
|
14
14
|
} from './resources/batch-inference';
|
|
15
|
+
import {
|
|
16
|
+
Benchmark,
|
|
17
|
+
BenchmarkListResponse,
|
|
18
|
+
BenchmarkRegisterParams,
|
|
19
|
+
Benchmarks,
|
|
20
|
+
ListBenchmarksResponse,
|
|
21
|
+
} from './resources/benchmarks';
|
|
15
22
|
import {
|
|
16
23
|
Datasetio,
|
|
17
24
|
DatasetioAppendRowsParams,
|
|
@@ -25,13 +32,7 @@ import {
|
|
|
25
32
|
Datasets,
|
|
26
33
|
ListDatasetsResponse,
|
|
27
34
|
} from './resources/datasets';
|
|
28
|
-
import {
|
|
29
|
-
EvalTask,
|
|
30
|
-
EvalTaskListResponse,
|
|
31
|
-
EvalTaskRegisterParams,
|
|
32
|
-
EvalTasks,
|
|
33
|
-
ListEvalTasksResponse,
|
|
34
|
-
} from './resources/eval-tasks';
|
|
35
|
+
import { EvalTaskListResponse, EvalTaskRegisterParams, EvalTasks } from './resources/eval-tasks';
|
|
35
36
|
import {
|
|
36
37
|
ChatCompletionResponseStreamChunk,
|
|
37
38
|
CompletionResponse,
|
|
@@ -134,11 +135,13 @@ import {
|
|
|
134
135
|
ToolResponse,
|
|
135
136
|
} from './resources/agents/agents';
|
|
136
137
|
import {
|
|
138
|
+
BenchmarkConfig,
|
|
137
139
|
Eval,
|
|
138
140
|
EvalCandidate,
|
|
141
|
+
EvalEvaluateRowsAlphaParams,
|
|
139
142
|
EvalEvaluateRowsParams,
|
|
143
|
+
EvalRunEvalAlphaParams,
|
|
140
144
|
EvalRunEvalParams,
|
|
141
|
-
EvalTaskConfig,
|
|
142
145
|
EvaluateResponse,
|
|
143
146
|
Job,
|
|
144
147
|
} from './resources/eval/eval';
|
|
@@ -159,6 +162,11 @@ import {
|
|
|
159
162
|
} from './resources/tool-runtime/tool-runtime';
|
|
160
163
|
|
|
161
164
|
export interface ClientOptions {
|
|
165
|
+
/**
|
|
166
|
+
* Defaults to process.env['LLAMA_STACK_CLIENT_API_KEY'].
|
|
167
|
+
*/
|
|
168
|
+
apiKey?: string | null | undefined;
|
|
169
|
+
|
|
162
170
|
/**
|
|
163
171
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
164
172
|
*
|
|
@@ -220,11 +228,14 @@ export interface ClientOptions {
|
|
|
220
228
|
* API Client for interfacing with the Llama Stack Client API.
|
|
221
229
|
*/
|
|
222
230
|
export class LlamaStackClient extends Core.APIClient {
|
|
231
|
+
apiKey: string | null;
|
|
232
|
+
|
|
223
233
|
private _options: ClientOptions;
|
|
224
234
|
|
|
225
235
|
/**
|
|
226
236
|
* API Client for interfacing with the Llama Stack Client API.
|
|
227
237
|
*
|
|
238
|
+
* @param {string | null | undefined} [opts.apiKey=process.env['LLAMA_STACK_CLIENT_API_KEY'] ?? null]
|
|
228
239
|
* @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
240
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
230
241
|
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
@@ -233,8 +244,13 @@ export class LlamaStackClient extends Core.APIClient {
|
|
|
233
244
|
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
234
245
|
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
235
246
|
*/
|
|
236
|
-
constructor({
|
|
247
|
+
constructor({
|
|
248
|
+
baseURL = Core.readEnv('LLAMA_STACK_CLIENT_BASE_URL'),
|
|
249
|
+
apiKey = Core.readEnv('LLAMA_STACK_CLIENT_API_KEY') ?? null,
|
|
250
|
+
...opts
|
|
251
|
+
}: ClientOptions = {}) {
|
|
237
252
|
const options: ClientOptions = {
|
|
253
|
+
apiKey,
|
|
238
254
|
...opts,
|
|
239
255
|
baseURL: baseURL || `http://any-hosted-llama-stack.com`,
|
|
240
256
|
};
|
|
@@ -248,6 +264,8 @@ export class LlamaStackClient extends Core.APIClient {
|
|
|
248
264
|
});
|
|
249
265
|
|
|
250
266
|
this._options = options;
|
|
267
|
+
|
|
268
|
+
this.apiKey = apiKey;
|
|
251
269
|
}
|
|
252
270
|
|
|
253
271
|
toolgroups: API.Toolgroups = new API.Toolgroups(this);
|
|
@@ -273,6 +291,7 @@ export class LlamaStackClient extends Core.APIClient {
|
|
|
273
291
|
scoring: API.Scoring = new API.Scoring(this);
|
|
274
292
|
scoringFunctions: API.ScoringFunctions = new API.ScoringFunctions(this);
|
|
275
293
|
evalTasks: API.EvalTasks = new API.EvalTasks(this);
|
|
294
|
+
benchmarks: API.Benchmarks = new API.Benchmarks(this);
|
|
276
295
|
|
|
277
296
|
protected override defaultQuery(): Core.DefaultQuery | undefined {
|
|
278
297
|
return this._options.defaultQuery;
|
|
@@ -285,6 +304,13 @@ export class LlamaStackClient extends Core.APIClient {
|
|
|
285
304
|
};
|
|
286
305
|
}
|
|
287
306
|
|
|
307
|
+
protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers {
|
|
308
|
+
if (this.apiKey == null) {
|
|
309
|
+
return {};
|
|
310
|
+
}
|
|
311
|
+
return { Authorization: `Bearer ${this.apiKey}` };
|
|
312
|
+
}
|
|
313
|
+
|
|
288
314
|
protected override stringifyQuery(query: Record<string, unknown>): string {
|
|
289
315
|
return qs.stringify(query, { arrayFormat: 'comma' });
|
|
290
316
|
}
|
|
@@ -333,6 +359,7 @@ LlamaStackClient.Datasetio = Datasetio;
|
|
|
333
359
|
LlamaStackClient.Scoring = Scoring;
|
|
334
360
|
LlamaStackClient.ScoringFunctions = ScoringFunctions;
|
|
335
361
|
LlamaStackClient.EvalTasks = EvalTasks;
|
|
362
|
+
LlamaStackClient.Benchmarks = Benchmarks;
|
|
336
363
|
export declare namespace LlamaStackClient {
|
|
337
364
|
export type RequestOptions = Core.RequestOptions;
|
|
338
365
|
|
|
@@ -388,12 +415,14 @@ export declare namespace LlamaStackClient {
|
|
|
388
415
|
|
|
389
416
|
export {
|
|
390
417
|
Eval as Eval,
|
|
418
|
+
type BenchmarkConfig as BenchmarkConfig,
|
|
391
419
|
type EvalCandidate as EvalCandidate,
|
|
392
|
-
type EvalTaskConfig as EvalTaskConfig,
|
|
393
420
|
type EvaluateResponse as EvaluateResponse,
|
|
394
421
|
type Job as Job,
|
|
395
422
|
type EvalEvaluateRowsParams as EvalEvaluateRowsParams,
|
|
423
|
+
type EvalEvaluateRowsAlphaParams as EvalEvaluateRowsAlphaParams,
|
|
396
424
|
type EvalRunEvalParams as EvalRunEvalParams,
|
|
425
|
+
type EvalRunEvalAlphaParams as EvalRunEvalAlphaParams,
|
|
397
426
|
};
|
|
398
427
|
|
|
399
428
|
export {
|
|
@@ -528,12 +557,18 @@ export declare namespace LlamaStackClient {
|
|
|
528
557
|
|
|
529
558
|
export {
|
|
530
559
|
EvalTasks as EvalTasks,
|
|
531
|
-
type EvalTask as EvalTask,
|
|
532
|
-
type ListEvalTasksResponse as ListEvalTasksResponse,
|
|
533
560
|
type EvalTaskListResponse as EvalTaskListResponse,
|
|
534
561
|
type EvalTaskRegisterParams as EvalTaskRegisterParams,
|
|
535
562
|
};
|
|
536
563
|
|
|
564
|
+
export {
|
|
565
|
+
Benchmarks as Benchmarks,
|
|
566
|
+
type Benchmark as Benchmark,
|
|
567
|
+
type ListBenchmarksResponse as ListBenchmarksResponse,
|
|
568
|
+
type BenchmarkListResponse as BenchmarkListResponse,
|
|
569
|
+
type BenchmarkRegisterParams as BenchmarkRegisterParams,
|
|
570
|
+
};
|
|
571
|
+
|
|
537
572
|
export type AgentConfig = API.AgentConfig;
|
|
538
573
|
export type BatchCompletion = API.BatchCompletion;
|
|
539
574
|
export type ChatCompletionResponse = API.ChatCompletionResponse;
|
|
@@ -554,9 +589,9 @@ export declare namespace LlamaStackClient {
|
|
|
554
589
|
export type ScoringResult = API.ScoringResult;
|
|
555
590
|
export type SystemMessage = API.SystemMessage;
|
|
556
591
|
export type ToolCall = API.ToolCall;
|
|
592
|
+
export type ToolCallOrString = API.ToolCallOrString;
|
|
557
593
|
export type ToolParamDefinition = API.ToolParamDefinition;
|
|
558
594
|
export type ToolResponseMessage = API.ToolResponseMessage;
|
|
559
|
-
export type URL = API.URL;
|
|
560
595
|
export type UserMessage = API.UserMessage;
|
|
561
596
|
}
|
|
562
597
|
|
|
@@ -13,52 +13,58 @@ export class LineDecoder {
|
|
|
13
13
|
static NEWLINE_CHARS = new Set(['\n', '\r']);
|
|
14
14
|
static NEWLINE_REGEXP = /\r\n|[\n\r]/g;
|
|
15
15
|
|
|
16
|
-
buffer:
|
|
17
|
-
|
|
16
|
+
buffer: Uint8Array;
|
|
17
|
+
#carriageReturnIndex: number | null;
|
|
18
18
|
textDecoder: any; // TextDecoder found in browsers; not typed to avoid pulling in either "dom" or "node" types.
|
|
19
19
|
|
|
20
20
|
constructor() {
|
|
21
|
-
this.buffer =
|
|
22
|
-
this
|
|
21
|
+
this.buffer = new Uint8Array();
|
|
22
|
+
this.#carriageReturnIndex = null;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
decode(chunk: Bytes): string[] {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (this.trailingCR) {
|
|
29
|
-
text = '\r' + text;
|
|
30
|
-
this.trailingCR = false;
|
|
31
|
-
}
|
|
32
|
-
if (text.endsWith('\r')) {
|
|
33
|
-
this.trailingCR = true;
|
|
34
|
-
text = text.slice(0, -1);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (!text) {
|
|
26
|
+
if (chunk == null) {
|
|
38
27
|
return [];
|
|
39
28
|
}
|
|
40
29
|
|
|
41
|
-
const
|
|
42
|
-
|
|
30
|
+
const binaryChunk =
|
|
31
|
+
chunk instanceof ArrayBuffer ? new Uint8Array(chunk)
|
|
32
|
+
: typeof chunk === 'string' ? new TextEncoder().encode(chunk)
|
|
33
|
+
: chunk;
|
|
34
|
+
|
|
35
|
+
let newData = new Uint8Array(this.buffer.length + binaryChunk.length);
|
|
36
|
+
newData.set(this.buffer);
|
|
37
|
+
newData.set(binaryChunk, this.buffer.length);
|
|
38
|
+
this.buffer = newData;
|
|
39
|
+
|
|
40
|
+
const lines: string[] = [];
|
|
41
|
+
let patternIndex;
|
|
42
|
+
while ((patternIndex = findNewlineIndex(this.buffer, this.#carriageReturnIndex)) != null) {
|
|
43
|
+
if (patternIndex.carriage && this.#carriageReturnIndex == null) {
|
|
44
|
+
// skip until we either get a corresponding `\n`, a new `\r` or nothing
|
|
45
|
+
this.#carriageReturnIndex = patternIndex.index;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
43
48
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
// we got double \r or \rtext\n
|
|
50
|
+
if (
|
|
51
|
+
this.#carriageReturnIndex != null &&
|
|
52
|
+
(patternIndex.index !== this.#carriageReturnIndex + 1 || patternIndex.carriage)
|
|
53
|
+
) {
|
|
54
|
+
lines.push(this.decodeText(this.buffer.slice(0, this.#carriageReturnIndex - 1)));
|
|
55
|
+
this.buffer = this.buffer.slice(this.#carriageReturnIndex);
|
|
56
|
+
this.#carriageReturnIndex = null;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
49
59
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
60
|
+
const endIndex =
|
|
61
|
+
this.#carriageReturnIndex !== null ? patternIndex.preceding - 1 : patternIndex.preceding;
|
|
54
62
|
|
|
55
|
-
|
|
56
|
-
lines
|
|
57
|
-
this.buffer = [];
|
|
58
|
-
}
|
|
63
|
+
const line = this.decodeText(this.buffer.slice(0, endIndex));
|
|
64
|
+
lines.push(line);
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
this
|
|
66
|
+
this.buffer = this.buffer.slice(patternIndex.index);
|
|
67
|
+
this.#carriageReturnIndex = null;
|
|
62
68
|
}
|
|
63
69
|
|
|
64
70
|
return lines;
|
|
@@ -102,13 +108,38 @@ export class LineDecoder {
|
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
flush(): string[] {
|
|
105
|
-
if (!this.buffer.length
|
|
111
|
+
if (!this.buffer.length) {
|
|
106
112
|
return [];
|
|
107
113
|
}
|
|
114
|
+
return this.decode('\n');
|
|
115
|
+
}
|
|
116
|
+
}
|
|
108
117
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
118
|
+
/**
|
|
119
|
+
* This function searches the buffer for the end patterns, (\r or \n)
|
|
120
|
+
* and returns an object with the index preceding the matched newline and the
|
|
121
|
+
* index after the newline char. `null` is returned if no new line is found.
|
|
122
|
+
*
|
|
123
|
+
* ```ts
|
|
124
|
+
* findNewLineIndex('abc\ndef') -> { preceding: 2, index: 3 }
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
function findNewlineIndex(
|
|
128
|
+
buffer: Uint8Array,
|
|
129
|
+
startIndex: number | null,
|
|
130
|
+
): { preceding: number; index: number; carriage: boolean } | null {
|
|
131
|
+
const newline = 0x0a; // \n
|
|
132
|
+
const carriage = 0x0d; // \r
|
|
133
|
+
|
|
134
|
+
for (let i = startIndex ?? 0; i < buffer.length; i++) {
|
|
135
|
+
if (buffer[i] === newline) {
|
|
136
|
+
return { preceding: i, index: i + 1, carriage: false };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (buffer[i] === carriage) {
|
|
140
|
+
return { preceding: i, index: i + 1, carriage: true };
|
|
141
|
+
}
|
|
113
142
|
}
|
|
143
|
+
|
|
144
|
+
return null;
|
|
114
145
|
}
|
|
@@ -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,22 @@ 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
|
-
|
|
61
|
-
|
|
66
|
+
/**
|
|
67
|
+
* A message containing the model's (assistant) response in a chat conversation.
|
|
68
|
+
*/
|
|
62
69
|
output_message: Shared.CompletionMessage;
|
|
63
70
|
|
|
64
71
|
session_id: string;
|
|
@@ -75,21 +82,29 @@ export interface Turn {
|
|
|
75
82
|
turn_id: string;
|
|
76
83
|
|
|
77
84
|
completed_at?: string;
|
|
85
|
+
|
|
86
|
+
output_attachments?: Array<Turn.OutputAttachment>;
|
|
78
87
|
}
|
|
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
|
|
85
97
|
| OutputAttachment.TextContentItem
|
|
86
98
|
| Array<Shared.InterleavedContentItem>
|
|
87
|
-
|
|
|
99
|
+
| OutputAttachment.URL;
|
|
88
100
|
|
|
89
101
|
mime_type: string;
|
|
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
|
|
@@ -116,10 +131,23 @@ export namespace Turn {
|
|
|
116
131
|
* A URL of the image or data URL in the format of data:image/{type};base64,{data}.
|
|
117
132
|
* Note that URL could have length limits.
|
|
118
133
|
*/
|
|
119
|
-
url?:
|
|
134
|
+
url?: Image.URL;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export namespace Image {
|
|
138
|
+
/**
|
|
139
|
+
* A URL of the image or data URL in the format of data:image/{type};base64,{data}.
|
|
140
|
+
* Note that URL could have length limits.
|
|
141
|
+
*/
|
|
142
|
+
export interface URL {
|
|
143
|
+
uri: string;
|
|
144
|
+
}
|
|
120
145
|
}
|
|
121
146
|
}
|
|
122
147
|
|
|
148
|
+
/**
|
|
149
|
+
* A text content item
|
|
150
|
+
*/
|
|
123
151
|
export interface TextContentItem {
|
|
124
152
|
/**
|
|
125
153
|
* Text content
|
|
@@ -131,6 +159,10 @@ export namespace Turn {
|
|
|
131
159
|
*/
|
|
132
160
|
type: 'text';
|
|
133
161
|
}
|
|
162
|
+
|
|
163
|
+
export interface URL {
|
|
164
|
+
uri: string;
|
|
165
|
+
}
|
|
134
166
|
}
|
|
135
167
|
}
|
|
136
168
|
|
|
@@ -189,6 +221,9 @@ export namespace TurnResponseEventPayload {
|
|
|
189
221
|
export interface AgentTurnResponseTurnCompletePayload {
|
|
190
222
|
event_type: 'turn_complete';
|
|
191
223
|
|
|
224
|
+
/**
|
|
225
|
+
* A single turn in an interaction with an Agentic System.
|
|
226
|
+
*/
|
|
192
227
|
turn: TurnAPI.Turn;
|
|
193
228
|
}
|
|
194
229
|
}
|
|
@@ -202,22 +237,33 @@ export interface TurnCreateParamsBase {
|
|
|
202
237
|
|
|
203
238
|
stream?: boolean;
|
|
204
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Configuration for tool use.
|
|
242
|
+
*/
|
|
243
|
+
tool_config?: TurnCreateParams.ToolConfig;
|
|
244
|
+
|
|
205
245
|
toolgroups?: Array<string | TurnCreateParams.UnionMember1>;
|
|
206
246
|
}
|
|
207
247
|
|
|
208
248
|
export namespace TurnCreateParams {
|
|
209
249
|
export interface Document {
|
|
250
|
+
/**
|
|
251
|
+
* A image content item
|
|
252
|
+
*/
|
|
210
253
|
content:
|
|
211
254
|
| string
|
|
212
255
|
| Document.ImageContentItem
|
|
213
256
|
| Document.TextContentItem
|
|
214
257
|
| Array<Shared.InterleavedContentItem>
|
|
215
|
-
|
|
|
258
|
+
| Document.URL;
|
|
216
259
|
|
|
217
260
|
mime_type: string;
|
|
218
261
|
}
|
|
219
262
|
|
|
220
263
|
export namespace Document {
|
|
264
|
+
/**
|
|
265
|
+
* A image content item
|
|
266
|
+
*/
|
|
221
267
|
export interface ImageContentItem {
|
|
222
268
|
/**
|
|
223
269
|
* Image as a base64 encoded string or an URL
|
|
@@ -244,10 +290,23 @@ export namespace TurnCreateParams {
|
|
|
244
290
|
* A URL of the image or data URL in the format of data:image/{type};base64,{data}.
|
|
245
291
|
* Note that URL could have length limits.
|
|
246
292
|
*/
|
|
247
|
-
url?:
|
|
293
|
+
url?: Image.URL;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export namespace Image {
|
|
297
|
+
/**
|
|
298
|
+
* A URL of the image or data URL in the format of data:image/{type};base64,{data}.
|
|
299
|
+
* Note that URL could have length limits.
|
|
300
|
+
*/
|
|
301
|
+
export interface URL {
|
|
302
|
+
uri: string;
|
|
303
|
+
}
|
|
248
304
|
}
|
|
249
305
|
}
|
|
250
306
|
|
|
307
|
+
/**
|
|
308
|
+
* A text content item
|
|
309
|
+
*/
|
|
251
310
|
export interface TextContentItem {
|
|
252
311
|
/**
|
|
253
312
|
* Text content
|
|
@@ -259,6 +318,41 @@ export namespace TurnCreateParams {
|
|
|
259
318
|
*/
|
|
260
319
|
type: 'text';
|
|
261
320
|
}
|
|
321
|
+
|
|
322
|
+
export interface URL {
|
|
323
|
+
uri: string;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Configuration for tool use.
|
|
329
|
+
*/
|
|
330
|
+
export interface ToolConfig {
|
|
331
|
+
/**
|
|
332
|
+
* (Optional) Config for how to override the default system prompt. -
|
|
333
|
+
* `SystemMessageBehavior.append`: Appends the provided system message to the
|
|
334
|
+
* default system prompt. - `SystemMessageBehavior.replace`: Replaces the default
|
|
335
|
+
* system prompt with the provided system message. The system message can include
|
|
336
|
+
* the string '{{function_definitions}}' to indicate where the function definitions
|
|
337
|
+
* should be inserted.
|
|
338
|
+
*/
|
|
339
|
+
system_message_behavior: 'append' | 'replace';
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* (Optional) Whether tool use is required or automatic. Defaults to
|
|
343
|
+
* ToolChoice.auto.
|
|
344
|
+
*/
|
|
345
|
+
tool_choice?: 'auto' | 'required';
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* (Optional) Instructs the model how to format tool calls. By default, Llama Stack
|
|
349
|
+
* will attempt to use a format that is best adapted to the model. -
|
|
350
|
+
* `ToolPromptFormat.json`: The tool calls are formatted as a JSON object. -
|
|
351
|
+
* `ToolPromptFormat.function_tag`: The tool calls are enclosed in a
|
|
352
|
+
* <function=function_name> tag. - `ToolPromptFormat.python_list`: The tool calls
|
|
353
|
+
* are output as Python syntax -- a list of function calls.
|
|
354
|
+
*/
|
|
355
|
+
tool_prompt_format?: 'json' | 'function_tag' | 'python_list';
|
|
262
356
|
}
|
|
263
357
|
|
|
264
358
|
export interface UnionMember1 {
|