llama-stack-client 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.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,385 +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
|
-
import * as JobAPI from './job';
|
|
12
|
-
import { Job, JobArtifactsResponse, JobListResponse, JobStatusResponse } from './job';
|
|
13
|
-
|
|
14
|
-
export class PostTraining extends APIResource {
|
|
15
|
-
job: JobAPI.Job = new JobAPI.Job(this._client);
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Run preference optimization of a model.
|
|
19
|
-
*/
|
|
20
|
-
preferenceOptimize(
|
|
21
|
-
body: PostTrainingPreferenceOptimizeParams,
|
|
22
|
-
options?: Core.RequestOptions,
|
|
23
|
-
): Core.APIPromise<PostTrainingJob> {
|
|
24
|
-
return this._client.post('/v1alpha/post-training/preference-optimize', { body, ...options });
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Run supervised fine-tuning of a model.
|
|
29
|
-
*/
|
|
30
|
-
supervisedFineTune(
|
|
31
|
-
body: PostTrainingSupervisedFineTuneParams,
|
|
32
|
-
options?: Core.RequestOptions,
|
|
33
|
-
): Core.APIPromise<PostTrainingJob> {
|
|
34
|
-
return this._client.post('/v1alpha/post-training/supervised-fine-tune', { body, ...options });
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Configuration for Low-Rank Adaptation (LoRA) fine-tuning.
|
|
40
|
-
*/
|
|
41
|
-
export type AlgorithmConfig = AlgorithmConfig.LoraFinetuningConfig | AlgorithmConfig.QatFinetuningConfig;
|
|
42
|
-
|
|
43
|
-
export namespace AlgorithmConfig {
|
|
44
|
-
/**
|
|
45
|
-
* Configuration for Low-Rank Adaptation (LoRA) fine-tuning.
|
|
46
|
-
*/
|
|
47
|
-
export interface LoraFinetuningConfig {
|
|
48
|
-
alpha: number;
|
|
49
|
-
|
|
50
|
-
apply_lora_to_mlp: boolean;
|
|
51
|
-
|
|
52
|
-
apply_lora_to_output: boolean;
|
|
53
|
-
|
|
54
|
-
lora_attn_modules: Array<string>;
|
|
55
|
-
|
|
56
|
-
rank: number;
|
|
57
|
-
|
|
58
|
-
quantize_base?: boolean | null;
|
|
59
|
-
|
|
60
|
-
type?: 'LoRA';
|
|
61
|
-
|
|
62
|
-
use_dora?: boolean | null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Configuration for Quantization-Aware Training (QAT) fine-tuning.
|
|
67
|
-
*/
|
|
68
|
-
export interface QatFinetuningConfig {
|
|
69
|
-
group_size: number;
|
|
70
|
-
|
|
71
|
-
quantizer_name: string;
|
|
72
|
-
|
|
73
|
-
type?: 'QAT';
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface ListPostTrainingJobsResponse {
|
|
78
|
-
data: JobAPI.JobListResponse;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface PostTrainingJob {
|
|
82
|
-
job_uuid: string;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface PostTrainingPreferenceOptimizeParams {
|
|
86
|
-
/**
|
|
87
|
-
* The algorithm configuration.
|
|
88
|
-
*/
|
|
89
|
-
algorithm_config: PostTrainingPreferenceOptimizeParams.AlgorithmConfig;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* The model to fine-tune.
|
|
93
|
-
*/
|
|
94
|
-
finetuned_model: string;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* The hyperparam search configuration.
|
|
98
|
-
*/
|
|
99
|
-
hyperparam_search_config: { [key: string]: unknown };
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* The UUID of the job to create.
|
|
103
|
-
*/
|
|
104
|
-
job_uuid: string;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* The logger configuration.
|
|
108
|
-
*/
|
|
109
|
-
logger_config: { [key: string]: unknown };
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* The training configuration.
|
|
113
|
-
*/
|
|
114
|
-
training_config: PostTrainingPreferenceOptimizeParams.TrainingConfig;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export namespace PostTrainingPreferenceOptimizeParams {
|
|
118
|
-
/**
|
|
119
|
-
* The algorithm configuration.
|
|
120
|
-
*/
|
|
121
|
-
export interface AlgorithmConfig {
|
|
122
|
-
beta: number;
|
|
123
|
-
|
|
124
|
-
loss_type?: 'sigmoid' | 'hinge' | 'ipo' | 'kto_pair';
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* The training configuration.
|
|
129
|
-
*/
|
|
130
|
-
export interface TrainingConfig {
|
|
131
|
-
n_epochs: number;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Configuration for training data and data loading.
|
|
135
|
-
*/
|
|
136
|
-
data_config?: TrainingConfig.DataConfig | null;
|
|
137
|
-
|
|
138
|
-
dtype?: string | null;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Configuration for memory and compute efficiency optimizations.
|
|
142
|
-
*/
|
|
143
|
-
efficiency_config?: TrainingConfig.EfficiencyConfig | null;
|
|
144
|
-
|
|
145
|
-
gradient_accumulation_steps?: number;
|
|
146
|
-
|
|
147
|
-
max_steps_per_epoch?: number;
|
|
148
|
-
|
|
149
|
-
max_validation_steps?: number | null;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Configuration parameters for the optimization algorithm.
|
|
153
|
-
*/
|
|
154
|
-
optimizer_config?: TrainingConfig.OptimizerConfig | null;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
export namespace TrainingConfig {
|
|
158
|
-
/**
|
|
159
|
-
* Configuration for training data and data loading.
|
|
160
|
-
*/
|
|
161
|
-
export interface DataConfig {
|
|
162
|
-
batch_size: number;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Format of the training dataset.
|
|
166
|
-
*/
|
|
167
|
-
data_format: 'instruct' | 'dialog';
|
|
168
|
-
|
|
169
|
-
dataset_id: string;
|
|
170
|
-
|
|
171
|
-
shuffle: boolean;
|
|
172
|
-
|
|
173
|
-
packed?: boolean | null;
|
|
174
|
-
|
|
175
|
-
train_on_input?: boolean | null;
|
|
176
|
-
|
|
177
|
-
validation_dataset_id?: string | null;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Configuration for memory and compute efficiency optimizations.
|
|
182
|
-
*/
|
|
183
|
-
export interface EfficiencyConfig {
|
|
184
|
-
enable_activation_checkpointing?: boolean | null;
|
|
185
|
-
|
|
186
|
-
enable_activation_offloading?: boolean | null;
|
|
187
|
-
|
|
188
|
-
fsdp_cpu_offload?: boolean | null;
|
|
189
|
-
|
|
190
|
-
memory_efficient_fsdp_wrap?: boolean | null;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Configuration parameters for the optimization algorithm.
|
|
195
|
-
*/
|
|
196
|
-
export interface OptimizerConfig {
|
|
197
|
-
lr: number;
|
|
198
|
-
|
|
199
|
-
num_warmup_steps: number;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Available optimizer algorithms for training.
|
|
203
|
-
*/
|
|
204
|
-
optimizer_type: 'adam' | 'adamw' | 'sgd';
|
|
205
|
-
|
|
206
|
-
weight_decay: number;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export interface PostTrainingSupervisedFineTuneParams {
|
|
212
|
-
/**
|
|
213
|
-
* The hyperparam search configuration.
|
|
214
|
-
*/
|
|
215
|
-
hyperparam_search_config: { [key: string]: unknown };
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* The UUID of the job to create.
|
|
219
|
-
*/
|
|
220
|
-
job_uuid: string;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* The logger configuration.
|
|
224
|
-
*/
|
|
225
|
-
logger_config: { [key: string]: unknown };
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* The training configuration.
|
|
229
|
-
*/
|
|
230
|
-
training_config: PostTrainingSupervisedFineTuneParams.TrainingConfig;
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* The algorithm configuration.
|
|
234
|
-
*/
|
|
235
|
-
algorithm_config?:
|
|
236
|
-
| PostTrainingSupervisedFineTuneParams.LoraFinetuningConfig
|
|
237
|
-
| PostTrainingSupervisedFineTuneParams.QatFinetuningConfig
|
|
238
|
-
| null;
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* The directory to save checkpoint(s) to.
|
|
242
|
-
*/
|
|
243
|
-
checkpoint_dir?: string | null;
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Model descriptor for training if not in provider config
|
|
247
|
-
*/
|
|
248
|
-
model?: string | null;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export namespace PostTrainingSupervisedFineTuneParams {
|
|
252
|
-
/**
|
|
253
|
-
* The training configuration.
|
|
254
|
-
*/
|
|
255
|
-
export interface TrainingConfig {
|
|
256
|
-
n_epochs: number;
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* Configuration for training data and data loading.
|
|
260
|
-
*/
|
|
261
|
-
data_config?: TrainingConfig.DataConfig | null;
|
|
262
|
-
|
|
263
|
-
dtype?: string | null;
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Configuration for memory and compute efficiency optimizations.
|
|
267
|
-
*/
|
|
268
|
-
efficiency_config?: TrainingConfig.EfficiencyConfig | null;
|
|
269
|
-
|
|
270
|
-
gradient_accumulation_steps?: number;
|
|
271
|
-
|
|
272
|
-
max_steps_per_epoch?: number;
|
|
273
|
-
|
|
274
|
-
max_validation_steps?: number | null;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Configuration parameters for the optimization algorithm.
|
|
278
|
-
*/
|
|
279
|
-
optimizer_config?: TrainingConfig.OptimizerConfig | null;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export namespace TrainingConfig {
|
|
283
|
-
/**
|
|
284
|
-
* Configuration for training data and data loading.
|
|
285
|
-
*/
|
|
286
|
-
export interface DataConfig {
|
|
287
|
-
batch_size: number;
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Format of the training dataset.
|
|
291
|
-
*/
|
|
292
|
-
data_format: 'instruct' | 'dialog';
|
|
293
|
-
|
|
294
|
-
dataset_id: string;
|
|
295
|
-
|
|
296
|
-
shuffle: boolean;
|
|
297
|
-
|
|
298
|
-
packed?: boolean | null;
|
|
299
|
-
|
|
300
|
-
train_on_input?: boolean | null;
|
|
301
|
-
|
|
302
|
-
validation_dataset_id?: string | null;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* Configuration for memory and compute efficiency optimizations.
|
|
307
|
-
*/
|
|
308
|
-
export interface EfficiencyConfig {
|
|
309
|
-
enable_activation_checkpointing?: boolean | null;
|
|
310
|
-
|
|
311
|
-
enable_activation_offloading?: boolean | null;
|
|
312
|
-
|
|
313
|
-
fsdp_cpu_offload?: boolean | null;
|
|
314
|
-
|
|
315
|
-
memory_efficient_fsdp_wrap?: boolean | null;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* Configuration parameters for the optimization algorithm.
|
|
320
|
-
*/
|
|
321
|
-
export interface OptimizerConfig {
|
|
322
|
-
lr: number;
|
|
323
|
-
|
|
324
|
-
num_warmup_steps: number;
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Available optimizer algorithms for training.
|
|
328
|
-
*/
|
|
329
|
-
optimizer_type: 'adam' | 'adamw' | 'sgd';
|
|
330
|
-
|
|
331
|
-
weight_decay: number;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Configuration for Low-Rank Adaptation (LoRA) fine-tuning.
|
|
337
|
-
*/
|
|
338
|
-
export interface LoraFinetuningConfig {
|
|
339
|
-
alpha: number;
|
|
340
|
-
|
|
341
|
-
apply_lora_to_mlp: boolean;
|
|
342
|
-
|
|
343
|
-
apply_lora_to_output: boolean;
|
|
344
|
-
|
|
345
|
-
lora_attn_modules: Array<string>;
|
|
346
|
-
|
|
347
|
-
rank: number;
|
|
348
|
-
|
|
349
|
-
quantize_base?: boolean | null;
|
|
350
|
-
|
|
351
|
-
type?: 'LoRA';
|
|
352
|
-
|
|
353
|
-
use_dora?: boolean | null;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* Configuration for Quantization-Aware Training (QAT) fine-tuning.
|
|
358
|
-
*/
|
|
359
|
-
export interface QatFinetuningConfig {
|
|
360
|
-
group_size: number;
|
|
361
|
-
|
|
362
|
-
quantizer_name: string;
|
|
363
|
-
|
|
364
|
-
type?: 'QAT';
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
PostTraining.Job = Job;
|
|
369
|
-
|
|
370
|
-
export declare namespace PostTraining {
|
|
371
|
-
export {
|
|
372
|
-
type AlgorithmConfig as AlgorithmConfig,
|
|
373
|
-
type ListPostTrainingJobsResponse as ListPostTrainingJobsResponse,
|
|
374
|
-
type PostTrainingJob as PostTrainingJob,
|
|
375
|
-
type PostTrainingPreferenceOptimizeParams as PostTrainingPreferenceOptimizeParams,
|
|
376
|
-
type PostTrainingSupervisedFineTuneParams as PostTrainingSupervisedFineTuneParams,
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
export {
|
|
380
|
-
Job as Job,
|
|
381
|
-
type JobListResponse as JobListResponse,
|
|
382
|
-
type JobArtifactsResponse as JobArtifactsResponse,
|
|
383
|
-
type JobStatusResponse as JobStatusResponse,
|
|
384
|
-
};
|
|
385
|
-
}
|
|
@@ -1,217 +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
|
-
|
|
13
|
-
export class ToolRuntime extends APIResource {
|
|
14
|
-
/**
|
|
15
|
-
* Run a tool with the given arguments.
|
|
16
|
-
*
|
|
17
|
-
* @deprecated
|
|
18
|
-
*/
|
|
19
|
-
invokeTool(
|
|
20
|
-
body: ToolRuntimeInvokeToolParams,
|
|
21
|
-
options?: Core.RequestOptions,
|
|
22
|
-
): Core.APIPromise<ToolInvocationResult> {
|
|
23
|
-
return this._client.post('/v1/tool-runtime/invoke', { body, ...options });
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* List all tools in the runtime.
|
|
28
|
-
*
|
|
29
|
-
* @deprecated
|
|
30
|
-
*/
|
|
31
|
-
listTools(
|
|
32
|
-
query?: ToolRuntimeListToolsParams,
|
|
33
|
-
options?: Core.RequestOptions,
|
|
34
|
-
): Core.APIPromise<ToolRuntimeListToolsResponse>;
|
|
35
|
-
listTools(options?: Core.RequestOptions): Core.APIPromise<ToolRuntimeListToolsResponse>;
|
|
36
|
-
listTools(
|
|
37
|
-
query: ToolRuntimeListToolsParams | Core.RequestOptions = {},
|
|
38
|
-
options?: Core.RequestOptions,
|
|
39
|
-
): Core.APIPromise<ToolRuntimeListToolsResponse> {
|
|
40
|
-
if (isRequestOptions(query)) {
|
|
41
|
-
return this.listTools({}, query);
|
|
42
|
-
}
|
|
43
|
-
return (
|
|
44
|
-
this._client.get('/v1/tool-runtime/list-tools', { query, ...options }) as Core.APIPromise<{
|
|
45
|
-
data: ToolRuntimeListToolsResponse;
|
|
46
|
-
}>
|
|
47
|
-
)._thenUnwrap((obj) => obj.data);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Tool definition used in runtime contexts.
|
|
53
|
-
*/
|
|
54
|
-
export interface ToolDef {
|
|
55
|
-
name: string;
|
|
56
|
-
|
|
57
|
-
description?: string | null;
|
|
58
|
-
|
|
59
|
-
input_schema?: { [key: string]: unknown } | null;
|
|
60
|
-
|
|
61
|
-
metadata?: { [key: string]: unknown } | null;
|
|
62
|
-
|
|
63
|
-
output_schema?: { [key: string]: unknown } | null;
|
|
64
|
-
|
|
65
|
-
toolgroup_id?: string | null;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Result of a tool invocation.
|
|
70
|
-
*/
|
|
71
|
-
export interface ToolInvocationResult {
|
|
72
|
-
/**
|
|
73
|
-
* A image content item
|
|
74
|
-
*/
|
|
75
|
-
content?:
|
|
76
|
-
| string
|
|
77
|
-
| ToolInvocationResult.ImageContentItemOutput
|
|
78
|
-
| ToolInvocationResult.TextContentItem
|
|
79
|
-
| Array<ToolInvocationResult.ImageContentItemOutput | ToolInvocationResult.TextContentItem>
|
|
80
|
-
| null;
|
|
81
|
-
|
|
82
|
-
error_code?: number | null;
|
|
83
|
-
|
|
84
|
-
error_message?: string | null;
|
|
85
|
-
|
|
86
|
-
metadata?: { [key: string]: unknown } | null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export namespace ToolInvocationResult {
|
|
90
|
-
/**
|
|
91
|
-
* A image content item
|
|
92
|
-
*/
|
|
93
|
-
export interface ImageContentItemOutput {
|
|
94
|
-
/**
|
|
95
|
-
* A URL or a base64 encoded string
|
|
96
|
-
*/
|
|
97
|
-
image: ImageContentItemOutput.Image;
|
|
98
|
-
|
|
99
|
-
type?: 'image';
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export namespace ImageContentItemOutput {
|
|
103
|
-
/**
|
|
104
|
-
* A URL or a base64 encoded string
|
|
105
|
-
*/
|
|
106
|
-
export interface Image {
|
|
107
|
-
data?: string | null;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* A URL reference to external content.
|
|
111
|
-
*/
|
|
112
|
-
url?: Image.URL | null;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export namespace Image {
|
|
116
|
-
/**
|
|
117
|
-
* A URL reference to external content.
|
|
118
|
-
*/
|
|
119
|
-
export interface URL {
|
|
120
|
-
uri: string;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* A text content item
|
|
127
|
-
*/
|
|
128
|
-
export interface TextContentItem {
|
|
129
|
-
text: string;
|
|
130
|
-
|
|
131
|
-
type?: 'text';
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* A image content item
|
|
136
|
-
*/
|
|
137
|
-
export interface ImageContentItemOutput {
|
|
138
|
-
/**
|
|
139
|
-
* A URL or a base64 encoded string
|
|
140
|
-
*/
|
|
141
|
-
image: ImageContentItemOutput.Image;
|
|
142
|
-
|
|
143
|
-
type?: 'image';
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export namespace ImageContentItemOutput {
|
|
147
|
-
/**
|
|
148
|
-
* A URL or a base64 encoded string
|
|
149
|
-
*/
|
|
150
|
-
export interface Image {
|
|
151
|
-
data?: string | null;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* A URL reference to external content.
|
|
155
|
-
*/
|
|
156
|
-
url?: Image.URL | null;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export namespace Image {
|
|
160
|
-
/**
|
|
161
|
-
* A URL reference to external content.
|
|
162
|
-
*/
|
|
163
|
-
export interface URL {
|
|
164
|
-
uri: string;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* A text content item
|
|
171
|
-
*/
|
|
172
|
-
export interface TextContentItem {
|
|
173
|
-
text: string;
|
|
174
|
-
|
|
175
|
-
type?: 'text';
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export type ToolRuntimeListToolsResponse = Array<ToolDef>;
|
|
180
|
-
|
|
181
|
-
export interface ToolRuntimeInvokeToolParams {
|
|
182
|
-
kwargs: { [key: string]: unknown };
|
|
183
|
-
|
|
184
|
-
tool_name: string;
|
|
185
|
-
|
|
186
|
-
authorization?: string | null;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export interface ToolRuntimeListToolsParams {
|
|
190
|
-
authorization?: string | null;
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* A URL reference to external content.
|
|
194
|
-
*/
|
|
195
|
-
mcp_endpoint?: ToolRuntimeListToolsParams.McpEndpoint | null;
|
|
196
|
-
|
|
197
|
-
tool_group_id?: string | null;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export namespace ToolRuntimeListToolsParams {
|
|
201
|
-
/**
|
|
202
|
-
* A URL reference to external content.
|
|
203
|
-
*/
|
|
204
|
-
export interface McpEndpoint {
|
|
205
|
-
uri: string;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export declare namespace ToolRuntime {
|
|
210
|
-
export {
|
|
211
|
-
type ToolDef as ToolDef,
|
|
212
|
-
type ToolInvocationResult as ToolInvocationResult,
|
|
213
|
-
type ToolRuntimeListToolsResponse as ToolRuntimeListToolsResponse,
|
|
214
|
-
type ToolRuntimeInvokeToolParams as ToolRuntimeInvokeToolParams,
|
|
215
|
-
type ToolRuntimeListToolsParams as ToolRuntimeListToolsParams,
|
|
216
|
-
};
|
|
217
|
-
}
|