llama-stack-client 0.6.1 → 0.7.1
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/.github/workflows/ci.yml +16 -10
- package/.gitignore +1 -0
- package/.release-please-manifest.json +1 -1
- package/.stats.yml +4 -4
- package/CHANGELOG.md +80 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +22 -0
- package/api.md +1 -71
- package/dist/CHANGELOG.md +80 -0
- package/dist/README.md +22 -0
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +8 -17
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +8 -17
- package/dist/core.mjs.map +1 -1
- package/dist/index.d.mts +51 -12
- package/dist/index.d.ts +51 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -11
- package/dist/index.mjs.map +1 -1
- package/dist/internal/utils/query.d.ts +2 -0
- package/dist/internal/utils/query.d.ts.map +1 -0
- package/dist/{resources/alpha/post-training/post-training.js → internal/utils/query.js} +6 -24
- package/dist/internal/utils/query.js.map +1 -0
- package/dist/{resources/alpha/post-training.mjs → internal/utils/query.mjs} +5 -2
- package/dist/internal/utils/query.mjs.map +1 -0
- package/dist/package.json +1 -1
- package/dist/resources/alpha/alpha.d.ts +0 -4
- package/dist/resources/alpha/alpha.d.ts.map +1 -1
- package/dist/resources/alpha/alpha.js +0 -4
- package/dist/resources/alpha/alpha.js.map +1 -1
- package/dist/resources/alpha/alpha.mjs +0 -4
- package/dist/resources/alpha/alpha.mjs.map +1 -1
- package/dist/resources/alpha/eval/eval.d.ts +3 -0
- package/dist/resources/alpha/eval/eval.d.ts.map +1 -1
- package/dist/resources/alpha/eval/eval.js +3 -0
- package/dist/resources/alpha/eval/eval.js.map +1 -1
- package/dist/resources/alpha/eval/eval.mjs +3 -0
- package/dist/resources/alpha/eval/eval.mjs.map +1 -1
- package/dist/resources/alpha/eval/jobs.d.ts +3 -0
- package/dist/resources/alpha/eval/jobs.d.ts.map +1 -1
- package/dist/resources/alpha/eval/jobs.js +3 -0
- package/dist/resources/alpha/eval/jobs.js.map +1 -1
- package/dist/resources/alpha/eval/jobs.mjs +3 -0
- package/dist/resources/alpha/eval/jobs.mjs.map +1 -1
- package/dist/resources/alpha/index.d.ts +0 -1
- package/dist/resources/alpha/index.d.ts.map +1 -1
- package/dist/resources/alpha/index.js +1 -3
- package/dist/resources/alpha/index.js.map +1 -1
- package/dist/resources/alpha/index.mjs +0 -1
- package/dist/resources/alpha/index.mjs.map +1 -1
- package/dist/resources/alpha/inference.d.ts +8 -0
- package/dist/resources/alpha/inference.d.ts.map +1 -1
- package/dist/resources/alpha/inference.js +8 -0
- package/dist/resources/alpha/inference.js.map +1 -1
- package/dist/resources/alpha/inference.mjs +8 -0
- package/dist/resources/alpha/inference.mjs.map +1 -1
- package/dist/resources/batches.d.ts +8 -0
- package/dist/resources/batches.d.ts.map +1 -1
- package/dist/resources/batches.js +8 -0
- package/dist/resources/batches.js.map +1 -1
- package/dist/resources/batches.mjs +8 -0
- package/dist/resources/batches.mjs.map +1 -1
- package/dist/resources/beta/datasets.d.ts +4 -8
- package/dist/resources/beta/datasets.d.ts.map +1 -1
- package/dist/resources/chat/chat.d.ts +34 -32
- package/dist/resources/chat/chat.d.ts.map +1 -1
- package/dist/resources/chat/chat.js.map +1 -1
- package/dist/resources/chat/chat.mjs.map +1 -1
- package/dist/resources/chat/completions.d.ts +321 -713
- package/dist/resources/chat/completions.d.ts.map +1 -1
- package/dist/resources/chat/completions.js +8 -0
- package/dist/resources/chat/completions.js.map +1 -1
- package/dist/resources/chat/completions.mjs +8 -0
- package/dist/resources/chat/completions.mjs.map +1 -1
- package/dist/resources/completions.d.ts +10 -4
- package/dist/resources/completions.d.ts.map +1 -1
- package/dist/resources/completions.js +8 -0
- package/dist/resources/completions.js.map +1 -1
- package/dist/resources/completions.mjs +8 -0
- package/dist/resources/completions.mjs.map +1 -1
- package/dist/resources/conversations/conversations.d.ts +95 -2
- package/dist/resources/conversations/conversations.d.ts.map +1 -1
- package/dist/resources/conversations/conversations.js +3 -0
- package/dist/resources/conversations/conversations.js.map +1 -1
- package/dist/resources/conversations/conversations.mjs +3 -0
- package/dist/resources/conversations/conversations.mjs.map +1 -1
- package/dist/resources/conversations/items.d.ts +371 -8
- package/dist/resources/conversations/items.d.ts.map +1 -1
- package/dist/resources/conversations/items.js +3 -0
- package/dist/resources/conversations/items.js.map +1 -1
- package/dist/resources/conversations/items.mjs +3 -0
- package/dist/resources/conversations/items.mjs.map +1 -1
- package/dist/resources/embeddings.d.ts +8 -0
- package/dist/resources/embeddings.d.ts.map +1 -1
- package/dist/resources/embeddings.js +8 -0
- package/dist/resources/embeddings.js.map +1 -1
- package/dist/resources/embeddings.mjs +8 -0
- package/dist/resources/embeddings.mjs.map +1 -1
- package/dist/resources/files.d.ts +11 -8
- package/dist/resources/files.d.ts.map +1 -1
- package/dist/resources/files.js +3 -0
- package/dist/resources/files.js.map +1 -1
- package/dist/resources/files.mjs +3 -0
- package/dist/resources/files.mjs.map +1 -1
- package/dist/resources/index.d.ts +1 -4
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js +1 -7
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/index.mjs +0 -3
- package/dist/resources/index.mjs.map +1 -1
- package/dist/resources/inspect.d.ts +3 -0
- package/dist/resources/inspect.d.ts.map +1 -1
- package/dist/resources/inspect.js +3 -0
- package/dist/resources/inspect.js.map +1 -1
- package/dist/resources/inspect.mjs +3 -0
- package/dist/resources/inspect.mjs.map +1 -1
- package/dist/resources/models/index.d.ts +1 -1
- package/dist/resources/models/index.d.ts.map +1 -1
- package/dist/resources/models/index.js.map +1 -1
- package/dist/resources/models/index.mjs.map +1 -1
- package/dist/resources/models/models.d.ts +7 -65
- package/dist/resources/models/models.d.ts.map +1 -1
- package/dist/resources/models/models.js +0 -19
- package/dist/resources/models/models.js.map +1 -1
- package/dist/resources/models/models.mjs +0 -19
- package/dist/resources/models/models.mjs.map +1 -1
- package/dist/resources/moderations.d.ts +3 -0
- package/dist/resources/moderations.d.ts.map +1 -1
- package/dist/resources/moderations.js +3 -0
- package/dist/resources/moderations.js.map +1 -1
- package/dist/resources/moderations.mjs +3 -0
- package/dist/resources/moderations.mjs.map +1 -1
- package/dist/resources/prompts/prompts.d.ts +3 -0
- package/dist/resources/prompts/prompts.d.ts.map +1 -1
- package/dist/resources/prompts/prompts.js +3 -0
- package/dist/resources/prompts/prompts.js.map +1 -1
- package/dist/resources/prompts/prompts.mjs +3 -0
- package/dist/resources/prompts/prompts.mjs.map +1 -1
- package/dist/resources/prompts/versions.d.ts +3 -0
- package/dist/resources/prompts/versions.d.ts.map +1 -1
- package/dist/resources/prompts/versions.js +3 -0
- package/dist/resources/prompts/versions.js.map +1 -1
- package/dist/resources/prompts/versions.mjs +3 -0
- package/dist/resources/prompts/versions.mjs.map +1 -1
- package/dist/resources/providers.d.ts +3 -0
- package/dist/resources/providers.d.ts.map +1 -1
- package/dist/resources/providers.js +3 -0
- package/dist/resources/providers.js.map +1 -1
- package/dist/resources/providers.mjs +3 -0
- package/dist/resources/providers.mjs.map +1 -1
- package/dist/resources/responses/input-items.d.ts +102 -3
- package/dist/resources/responses/input-items.d.ts.map +1 -1
- package/dist/resources/responses/responses.d.ts +582 -11
- package/dist/resources/responses/responses.d.ts.map +1 -1
- package/dist/resources/responses/responses.js.map +1 -1
- package/dist/resources/responses/responses.mjs.map +1 -1
- package/dist/resources/routes.d.ts +3 -0
- package/dist/resources/routes.d.ts.map +1 -1
- package/dist/resources/routes.js +3 -0
- package/dist/resources/routes.js.map +1 -1
- package/dist/resources/routes.mjs +3 -0
- package/dist/resources/routes.mjs.map +1 -1
- package/dist/resources/safety.d.ts +14 -11
- package/dist/resources/safety.d.ts.map +1 -1
- package/dist/resources/safety.js +3 -0
- package/dist/resources/safety.js.map +1 -1
- package/dist/resources/safety.mjs +3 -0
- package/dist/resources/safety.mjs.map +1 -1
- package/dist/resources/vector-io.d.ts +4 -4
- package/dist/resources/vector-stores/file-batches.d.ts +49 -1
- package/dist/resources/vector-stores/file-batches.d.ts.map +1 -1
- package/dist/resources/vector-stores/file-batches.js.map +1 -1
- package/dist/resources/vector-stores/file-batches.mjs.map +1 -1
- package/dist/resources/vector-stores/files.d.ts +100 -4
- package/dist/resources/vector-stores/files.d.ts.map +1 -1
- package/dist/resources/vector-stores/files.js.map +1 -1
- package/dist/resources/vector-stores/files.mjs.map +1 -1
- package/dist/resources/vector-stores/vector-stores.d.ts +51 -3
- package/dist/resources/vector-stores/vector-stores.d.ts.map +1 -1
- package/dist/resources/vector-stores/vector-stores.js.map +1 -1
- package/dist/resources/vector-stores/vector-stores.mjs.map +1 -1
- package/dist/src/core.ts +10 -21
- package/dist/src/index.ts +51 -48
- package/{src/resources/alpha/post-training.ts → dist/src/internal/utils/query.ts} +5 -1
- package/dist/src/resources/alpha/alpha.ts +0 -20
- package/dist/src/resources/alpha/eval/eval.ts +3 -0
- package/dist/src/resources/alpha/eval/jobs.ts +3 -0
- package/dist/src/resources/alpha/index.ts +0 -8
- package/dist/src/resources/alpha/inference.ts +8 -0
- package/dist/src/resources/batches.ts +8 -0
- package/dist/src/resources/beta/datasets.ts +4 -9
- package/dist/src/resources/chat/chat.ts +36 -33
- package/dist/src/resources/chat/completions.ts +307 -811
- package/dist/src/resources/completions.ts +10 -4
- package/dist/src/resources/conversations/conversations.ts +121 -1
- package/dist/src/resources/conversations/items.ts +477 -6
- package/dist/src/resources/embeddings.ts +8 -0
- package/dist/src/resources/files.ts +12 -9
- package/dist/src/resources/index.ts +0 -18
- package/dist/src/resources/inspect.ts +3 -0
- package/dist/src/resources/models/index.ts +0 -2
- package/dist/src/resources/models/models.ts +7 -82
- package/dist/src/resources/moderations.ts +3 -0
- package/dist/src/resources/prompts/prompts.ts +3 -0
- package/dist/src/resources/prompts/versions.ts +3 -0
- package/dist/src/resources/providers.ts +3 -0
- package/dist/src/resources/responses/input-items.ts +128 -2
- package/dist/src/resources/responses/responses.ts +706 -7
- package/dist/src/resources/routes.ts +3 -0
- package/dist/src/resources/safety.ts +15 -12
- package/dist/src/resources/vector-io.ts +4 -4
- package/dist/src/resources/vector-stores/file-batches.ts +57 -0
- package/dist/src/resources/vector-stores/files.ts +117 -3
- package/dist/src/resources/vector-stores/vector-stores.ts +59 -2
- package/dist/src/streaming.ts +24 -6
- package/dist/src/version.ts +1 -1
- package/dist/streaming.d.ts.map +1 -1
- package/dist/streaming.js +21 -6
- package/dist/streaming.js.map +1 -1
- package/dist/streaming.mjs +21 -6
- package/dist/streaming.mjs.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +1 -1
- package/scripts/mock +21 -10
- package/scripts/test +8 -8
- package/src/core.ts +10 -21
- package/src/index.ts +51 -48
- package/{dist/src/resources/alpha/post-training.ts → src/internal/utils/query.ts} +5 -1
- package/src/resources/alpha/alpha.ts +0 -20
- package/src/resources/alpha/eval/eval.ts +3 -0
- package/src/resources/alpha/eval/jobs.ts +3 -0
- package/src/resources/alpha/index.ts +0 -8
- package/src/resources/alpha/inference.ts +8 -0
- package/src/resources/batches.ts +8 -0
- package/src/resources/beta/datasets.ts +4 -9
- package/src/resources/chat/chat.ts +36 -33
- package/src/resources/chat/completions.ts +307 -811
- package/src/resources/completions.ts +10 -4
- package/src/resources/conversations/conversations.ts +121 -1
- package/src/resources/conversations/items.ts +477 -6
- package/src/resources/embeddings.ts +8 -0
- package/src/resources/files.ts +12 -9
- package/src/resources/index.ts +0 -18
- package/src/resources/inspect.ts +3 -0
- package/src/resources/models/index.ts +0 -2
- package/src/resources/models/models.ts +7 -82
- package/src/resources/moderations.ts +3 -0
- package/src/resources/prompts/prompts.ts +3 -0
- package/src/resources/prompts/versions.ts +3 -0
- package/src/resources/providers.ts +3 -0
- package/src/resources/responses/input-items.ts +128 -2
- package/src/resources/responses/responses.ts +706 -7
- package/src/resources/routes.ts +3 -0
- package/src/resources/safety.ts +15 -12
- package/src/resources/vector-io.ts +4 -4
- package/src/resources/vector-stores/file-batches.ts +57 -0
- package/src/resources/vector-stores/files.ts +117 -3
- package/src/resources/vector-stores/vector-stores.ts +59 -2
- package/src/streaming.ts +24 -6
- package/src/version.ts +1 -1
- package/tests/api-resources/beta/datasets.test.ts +4 -10
- package/tests/api-resources/chat/completions.test.ts +2 -0
- package/tests/api-resources/files.test.ts +2 -2
- package/tests/api-resources/models/models.test.ts +0 -39
- package/tests/api-resources/responses/responses.test.ts +10 -1
- package/tests/api-resources/vector-stores/file-batches.test.ts +1 -1
- package/tests/api-resources/vector-stores/files.test.ts +1 -1
- package/tests/api-resources/vector-stores/vector-stores.test.ts +1 -1
- package/tests/stringifyQuery.test.ts +2 -4
- package/dist/resources/alpha/post-training/index.d.ts +0 -3
- package/dist/resources/alpha/post-training/index.d.ts.map +0 -1
- package/dist/resources/alpha/post-training/index.js +0 -15
- package/dist/resources/alpha/post-training/index.js.map +0 -1
- package/dist/resources/alpha/post-training/index.mjs +0 -10
- package/dist/resources/alpha/post-training/index.mjs.map +0 -1
- package/dist/resources/alpha/post-training/job.d.ts +0 -104
- package/dist/resources/alpha/post-training/job.d.ts.map +0 -1
- package/dist/resources/alpha/post-training/job.js +0 -42
- package/dist/resources/alpha/post-training/job.js.map +0 -1
- package/dist/resources/alpha/post-training/job.mjs +0 -38
- package/dist/resources/alpha/post-training/job.mjs.map +0 -1
- package/dist/resources/alpha/post-training/post-training.d.ts +0 -269
- package/dist/resources/alpha/post-training/post-training.d.ts.map +0 -1
- package/dist/resources/alpha/post-training/post-training.js.map +0 -1
- package/dist/resources/alpha/post-training/post-training.mjs +0 -30
- package/dist/resources/alpha/post-training/post-training.mjs.map +0 -1
- package/dist/resources/alpha/post-training.d.ts +0 -2
- package/dist/resources/alpha/post-training.d.ts.map +0 -1
- package/dist/resources/alpha/post-training.js +0 -25
- package/dist/resources/alpha/post-training.js.map +0 -1
- package/dist/resources/alpha/post-training.mjs.map +0 -1
- package/dist/resources/tool-runtime.d.ts +0 -152
- package/dist/resources/tool-runtime.d.ts.map +0 -1
- package/dist/resources/tool-runtime.js +0 -30
- package/dist/resources/tool-runtime.js.map +0 -1
- package/dist/resources/tool-runtime.mjs +0 -26
- package/dist/resources/tool-runtime.mjs.map +0 -1
- package/dist/resources/toolgroups.d.ts +0 -91
- package/dist/resources/toolgroups.d.ts.map +0 -1
- package/dist/resources/toolgroups.js +0 -54
- package/dist/resources/toolgroups.js.map +0 -1
- package/dist/resources/toolgroups.mjs +0 -50
- package/dist/resources/toolgroups.mjs.map +0 -1
- package/dist/resources/tools.d.ts +0 -26
- package/dist/resources/tools.d.ts.map +0 -1
- package/dist/resources/tools.js +0 -30
- package/dist/resources/tools.js.map +0 -1
- package/dist/resources/tools.mjs +0 -26
- package/dist/resources/tools.mjs.map +0 -1
- package/dist/src/resources/alpha/post-training/index.ts +0 -17
- package/dist/src/resources/alpha/post-training/job.ts +0 -161
- package/dist/src/resources/alpha/post-training/post-training.ts +0 -385
- package/dist/src/resources/tool-runtime.ts +0 -217
- package/dist/src/resources/toolgroups.ts +0 -135
- package/dist/src/resources/tools.ts +0 -52
- package/src/resources/alpha/post-training/index.ts +0 -17
- package/src/resources/alpha/post-training/job.ts +0 -161
- package/src/resources/alpha/post-training/post-training.ts +0 -385
- package/src/resources/tool-runtime.ts +0 -217
- package/src/resources/toolgroups.ts +0 -135
- package/src/resources/tools.ts +0 -52
- package/tests/api-resources/alpha/post-training/job.test.ts +0 -86
- package/tests/api-resources/alpha/post-training/post-training.test.ts +0 -134
- package/tests/api-resources/tool-runtime.test.ts +0 -68
- package/tests/api-resources/toolgroups.test.ts +0 -91
- package/tests/api-resources/tools.test.ts +0 -57
package/src/resources/routes.ts
CHANGED
|
@@ -11,6 +11,9 @@ import { isRequestOptions } from '../core';
|
|
|
11
11
|
import * as Core from '../core';
|
|
12
12
|
import * as Shared from './shared';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* APIs for inspecting the Llama Stack service, including health status, available API routes with methods and implementing providers.
|
|
16
|
+
*/
|
|
14
17
|
export class Routes extends APIResource {
|
|
15
18
|
/**
|
|
16
19
|
* List all available API routes with their methods and implementing providers.
|
package/src/resources/safety.ts
CHANGED
|
@@ -10,6 +10,9 @@ import { APIResource } from '../resource';
|
|
|
10
10
|
import * as Core from '../core';
|
|
11
11
|
import * as Shared from './shared';
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* OpenAI-compatible Moderations API.
|
|
15
|
+
*/
|
|
13
16
|
export class Safety extends APIResource {
|
|
14
17
|
/**
|
|
15
18
|
* Run a safety shield on messages to check for policy violations.
|
|
@@ -122,6 +125,9 @@ export namespace SafetyRunShieldParams {
|
|
|
122
125
|
}
|
|
123
126
|
}
|
|
124
127
|
|
|
128
|
+
/**
|
|
129
|
+
* File content part for OpenAI-compatible chat completion messages.
|
|
130
|
+
*/
|
|
125
131
|
export interface OpenAIFile {
|
|
126
132
|
/**
|
|
127
133
|
* File specification.
|
|
@@ -222,6 +228,8 @@ export namespace SafetyRunShieldParams {
|
|
|
222
228
|
* List of tool calls. Each tool call is an OpenAIChatCompletionToolCall object.
|
|
223
229
|
*/
|
|
224
230
|
tool_calls?: Array<OpenAIAssistantMessageParamInput.ToolCall> | null;
|
|
231
|
+
|
|
232
|
+
[k: string]: unknown;
|
|
225
233
|
}
|
|
226
234
|
|
|
227
235
|
export namespace OpenAIAssistantMessageParamInput {
|
|
@@ -247,38 +255,33 @@ export namespace SafetyRunShieldParams {
|
|
|
247
255
|
/**
|
|
248
256
|
* Unique identifier for the tool call.
|
|
249
257
|
*/
|
|
250
|
-
id
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Function call details for OpenAI-compatible tool calls.
|
|
254
|
-
*/
|
|
255
|
-
function?: ToolCall.Function | null;
|
|
258
|
+
id: string;
|
|
256
259
|
|
|
257
260
|
/**
|
|
258
|
-
*
|
|
261
|
+
* Function call details.
|
|
259
262
|
*/
|
|
260
|
-
|
|
263
|
+
function: ToolCall.Function;
|
|
261
264
|
|
|
262
265
|
/**
|
|
263
266
|
* Must be 'function' to identify this as a function call.
|
|
264
267
|
*/
|
|
265
|
-
type
|
|
268
|
+
type: 'function';
|
|
266
269
|
}
|
|
267
270
|
|
|
268
271
|
export namespace ToolCall {
|
|
269
272
|
/**
|
|
270
|
-
* Function call details
|
|
273
|
+
* Function call details.
|
|
271
274
|
*/
|
|
272
275
|
export interface Function {
|
|
273
276
|
/**
|
|
274
277
|
* Arguments to pass to the function as a JSON string.
|
|
275
278
|
*/
|
|
276
|
-
arguments
|
|
279
|
+
arguments: string;
|
|
277
280
|
|
|
278
281
|
/**
|
|
279
282
|
* Name of the function to call.
|
|
280
283
|
*/
|
|
281
|
-
name
|
|
284
|
+
name: string;
|
|
282
285
|
}
|
|
283
286
|
}
|
|
284
287
|
}
|
|
@@ -50,7 +50,7 @@ export namespace QueryChunksResponse {
|
|
|
50
50
|
* `ChunkMetadata` is backend metadata for a `Chunk` that is used to store
|
|
51
51
|
* additional information about the chunk that will not be used in the context
|
|
52
52
|
* during inference, but is required for backend functionality. The `ChunkMetadata`
|
|
53
|
-
* is set during chunk creation in `
|
|
53
|
+
* is set during chunk creation in `FileSearchToolRuntimeImpl().insert()`and is not
|
|
54
54
|
* expected to change after. Use `Chunk.metadata` for metadata that will be used in
|
|
55
55
|
* the context during inference.
|
|
56
56
|
*/
|
|
@@ -79,7 +79,7 @@ export namespace QueryChunksResponse {
|
|
|
79
79
|
* `ChunkMetadata` is backend metadata for a `Chunk` that is used to store
|
|
80
80
|
* additional information about the chunk that will not be used in the context
|
|
81
81
|
* during inference, but is required for backend functionality. The `ChunkMetadata`
|
|
82
|
-
* is set during chunk creation in `
|
|
82
|
+
* is set during chunk creation in `FileSearchToolRuntimeImpl().insert()`and is not
|
|
83
83
|
* expected to change after. Use `Chunk.metadata` for metadata that will be used in
|
|
84
84
|
* the context during inference.
|
|
85
85
|
*/
|
|
@@ -222,7 +222,7 @@ export namespace VectorIoInsertParams {
|
|
|
222
222
|
* `ChunkMetadata` is backend metadata for a `Chunk` that is used to store
|
|
223
223
|
* additional information about the chunk that will not be used in the context
|
|
224
224
|
* during inference, but is required for backend functionality. The `ChunkMetadata`
|
|
225
|
-
* is set during chunk creation in `
|
|
225
|
+
* is set during chunk creation in `FileSearchToolRuntimeImpl().insert()`and is not
|
|
226
226
|
* expected to change after. Use `Chunk.metadata` for metadata that will be used in
|
|
227
227
|
* the context during inference.
|
|
228
228
|
*/
|
|
@@ -251,7 +251,7 @@ export namespace VectorIoInsertParams {
|
|
|
251
251
|
* `ChunkMetadata` is backend metadata for a `Chunk` that is used to store
|
|
252
252
|
* additional information about the chunk that will not be used in the context
|
|
253
253
|
* during inference, but is required for backend functionality. The `ChunkMetadata`
|
|
254
|
-
* is set during chunk creation in `
|
|
254
|
+
* is set during chunk creation in `FileSearchToolRuntimeImpl().insert()`and is not
|
|
255
255
|
* expected to change after. Use `Chunk.metadata` for metadata that will be used in
|
|
256
256
|
* the context during inference.
|
|
257
257
|
*/
|
|
@@ -141,6 +141,7 @@ export interface FileBatchCreateParams {
|
|
|
141
141
|
chunking_strategy?:
|
|
142
142
|
| FileBatchCreateParams.VectorStoreChunkingStrategyAuto
|
|
143
143
|
| FileBatchCreateParams.VectorStoreChunkingStrategyStatic
|
|
144
|
+
| FileBatchCreateParams.VectorStoreChunkingStrategyContextual
|
|
144
145
|
| null;
|
|
145
146
|
|
|
146
147
|
[k: string]: unknown;
|
|
@@ -176,6 +177,62 @@ export namespace FileBatchCreateParams {
|
|
|
176
177
|
max_chunk_size_tokens?: number;
|
|
177
178
|
}
|
|
178
179
|
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Contextual chunking strategy that uses an LLM to situate chunks within the
|
|
183
|
+
* document.
|
|
184
|
+
*/
|
|
185
|
+
export interface VectorStoreChunkingStrategyContextual {
|
|
186
|
+
/**
|
|
187
|
+
* Configuration for contextual chunking.
|
|
188
|
+
*/
|
|
189
|
+
contextual: VectorStoreChunkingStrategyContextual.Contextual;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Strategy type identifier.
|
|
193
|
+
*/
|
|
194
|
+
type?: 'contextual';
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export namespace VectorStoreChunkingStrategyContextual {
|
|
198
|
+
/**
|
|
199
|
+
* Configuration for contextual chunking.
|
|
200
|
+
*/
|
|
201
|
+
export interface Contextual {
|
|
202
|
+
/**
|
|
203
|
+
* Tokens to overlap between adjacent chunks. Must be less than
|
|
204
|
+
* max_chunk_size_tokens.
|
|
205
|
+
*/
|
|
206
|
+
chunk_overlap_tokens?: number;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Prompt template for contextual retrieval. Uses WHOLE_DOCUMENT and CHUNK_CONTENT
|
|
210
|
+
* placeholders wrapped in double curly braces.
|
|
211
|
+
*/
|
|
212
|
+
context_prompt?: string;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Maximum tokens per chunk. Suggested ~700 to allow room for prepended context.
|
|
216
|
+
*/
|
|
217
|
+
max_chunk_size_tokens?: number;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Maximum concurrent LLM calls. Falls back to config default if not provided.
|
|
221
|
+
*/
|
|
222
|
+
max_concurrency?: number | null;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* LLM model for generating context. Falls back to
|
|
226
|
+
* VectorStoresConfig.contextual_retrieval_params.model if not provided.
|
|
227
|
+
*/
|
|
228
|
+
model_id?: string | null;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Timeout per LLM call in seconds. Falls back to config default if not provided.
|
|
232
|
+
*/
|
|
233
|
+
timeout_seconds?: number | null;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
179
236
|
}
|
|
180
237
|
|
|
181
238
|
export interface FileBatchListFilesParams extends OpenAICursorPageParams {
|
|
@@ -127,7 +127,8 @@ export interface VectorStoreFile {
|
|
|
127
127
|
*/
|
|
128
128
|
chunking_strategy:
|
|
129
129
|
| VectorStoreFile.VectorStoreChunkingStrategyAuto
|
|
130
|
-
| VectorStoreFile.VectorStoreChunkingStrategyStatic
|
|
130
|
+
| VectorStoreFile.VectorStoreChunkingStrategyStatic
|
|
131
|
+
| VectorStoreFile.VectorStoreChunkingStrategyContextual;
|
|
131
132
|
|
|
132
133
|
created_at: number;
|
|
133
134
|
|
|
@@ -185,6 +186,62 @@ export namespace VectorStoreFile {
|
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
|
|
189
|
+
/**
|
|
190
|
+
* Contextual chunking strategy that uses an LLM to situate chunks within the
|
|
191
|
+
* document.
|
|
192
|
+
*/
|
|
193
|
+
export interface VectorStoreChunkingStrategyContextual {
|
|
194
|
+
/**
|
|
195
|
+
* Configuration for contextual chunking.
|
|
196
|
+
*/
|
|
197
|
+
contextual: VectorStoreChunkingStrategyContextual.Contextual;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Strategy type identifier.
|
|
201
|
+
*/
|
|
202
|
+
type?: 'contextual';
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export namespace VectorStoreChunkingStrategyContextual {
|
|
206
|
+
/**
|
|
207
|
+
* Configuration for contextual chunking.
|
|
208
|
+
*/
|
|
209
|
+
export interface Contextual {
|
|
210
|
+
/**
|
|
211
|
+
* Tokens to overlap between adjacent chunks. Must be less than
|
|
212
|
+
* max_chunk_size_tokens.
|
|
213
|
+
*/
|
|
214
|
+
chunk_overlap_tokens?: number;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Prompt template for contextual retrieval. Uses WHOLE_DOCUMENT and CHUNK_CONTENT
|
|
218
|
+
* placeholders wrapped in double curly braces.
|
|
219
|
+
*/
|
|
220
|
+
context_prompt?: string;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Maximum tokens per chunk. Suggested ~700 to allow room for prepended context.
|
|
224
|
+
*/
|
|
225
|
+
max_chunk_size_tokens?: number;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Maximum concurrent LLM calls. Falls back to config default if not provided.
|
|
229
|
+
*/
|
|
230
|
+
max_concurrency?: number | null;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* LLM model for generating context. Falls back to
|
|
234
|
+
* VectorStoresConfig.contextual_retrieval_params.model if not provided.
|
|
235
|
+
*/
|
|
236
|
+
model_id?: string | null;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Timeout per LLM call in seconds. Falls back to config default if not provided.
|
|
240
|
+
*/
|
|
241
|
+
timeout_seconds?: number | null;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
188
245
|
/**
|
|
189
246
|
* Error information for failed vector store file processing.
|
|
190
247
|
*/
|
|
@@ -232,7 +289,7 @@ export namespace FileContentResponse {
|
|
|
232
289
|
* `ChunkMetadata` is backend metadata for a `Chunk` that is used to store
|
|
233
290
|
* additional information about the chunk that will not be used in the context
|
|
234
291
|
* during inference, but is required for backend functionality. The `ChunkMetadata`
|
|
235
|
-
* is set during chunk creation in `
|
|
292
|
+
* is set during chunk creation in `FileSearchToolRuntimeImpl().insert()`and is not
|
|
236
293
|
* expected to change after. Use `Chunk.metadata` for metadata that will be used in
|
|
237
294
|
* the context during inference.
|
|
238
295
|
*/
|
|
@@ -248,7 +305,7 @@ export namespace FileContentResponse {
|
|
|
248
305
|
* `ChunkMetadata` is backend metadata for a `Chunk` that is used to store
|
|
249
306
|
* additional information about the chunk that will not be used in the context
|
|
250
307
|
* during inference, but is required for backend functionality. The `ChunkMetadata`
|
|
251
|
-
* is set during chunk creation in `
|
|
308
|
+
* is set during chunk creation in `FileSearchToolRuntimeImpl().insert()`and is not
|
|
252
309
|
* expected to change after. Use `Chunk.metadata` for metadata that will be used in
|
|
253
310
|
* the context during inference.
|
|
254
311
|
*/
|
|
@@ -291,6 +348,7 @@ export interface FileCreateParams {
|
|
|
291
348
|
chunking_strategy?:
|
|
292
349
|
| FileCreateParams.VectorStoreChunkingStrategyAuto
|
|
293
350
|
| FileCreateParams.VectorStoreChunkingStrategyStatic
|
|
351
|
+
| FileCreateParams.VectorStoreChunkingStrategyContextual
|
|
294
352
|
| null;
|
|
295
353
|
}
|
|
296
354
|
|
|
@@ -324,6 +382,62 @@ export namespace FileCreateParams {
|
|
|
324
382
|
max_chunk_size_tokens?: number;
|
|
325
383
|
}
|
|
326
384
|
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Contextual chunking strategy that uses an LLM to situate chunks within the
|
|
388
|
+
* document.
|
|
389
|
+
*/
|
|
390
|
+
export interface VectorStoreChunkingStrategyContextual {
|
|
391
|
+
/**
|
|
392
|
+
* Configuration for contextual chunking.
|
|
393
|
+
*/
|
|
394
|
+
contextual: VectorStoreChunkingStrategyContextual.Contextual;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Strategy type identifier.
|
|
398
|
+
*/
|
|
399
|
+
type?: 'contextual';
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export namespace VectorStoreChunkingStrategyContextual {
|
|
403
|
+
/**
|
|
404
|
+
* Configuration for contextual chunking.
|
|
405
|
+
*/
|
|
406
|
+
export interface Contextual {
|
|
407
|
+
/**
|
|
408
|
+
* Tokens to overlap between adjacent chunks. Must be less than
|
|
409
|
+
* max_chunk_size_tokens.
|
|
410
|
+
*/
|
|
411
|
+
chunk_overlap_tokens?: number;
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Prompt template for contextual retrieval. Uses WHOLE_DOCUMENT and CHUNK_CONTENT
|
|
415
|
+
* placeholders wrapped in double curly braces.
|
|
416
|
+
*/
|
|
417
|
+
context_prompt?: string;
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Maximum tokens per chunk. Suggested ~700 to allow room for prepended context.
|
|
421
|
+
*/
|
|
422
|
+
max_chunk_size_tokens?: number;
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Maximum concurrent LLM calls. Falls back to config default if not provided.
|
|
426
|
+
*/
|
|
427
|
+
max_concurrency?: number | null;
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* LLM model for generating context. Falls back to
|
|
431
|
+
* VectorStoresConfig.contextual_retrieval_params.model if not provided.
|
|
432
|
+
*/
|
|
433
|
+
model_id?: string | null;
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Timeout per LLM call in seconds. Falls back to config default if not provided.
|
|
437
|
+
*/
|
|
438
|
+
timeout_seconds?: number | null;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
327
441
|
}
|
|
328
442
|
|
|
329
443
|
export interface FileUpdateParams {
|
|
@@ -216,7 +216,7 @@ export namespace VectorStoreSearchResponse {
|
|
|
216
216
|
* `ChunkMetadata` is backend metadata for a `Chunk` that is used to store
|
|
217
217
|
* additional information about the chunk that will not be used in the context
|
|
218
218
|
* during inference, but is required for backend functionality. The `ChunkMetadata`
|
|
219
|
-
* is set during chunk creation in `
|
|
219
|
+
* is set during chunk creation in `FileSearchToolRuntimeImpl().insert()`and is not
|
|
220
220
|
* expected to change after. Use `Chunk.metadata` for metadata that will be used in
|
|
221
221
|
* the context during inference.
|
|
222
222
|
*/
|
|
@@ -232,7 +232,7 @@ export namespace VectorStoreSearchResponse {
|
|
|
232
232
|
* `ChunkMetadata` is backend metadata for a `Chunk` that is used to store
|
|
233
233
|
* additional information about the chunk that will not be used in the context
|
|
234
234
|
* during inference, but is required for backend functionality. The `ChunkMetadata`
|
|
235
|
-
* is set during chunk creation in `
|
|
235
|
+
* is set during chunk creation in `FileSearchToolRuntimeImpl().insert()`and is not
|
|
236
236
|
* expected to change after. Use `Chunk.metadata` for metadata that will be used in
|
|
237
237
|
* the context during inference.
|
|
238
238
|
*/
|
|
@@ -266,6 +266,7 @@ export interface VectorStoreCreateParams {
|
|
|
266
266
|
chunking_strategy?:
|
|
267
267
|
| VectorStoreCreateParams.VectorStoreChunkingStrategyAuto
|
|
268
268
|
| VectorStoreCreateParams.VectorStoreChunkingStrategyStatic
|
|
269
|
+
| VectorStoreCreateParams.VectorStoreChunkingStrategyContextual
|
|
269
270
|
| null;
|
|
270
271
|
|
|
271
272
|
expires_after?: { [key: string]: unknown } | null;
|
|
@@ -309,6 +310,62 @@ export namespace VectorStoreCreateParams {
|
|
|
309
310
|
max_chunk_size_tokens?: number;
|
|
310
311
|
}
|
|
311
312
|
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* Contextual chunking strategy that uses an LLM to situate chunks within the
|
|
316
|
+
* document.
|
|
317
|
+
*/
|
|
318
|
+
export interface VectorStoreChunkingStrategyContextual {
|
|
319
|
+
/**
|
|
320
|
+
* Configuration for contextual chunking.
|
|
321
|
+
*/
|
|
322
|
+
contextual: VectorStoreChunkingStrategyContextual.Contextual;
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Strategy type identifier.
|
|
326
|
+
*/
|
|
327
|
+
type?: 'contextual';
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export namespace VectorStoreChunkingStrategyContextual {
|
|
331
|
+
/**
|
|
332
|
+
* Configuration for contextual chunking.
|
|
333
|
+
*/
|
|
334
|
+
export interface Contextual {
|
|
335
|
+
/**
|
|
336
|
+
* Tokens to overlap between adjacent chunks. Must be less than
|
|
337
|
+
* max_chunk_size_tokens.
|
|
338
|
+
*/
|
|
339
|
+
chunk_overlap_tokens?: number;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Prompt template for contextual retrieval. Uses WHOLE_DOCUMENT and CHUNK_CONTENT
|
|
343
|
+
* placeholders wrapped in double curly braces.
|
|
344
|
+
*/
|
|
345
|
+
context_prompt?: string;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Maximum tokens per chunk. Suggested ~700 to allow room for prepended context.
|
|
349
|
+
*/
|
|
350
|
+
max_chunk_size_tokens?: number;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Maximum concurrent LLM calls. Falls back to config default if not provided.
|
|
354
|
+
*/
|
|
355
|
+
max_concurrency?: number | null;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* LLM model for generating context. Falls back to
|
|
359
|
+
* VectorStoresConfig.contextual_retrieval_params.model if not provided.
|
|
360
|
+
*/
|
|
361
|
+
model_id?: string | null;
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Timeout per LLM call in seconds. Falls back to config default if not provided.
|
|
365
|
+
*/
|
|
366
|
+
timeout_seconds?: number | null;
|
|
367
|
+
}
|
|
368
|
+
}
|
|
312
369
|
}
|
|
313
370
|
|
|
314
371
|
export interface VectorStoreUpdateParams {
|
package/src/streaming.ts
CHANGED
|
@@ -9,6 +9,9 @@ import { LlamaStackClientError } from './error';
|
|
|
9
9
|
import { findDoubleNewlineIndex, LineDecoder } from './internal/decoders/line';
|
|
10
10
|
import { ReadableStreamToAsyncIterable } from './internal/stream-utils';
|
|
11
11
|
|
|
12
|
+
import { createResponseHeaders } from './core';
|
|
13
|
+
import { APIError } from './error';
|
|
14
|
+
|
|
12
15
|
type Bytes = string | ArrayBuffer | Uint8Array | Buffer | null | undefined;
|
|
13
16
|
|
|
14
17
|
export type ServerSentEvent = {
|
|
@@ -38,12 +41,27 @@ export class Stream<Item> implements AsyncIterable<Item> {
|
|
|
38
41
|
let done = false;
|
|
39
42
|
try {
|
|
40
43
|
for await (const sse of _iterSSEMessages(response, controller)) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
if (done) continue;
|
|
45
|
+
|
|
46
|
+
if (sse.data.startsWith('[DONE]')) {
|
|
47
|
+
done = true;
|
|
48
|
+
continue;
|
|
49
|
+
} else {
|
|
50
|
+
let data;
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
data = JSON.parse(sse.data) as any;
|
|
54
|
+
} catch (e) {
|
|
55
|
+
console.error(`Could not parse message into JSON:`, sse.data);
|
|
56
|
+
console.error(`From chunk:`, sse.raw);
|
|
57
|
+
throw e;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (data && data.error) {
|
|
61
|
+
throw new APIError(undefined, data.error, undefined, createResponseHeaders(response.headers));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
yield data;
|
|
47
65
|
}
|
|
48
66
|
}
|
|
49
67
|
done = true;
|
package/src/version.ts
CHANGED
|
@@ -49,10 +49,7 @@ describe('resource datasets', () => {
|
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
test('appendrows: only required params', async () => {
|
|
52
|
-
const responsePromise = client.beta.datasets.appendrows('dataset_id', {
|
|
53
|
-
body_dataset_id: 'dataset_id',
|
|
54
|
-
rows: [{ foo: 'bar' }],
|
|
55
|
-
});
|
|
52
|
+
const responsePromise = client.beta.datasets.appendrows('dataset_id', { rows: [{ foo: 'bar' }] });
|
|
56
53
|
const rawResponse = await responsePromise.asResponse();
|
|
57
54
|
expect(rawResponse).toBeInstanceOf(Response);
|
|
58
55
|
const response = await responsePromise;
|
|
@@ -63,10 +60,7 @@ describe('resource datasets', () => {
|
|
|
63
60
|
});
|
|
64
61
|
|
|
65
62
|
test('appendrows: required and optional params', async () => {
|
|
66
|
-
const response = await client.beta.datasets.appendrows('dataset_id', {
|
|
67
|
-
body_dataset_id: 'dataset_id',
|
|
68
|
-
rows: [{ foo: 'bar' }],
|
|
69
|
-
});
|
|
63
|
+
const response = await client.beta.datasets.appendrows('dataset_id', { rows: [{ foo: 'bar' }] });
|
|
70
64
|
});
|
|
71
65
|
|
|
72
66
|
test('iterrows', async () => {
|
|
@@ -100,7 +94,7 @@ describe('resource datasets', () => {
|
|
|
100
94
|
|
|
101
95
|
test('register: only required params', async () => {
|
|
102
96
|
const responsePromise = client.beta.datasets.register({
|
|
103
|
-
purpose: '
|
|
97
|
+
purpose: 'eval/question-answer',
|
|
104
98
|
source: { uri: 'uri', type: 'uri' },
|
|
105
99
|
});
|
|
106
100
|
const rawResponse = await responsePromise.asResponse();
|
|
@@ -114,7 +108,7 @@ describe('resource datasets', () => {
|
|
|
114
108
|
|
|
115
109
|
test('register: required and optional params', async () => {
|
|
116
110
|
const response = await client.beta.datasets.register({
|
|
117
|
-
purpose: '
|
|
111
|
+
purpose: 'eval/question-answer',
|
|
118
112
|
source: { uri: 'uri', type: 'uri' },
|
|
119
113
|
dataset_id: 'dataset_id',
|
|
120
114
|
metadata: { foo: 'bar' },
|
|
@@ -46,10 +46,12 @@ describe('resource completions', () => {
|
|
|
46
46
|
n: 1,
|
|
47
47
|
parallel_tool_calls: true,
|
|
48
48
|
presence_penalty: -2,
|
|
49
|
+
prompt_cache_key: 'prompt_cache_key',
|
|
49
50
|
reasoning_effort: 'none',
|
|
50
51
|
response_format: { type: 'text' },
|
|
51
52
|
safety_identifier: 'safety_identifier',
|
|
52
53
|
seed: 0,
|
|
54
|
+
service_tier: 'auto',
|
|
53
55
|
stop: 'string',
|
|
54
56
|
stream: false,
|
|
55
57
|
stream_options: { foo: 'bar' },
|
|
@@ -14,7 +14,7 @@ const client = new LlamaStackClient({ baseURL: process.env['TEST_API_BASE_URL']
|
|
|
14
14
|
describe('resource files', () => {
|
|
15
15
|
test('create: only required params', async () => {
|
|
16
16
|
const responsePromise = client.files.create({
|
|
17
|
-
file: await toFile(Buffer.from('
|
|
17
|
+
file: await toFile(Buffer.from('Example data'), 'README.md'),
|
|
18
18
|
purpose: 'assistants',
|
|
19
19
|
});
|
|
20
20
|
const rawResponse = await responsePromise.asResponse();
|
|
@@ -28,7 +28,7 @@ describe('resource files', () => {
|
|
|
28
28
|
|
|
29
29
|
test('create: required and optional params', async () => {
|
|
30
30
|
const response = await client.files.create({
|
|
31
|
-
file: await toFile(Buffer.from('
|
|
31
|
+
file: await toFile(Buffer.from('Example data'), 'README.md'),
|
|
32
32
|
purpose: 'assistants',
|
|
33
33
|
expires_after: { anchor: 'created_at', seconds: 3600 },
|
|
34
34
|
});
|
|
@@ -47,43 +47,4 @@ describe('resource models', () => {
|
|
|
47
47
|
LlamaStackClient.NotFoundError,
|
|
48
48
|
);
|
|
49
49
|
});
|
|
50
|
-
|
|
51
|
-
test('register: only required params', async () => {
|
|
52
|
-
const responsePromise = client.models.register({ model_id: 'model_id' });
|
|
53
|
-
const rawResponse = await responsePromise.asResponse();
|
|
54
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
55
|
-
const response = await responsePromise;
|
|
56
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
57
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
58
|
-
expect(dataAndResponse.data).toBe(response);
|
|
59
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test('register: required and optional params', async () => {
|
|
63
|
-
const response = await client.models.register({
|
|
64
|
-
model_id: 'model_id',
|
|
65
|
-
metadata: { foo: 'bar' },
|
|
66
|
-
model_type: 'llm',
|
|
67
|
-
provider_id: 'provider_id',
|
|
68
|
-
provider_model_id: 'provider_model_id',
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test('unregister', async () => {
|
|
73
|
-
const responsePromise = client.models.unregister('model_id');
|
|
74
|
-
const rawResponse = await responsePromise.asResponse();
|
|
75
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
76
|
-
const response = await responsePromise;
|
|
77
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
78
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
79
|
-
expect(dataAndResponse.data).toBe(response);
|
|
80
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
test('unregister: request options instead of params are passed correctly', async () => {
|
|
84
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
85
|
-
await expect(client.models.unregister('model_id', { path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
86
|
-
LlamaStackClient.NotFoundError,
|
|
87
|
-
);
|
|
88
|
-
});
|
|
89
50
|
});
|
|
@@ -27,7 +27,9 @@ describe('resource responses', () => {
|
|
|
27
27
|
const response = await client.responses.create({
|
|
28
28
|
input: 'string',
|
|
29
29
|
model: 'model',
|
|
30
|
+
background: true,
|
|
30
31
|
conversation: 'conversation',
|
|
32
|
+
frequency_penalty: -2,
|
|
31
33
|
guardrails: ['string'],
|
|
32
34
|
include: ['web_search_call.action.sources'],
|
|
33
35
|
instructions: 'instructions',
|
|
@@ -36,16 +38,20 @@ describe('resource responses', () => {
|
|
|
36
38
|
max_tool_calls: 1,
|
|
37
39
|
metadata: { foo: 'string' },
|
|
38
40
|
parallel_tool_calls: true,
|
|
41
|
+
presence_penalty: -2,
|
|
39
42
|
previous_response_id: 'previous_response_id',
|
|
40
43
|
prompt: {
|
|
41
44
|
id: 'id',
|
|
42
45
|
variables: { foo: { text: 'text', type: 'input_text' } },
|
|
43
46
|
version: 'version',
|
|
44
47
|
},
|
|
45
|
-
|
|
48
|
+
prompt_cache_key: 'prompt_cache_key',
|
|
49
|
+
reasoning: { effort: 'none', summary: 'auto' },
|
|
46
50
|
safety_identifier: 'safety_identifier',
|
|
51
|
+
service_tier: 'auto',
|
|
47
52
|
store: true,
|
|
48
53
|
stream: false,
|
|
54
|
+
stream_options: { include_obfuscation: true },
|
|
49
55
|
temperature: 0,
|
|
50
56
|
text: {
|
|
51
57
|
format: {
|
|
@@ -58,6 +64,9 @@ describe('resource responses', () => {
|
|
|
58
64
|
},
|
|
59
65
|
tool_choice: 'auto',
|
|
60
66
|
tools: [{ search_context_size: 'S?oC"high', type: 'web_search' }],
|
|
67
|
+
top_logprobs: 0,
|
|
68
|
+
top_p: 0,
|
|
69
|
+
truncation: 'auto',
|
|
61
70
|
});
|
|
62
71
|
});
|
|
63
72
|
|