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
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
// All rights reserved.
|
|
3
|
-
//
|
|
4
|
-
// This source code is licensed under the terms described in the LICENSE file in
|
|
5
|
-
// the root directory of this source tree.
|
|
6
|
-
//
|
|
7
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
8
|
-
|
|
9
|
-
import { APIResource } from '../resource';
|
|
10
|
-
import * as Core from '../core';
|
|
11
|
-
|
|
12
|
-
export class Toolgroups extends APIResource {
|
|
13
|
-
/**
|
|
14
|
-
* List tool groups with optional provider.
|
|
15
|
-
*
|
|
16
|
-
* @deprecated
|
|
17
|
-
*/
|
|
18
|
-
list(options?: Core.RequestOptions): Core.APIPromise<ToolgroupListResponse> {
|
|
19
|
-
return (
|
|
20
|
-
this._client.get('/v1/toolgroups', options) as Core.APIPromise<{ data: ToolgroupListResponse }>
|
|
21
|
-
)._thenUnwrap((obj) => obj.data);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Get a tool group by its ID.
|
|
26
|
-
*
|
|
27
|
-
* @deprecated
|
|
28
|
-
*/
|
|
29
|
-
get(toolgroupId: string, options?: Core.RequestOptions): Core.APIPromise<ToolGroup> {
|
|
30
|
-
return this._client.get(`/v1/toolgroups/${toolgroupId}`, options);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Register a tool group.
|
|
35
|
-
*
|
|
36
|
-
* @deprecated
|
|
37
|
-
*/
|
|
38
|
-
register(body: ToolgroupRegisterParams, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
39
|
-
return this._client.post('/v1/toolgroups', {
|
|
40
|
-
body,
|
|
41
|
-
...options,
|
|
42
|
-
headers: { Accept: '*/*', ...options?.headers },
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Unregister a tool group.
|
|
48
|
-
*
|
|
49
|
-
* @deprecated
|
|
50
|
-
*/
|
|
51
|
-
unregister(toolgroupId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
52
|
-
return this._client.delete(`/v1/toolgroups/${toolgroupId}`, {
|
|
53
|
-
...options,
|
|
54
|
-
headers: { Accept: '*/*', ...options?.headers },
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Response containing a list of tool groups.
|
|
61
|
-
*/
|
|
62
|
-
export interface ListToolGroupsResponse {
|
|
63
|
-
data: ToolgroupListResponse;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* A group of related tools managed together.
|
|
68
|
-
*/
|
|
69
|
-
export interface ToolGroup {
|
|
70
|
-
/**
|
|
71
|
-
* Unique identifier for this resource in llama stack
|
|
72
|
-
*/
|
|
73
|
-
identifier: string;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* ID of the provider that owns this resource
|
|
77
|
-
*/
|
|
78
|
-
provider_id: string;
|
|
79
|
-
|
|
80
|
-
args?: { [key: string]: unknown } | null;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* A URL reference to external content.
|
|
84
|
-
*/
|
|
85
|
-
mcp_endpoint?: ToolGroup.McpEndpoint | null;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Unique identifier for this resource in the provider
|
|
89
|
-
*/
|
|
90
|
-
provider_resource_id?: string | null;
|
|
91
|
-
|
|
92
|
-
type?: 'tool_group';
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export namespace ToolGroup {
|
|
96
|
-
/**
|
|
97
|
-
* A URL reference to external content.
|
|
98
|
-
*/
|
|
99
|
-
export interface McpEndpoint {
|
|
100
|
-
uri: string;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export type ToolgroupListResponse = Array<ToolGroup>;
|
|
105
|
-
|
|
106
|
-
export interface ToolgroupRegisterParams {
|
|
107
|
-
provider_id: string;
|
|
108
|
-
|
|
109
|
-
toolgroup_id: string;
|
|
110
|
-
|
|
111
|
-
args?: { [key: string]: unknown } | null;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* A URL reference to external content.
|
|
115
|
-
*/
|
|
116
|
-
mcp_endpoint?: ToolgroupRegisterParams.McpEndpoint | null;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export namespace ToolgroupRegisterParams {
|
|
120
|
-
/**
|
|
121
|
-
* A URL reference to external content.
|
|
122
|
-
*/
|
|
123
|
-
export interface McpEndpoint {
|
|
124
|
-
uri: string;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export declare namespace Toolgroups {
|
|
129
|
-
export {
|
|
130
|
-
type ListToolGroupsResponse as ListToolGroupsResponse,
|
|
131
|
-
type ToolGroup as ToolGroup,
|
|
132
|
-
type ToolgroupListResponse as ToolgroupListResponse,
|
|
133
|
-
type ToolgroupRegisterParams as ToolgroupRegisterParams,
|
|
134
|
-
};
|
|
135
|
-
}
|
package/src/resources/tools.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
// All rights reserved.
|
|
3
|
-
//
|
|
4
|
-
// This source code is licensed under the terms described in the LICENSE file in
|
|
5
|
-
// the root directory of this source tree.
|
|
6
|
-
//
|
|
7
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
8
|
-
|
|
9
|
-
import { APIResource } from '../resource';
|
|
10
|
-
import { isRequestOptions } from '../core';
|
|
11
|
-
import * as Core from '../core';
|
|
12
|
-
import * as ToolRuntimeAPI from './tool-runtime';
|
|
13
|
-
|
|
14
|
-
export class Tools extends APIResource {
|
|
15
|
-
/**
|
|
16
|
-
* List tools with optional tool group.
|
|
17
|
-
*
|
|
18
|
-
* @deprecated
|
|
19
|
-
*/
|
|
20
|
-
list(query?: ToolListParams, options?: Core.RequestOptions): Core.APIPromise<ToolListResponse>;
|
|
21
|
-
list(options?: Core.RequestOptions): Core.APIPromise<ToolListResponse>;
|
|
22
|
-
list(
|
|
23
|
-
query: ToolListParams | Core.RequestOptions = {},
|
|
24
|
-
options?: Core.RequestOptions,
|
|
25
|
-
): Core.APIPromise<ToolListResponse> {
|
|
26
|
-
if (isRequestOptions(query)) {
|
|
27
|
-
return this.list({}, query);
|
|
28
|
-
}
|
|
29
|
-
return (
|
|
30
|
-
this._client.get('/v1/tools', { query, ...options }) as Core.APIPromise<{ data: ToolListResponse }>
|
|
31
|
-
)._thenUnwrap((obj) => obj.data);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Get a tool by its name.
|
|
36
|
-
*
|
|
37
|
-
* @deprecated
|
|
38
|
-
*/
|
|
39
|
-
get(toolName: string, options?: Core.RequestOptions): Core.APIPromise<ToolRuntimeAPI.ToolDef> {
|
|
40
|
-
return this._client.get(`/v1/tools/${toolName}`, options);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export type ToolListResponse = Array<ToolRuntimeAPI.ToolDef>;
|
|
45
|
-
|
|
46
|
-
export interface ToolListParams {
|
|
47
|
-
toolgroup_id?: string | null;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export declare namespace Tools {
|
|
51
|
-
export { type ToolListResponse as ToolListResponse, type ToolListParams as ToolListParams };
|
|
52
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
// All rights reserved.
|
|
3
|
-
//
|
|
4
|
-
// This source code is licensed under the terms described in the LICENSE file in
|
|
5
|
-
// the root directory of this source tree.
|
|
6
|
-
//
|
|
7
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
8
|
-
|
|
9
|
-
import LlamaStackClient from 'llama-stack-client';
|
|
10
|
-
import { Response } from 'node-fetch';
|
|
11
|
-
|
|
12
|
-
const client = new LlamaStackClient({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
|
|
13
|
-
|
|
14
|
-
describe('resource job', () => {
|
|
15
|
-
test('list', async () => {
|
|
16
|
-
const responsePromise = client.alpha.postTraining.job.list();
|
|
17
|
-
const rawResponse = await responsePromise.asResponse();
|
|
18
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
19
|
-
const response = await responsePromise;
|
|
20
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
21
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
22
|
-
expect(dataAndResponse.data).toBe(response);
|
|
23
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('list: request options instead of params are passed correctly', async () => {
|
|
27
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
28
|
-
await expect(client.alpha.postTraining.job.list({ path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
29
|
-
LlamaStackClient.NotFoundError,
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test('artifacts', async () => {
|
|
34
|
-
const responsePromise = client.alpha.postTraining.job.artifacts();
|
|
35
|
-
const rawResponse = await responsePromise.asResponse();
|
|
36
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
37
|
-
const response = await responsePromise;
|
|
38
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
39
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
40
|
-
expect(dataAndResponse.data).toBe(response);
|
|
41
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('artifacts: request options instead of params are passed correctly', async () => {
|
|
45
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
46
|
-
await expect(
|
|
47
|
-
client.alpha.postTraining.job.artifacts({ path: '/_stainless_unknown_path' }),
|
|
48
|
-
).rejects.toThrow(LlamaStackClient.NotFoundError);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('cancel', async () => {
|
|
52
|
-
const responsePromise = client.alpha.postTraining.job.cancel();
|
|
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('cancel: request options instead of params are passed correctly', async () => {
|
|
63
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
64
|
-
await expect(client.alpha.postTraining.job.cancel({ path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
65
|
-
LlamaStackClient.NotFoundError,
|
|
66
|
-
);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('status', async () => {
|
|
70
|
-
const responsePromise = client.alpha.postTraining.job.status();
|
|
71
|
-
const rawResponse = await responsePromise.asResponse();
|
|
72
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
73
|
-
const response = await responsePromise;
|
|
74
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
75
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
76
|
-
expect(dataAndResponse.data).toBe(response);
|
|
77
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test('status: request options instead of params are passed correctly', async () => {
|
|
81
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
82
|
-
await expect(client.alpha.postTraining.job.status({ path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
83
|
-
LlamaStackClient.NotFoundError,
|
|
84
|
-
);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
// All rights reserved.
|
|
3
|
-
//
|
|
4
|
-
// This source code is licensed under the terms described in the LICENSE file in
|
|
5
|
-
// the root directory of this source tree.
|
|
6
|
-
//
|
|
7
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
8
|
-
|
|
9
|
-
import LlamaStackClient from 'llama-stack-client';
|
|
10
|
-
import { Response } from 'node-fetch';
|
|
11
|
-
|
|
12
|
-
const client = new LlamaStackClient({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
|
|
13
|
-
|
|
14
|
-
describe('resource postTraining', () => {
|
|
15
|
-
test('preferenceOptimize: only required params', async () => {
|
|
16
|
-
const responsePromise = client.alpha.postTraining.preferenceOptimize({
|
|
17
|
-
algorithm_config: { beta: 0 },
|
|
18
|
-
finetuned_model: 'finetuned_model',
|
|
19
|
-
hyperparam_search_config: { foo: 'bar' },
|
|
20
|
-
job_uuid: 'job_uuid',
|
|
21
|
-
logger_config: { foo: 'bar' },
|
|
22
|
-
training_config: { n_epochs: 0 },
|
|
23
|
-
});
|
|
24
|
-
const rawResponse = await responsePromise.asResponse();
|
|
25
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
26
|
-
const response = await responsePromise;
|
|
27
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
28
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
29
|
-
expect(dataAndResponse.data).toBe(response);
|
|
30
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test('preferenceOptimize: required and optional params', async () => {
|
|
34
|
-
const response = await client.alpha.postTraining.preferenceOptimize({
|
|
35
|
-
algorithm_config: { beta: 0, loss_type: 'sigmoid' },
|
|
36
|
-
finetuned_model: 'finetuned_model',
|
|
37
|
-
hyperparam_search_config: { foo: 'bar' },
|
|
38
|
-
job_uuid: 'job_uuid',
|
|
39
|
-
logger_config: { foo: 'bar' },
|
|
40
|
-
training_config: {
|
|
41
|
-
n_epochs: 0,
|
|
42
|
-
data_config: {
|
|
43
|
-
batch_size: 0,
|
|
44
|
-
data_format: 'instruct',
|
|
45
|
-
dataset_id: 'dataset_id',
|
|
46
|
-
shuffle: true,
|
|
47
|
-
packed: true,
|
|
48
|
-
train_on_input: true,
|
|
49
|
-
validation_dataset_id: 'validation_dataset_id',
|
|
50
|
-
},
|
|
51
|
-
dtype: 'dtype',
|
|
52
|
-
efficiency_config: {
|
|
53
|
-
enable_activation_checkpointing: true,
|
|
54
|
-
enable_activation_offloading: true,
|
|
55
|
-
fsdp_cpu_offload: true,
|
|
56
|
-
memory_efficient_fsdp_wrap: true,
|
|
57
|
-
},
|
|
58
|
-
gradient_accumulation_steps: 0,
|
|
59
|
-
max_steps_per_epoch: 0,
|
|
60
|
-
max_validation_steps: 0,
|
|
61
|
-
optimizer_config: {
|
|
62
|
-
lr: 0,
|
|
63
|
-
num_warmup_steps: 0,
|
|
64
|
-
optimizer_type: 'adam',
|
|
65
|
-
weight_decay: 0,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test('supervisedFineTune: only required params', async () => {
|
|
72
|
-
const responsePromise = client.alpha.postTraining.supervisedFineTune({
|
|
73
|
-
hyperparam_search_config: { foo: 'bar' },
|
|
74
|
-
job_uuid: 'job_uuid',
|
|
75
|
-
logger_config: { foo: 'bar' },
|
|
76
|
-
training_config: { n_epochs: 0 },
|
|
77
|
-
});
|
|
78
|
-
const rawResponse = await responsePromise.asResponse();
|
|
79
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
80
|
-
const response = await responsePromise;
|
|
81
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
82
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
83
|
-
expect(dataAndResponse.data).toBe(response);
|
|
84
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test('supervisedFineTune: required and optional params', async () => {
|
|
88
|
-
const response = await client.alpha.postTraining.supervisedFineTune({
|
|
89
|
-
hyperparam_search_config: { foo: 'bar' },
|
|
90
|
-
job_uuid: 'job_uuid',
|
|
91
|
-
logger_config: { foo: 'bar' },
|
|
92
|
-
training_config: {
|
|
93
|
-
n_epochs: 0,
|
|
94
|
-
data_config: {
|
|
95
|
-
batch_size: 0,
|
|
96
|
-
data_format: 'instruct',
|
|
97
|
-
dataset_id: 'dataset_id',
|
|
98
|
-
shuffle: true,
|
|
99
|
-
packed: true,
|
|
100
|
-
train_on_input: true,
|
|
101
|
-
validation_dataset_id: 'validation_dataset_id',
|
|
102
|
-
},
|
|
103
|
-
dtype: 'dtype',
|
|
104
|
-
efficiency_config: {
|
|
105
|
-
enable_activation_checkpointing: true,
|
|
106
|
-
enable_activation_offloading: true,
|
|
107
|
-
fsdp_cpu_offload: true,
|
|
108
|
-
memory_efficient_fsdp_wrap: true,
|
|
109
|
-
},
|
|
110
|
-
gradient_accumulation_steps: 0,
|
|
111
|
-
max_steps_per_epoch: 0,
|
|
112
|
-
max_validation_steps: 0,
|
|
113
|
-
optimizer_config: {
|
|
114
|
-
lr: 0,
|
|
115
|
-
num_warmup_steps: 0,
|
|
116
|
-
optimizer_type: 'adam',
|
|
117
|
-
weight_decay: 0,
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
algorithm_config: {
|
|
121
|
-
alpha: 0,
|
|
122
|
-
apply_lora_to_mlp: true,
|
|
123
|
-
apply_lora_to_output: true,
|
|
124
|
-
lora_attn_modules: ['string'],
|
|
125
|
-
rank: 0,
|
|
126
|
-
quantize_base: true,
|
|
127
|
-
type: 'LoRA',
|
|
128
|
-
use_dora: true,
|
|
129
|
-
},
|
|
130
|
-
checkpoint_dir: 'checkpoint_dir',
|
|
131
|
-
model: 'model',
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
});
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
// All rights reserved.
|
|
3
|
-
//
|
|
4
|
-
// This source code is licensed under the terms described in the LICENSE file in
|
|
5
|
-
// the root directory of this source tree.
|
|
6
|
-
//
|
|
7
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
8
|
-
|
|
9
|
-
import LlamaStackClient from 'llama-stack-client';
|
|
10
|
-
import { Response } from 'node-fetch';
|
|
11
|
-
|
|
12
|
-
const client = new LlamaStackClient({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
|
|
13
|
-
|
|
14
|
-
describe('resource toolRuntime', () => {
|
|
15
|
-
test('invokeTool: only required params', async () => {
|
|
16
|
-
const responsePromise = client.toolRuntime.invokeTool({
|
|
17
|
-
kwargs: { foo: 'bar' },
|
|
18
|
-
tool_name: 'tool_name',
|
|
19
|
-
});
|
|
20
|
-
const rawResponse = await responsePromise.asResponse();
|
|
21
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
22
|
-
const response = await responsePromise;
|
|
23
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
24
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
25
|
-
expect(dataAndResponse.data).toBe(response);
|
|
26
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
test('invokeTool: required and optional params', async () => {
|
|
30
|
-
const response = await client.toolRuntime.invokeTool({
|
|
31
|
-
kwargs: { foo: 'bar' },
|
|
32
|
-
tool_name: 'tool_name',
|
|
33
|
-
authorization: 'authorization',
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test.skip('listTools', async () => {
|
|
38
|
-
const responsePromise = client.toolRuntime.listTools();
|
|
39
|
-
const rawResponse = await responsePromise.asResponse();
|
|
40
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
41
|
-
const response = await responsePromise;
|
|
42
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
43
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
44
|
-
expect(dataAndResponse.data).toBe(response);
|
|
45
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('listTools: request options instead of params are passed correctly', async () => {
|
|
49
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
50
|
-
await expect(client.toolRuntime.listTools({ path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
51
|
-
LlamaStackClient.NotFoundError,
|
|
52
|
-
);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
test('listTools: request options and params are passed correctly', async () => {
|
|
56
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
57
|
-
await expect(
|
|
58
|
-
client.toolRuntime.listTools(
|
|
59
|
-
{
|
|
60
|
-
authorization: 'authorization',
|
|
61
|
-
mcp_endpoint: { uri: 'uri' },
|
|
62
|
-
tool_group_id: 'tool_group_id',
|
|
63
|
-
},
|
|
64
|
-
{ path: '/_stainless_unknown_path' },
|
|
65
|
-
),
|
|
66
|
-
).rejects.toThrow(LlamaStackClient.NotFoundError);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
// All rights reserved.
|
|
3
|
-
//
|
|
4
|
-
// This source code is licensed under the terms described in the LICENSE file in
|
|
5
|
-
// the root directory of this source tree.
|
|
6
|
-
//
|
|
7
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
8
|
-
|
|
9
|
-
import LlamaStackClient from 'llama-stack-client';
|
|
10
|
-
import { Response } from 'node-fetch';
|
|
11
|
-
|
|
12
|
-
const client = new LlamaStackClient({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
|
|
13
|
-
|
|
14
|
-
describe('resource toolgroups', () => {
|
|
15
|
-
test('list', async () => {
|
|
16
|
-
const responsePromise = client.toolgroups.list();
|
|
17
|
-
const rawResponse = await responsePromise.asResponse();
|
|
18
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
19
|
-
const response = await responsePromise;
|
|
20
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
21
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
22
|
-
expect(dataAndResponse.data).toBe(response);
|
|
23
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('list: request options instead of params are passed correctly', async () => {
|
|
27
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
28
|
-
await expect(client.toolgroups.list({ path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
29
|
-
LlamaStackClient.NotFoundError,
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test('get', async () => {
|
|
34
|
-
const responsePromise = client.toolgroups.get('toolgroup_id');
|
|
35
|
-
const rawResponse = await responsePromise.asResponse();
|
|
36
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
37
|
-
const response = await responsePromise;
|
|
38
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
39
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
40
|
-
expect(dataAndResponse.data).toBe(response);
|
|
41
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test('get: request options instead of params are passed correctly', async () => {
|
|
45
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
46
|
-
await expect(client.toolgroups.get('toolgroup_id', { path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
47
|
-
LlamaStackClient.NotFoundError,
|
|
48
|
-
);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('register: only required params', async () => {
|
|
52
|
-
const responsePromise = client.toolgroups.register({
|
|
53
|
-
provider_id: 'provider_id',
|
|
54
|
-
toolgroup_id: 'toolgroup_id',
|
|
55
|
-
});
|
|
56
|
-
const rawResponse = await responsePromise.asResponse();
|
|
57
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
58
|
-
const response = await responsePromise;
|
|
59
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
60
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
61
|
-
expect(dataAndResponse.data).toBe(response);
|
|
62
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('register: required and optional params', async () => {
|
|
66
|
-
const response = await client.toolgroups.register({
|
|
67
|
-
provider_id: 'provider_id',
|
|
68
|
-
toolgroup_id: 'toolgroup_id',
|
|
69
|
-
args: { foo: 'bar' },
|
|
70
|
-
mcp_endpoint: { uri: 'uri' },
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('unregister', async () => {
|
|
75
|
-
const responsePromise = client.toolgroups.unregister('toolgroup_id');
|
|
76
|
-
const rawResponse = await responsePromise.asResponse();
|
|
77
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
78
|
-
const response = await responsePromise;
|
|
79
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
80
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
81
|
-
expect(dataAndResponse.data).toBe(response);
|
|
82
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
test('unregister: request options instead of params are passed correctly', async () => {
|
|
86
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
87
|
-
await expect(
|
|
88
|
-
client.toolgroups.unregister('toolgroup_id', { path: '/_stainless_unknown_path' }),
|
|
89
|
-
).rejects.toThrow(LlamaStackClient.NotFoundError);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
// All rights reserved.
|
|
3
|
-
//
|
|
4
|
-
// This source code is licensed under the terms described in the LICENSE file in
|
|
5
|
-
// the root directory of this source tree.
|
|
6
|
-
//
|
|
7
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
8
|
-
|
|
9
|
-
import LlamaStackClient from 'llama-stack-client';
|
|
10
|
-
import { Response } from 'node-fetch';
|
|
11
|
-
|
|
12
|
-
const client = new LlamaStackClient({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' });
|
|
13
|
-
|
|
14
|
-
describe('resource tools', () => {
|
|
15
|
-
test('list', async () => {
|
|
16
|
-
const responsePromise = client.tools.list();
|
|
17
|
-
const rawResponse = await responsePromise.asResponse();
|
|
18
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
19
|
-
const response = await responsePromise;
|
|
20
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
21
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
22
|
-
expect(dataAndResponse.data).toBe(response);
|
|
23
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
test('list: request options instead of params are passed correctly', async () => {
|
|
27
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
28
|
-
await expect(client.tools.list({ path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
29
|
-
LlamaStackClient.NotFoundError,
|
|
30
|
-
);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test('list: request options and params are passed correctly', async () => {
|
|
34
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
35
|
-
await expect(
|
|
36
|
-
client.tools.list({ toolgroup_id: 'toolgroup_id' }, { path: '/_stainless_unknown_path' }),
|
|
37
|
-
).rejects.toThrow(LlamaStackClient.NotFoundError);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
test('get', async () => {
|
|
41
|
-
const responsePromise = client.tools.get('tool_name');
|
|
42
|
-
const rawResponse = await responsePromise.asResponse();
|
|
43
|
-
expect(rawResponse).toBeInstanceOf(Response);
|
|
44
|
-
const response = await responsePromise;
|
|
45
|
-
expect(response).not.toBeInstanceOf(Response);
|
|
46
|
-
const dataAndResponse = await responsePromise.withResponse();
|
|
47
|
-
expect(dataAndResponse.data).toBe(response);
|
|
48
|
-
expect(dataAndResponse.response).toBe(rawResponse);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test('get: request options instead of params are passed correctly', async () => {
|
|
52
|
-
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
|
|
53
|
-
await expect(client.tools.get('tool_name', { path: '/_stainless_unknown_path' })).rejects.toThrow(
|
|
54
|
-
LlamaStackClient.NotFoundError,
|
|
55
|
-
);
|
|
56
|
-
});
|
|
57
|
-
});
|