llama-stack-client 0.4.4 → 0.4.5
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 +4 -4
- package/.github/workflows/release-doctor.yml +1 -1
- package/.release-please-manifest.json +1 -1
- package/.stats.yml +4 -4
- package/CHANGELOG.md +41 -0
- package/LICENSE +1 -1
- package/README.md +41 -27
- package/api.md +32 -25
- package/dist/CHANGELOG.md +41 -0
- package/dist/LICENSE +1 -1
- package/dist/README.md +41 -27
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +5 -0
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +5 -0
- package/dist/core.mjs.map +1 -1
- package/dist/index.d.mts +12 -6
- package/dist/index.d.ts +12 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +1 -1
- package/dist/resources/alpha/admin.d.ts +41 -0
- package/dist/resources/alpha/admin.d.ts.map +1 -0
- package/dist/resources/alpha/admin.js +46 -0
- package/dist/resources/alpha/admin.js.map +1 -0
- package/dist/resources/alpha/admin.mjs +42 -0
- package/dist/resources/alpha/admin.mjs.map +1 -0
- package/dist/resources/alpha/alpha.d.ts +8 -4
- package/dist/resources/alpha/alpha.d.ts.map +1 -1
- package/dist/resources/alpha/alpha.js +6 -2
- package/dist/resources/alpha/alpha.js.map +1 -1
- package/dist/resources/alpha/alpha.mjs +6 -2
- package/dist/resources/alpha/alpha.mjs.map +1 -1
- package/dist/resources/alpha/benchmarks.d.ts +37 -1
- package/dist/resources/alpha/benchmarks.d.ts.map +1 -1
- package/dist/resources/alpha/eval/eval.d.ts +28 -7
- package/dist/resources/alpha/eval/eval.d.ts.map +1 -1
- package/dist/resources/alpha/eval/eval.js.map +1 -1
- package/dist/resources/alpha/eval/eval.mjs.map +1 -1
- package/dist/resources/alpha/index.d.ts +2 -1
- package/dist/resources/alpha/index.d.ts.map +1 -1
- package/dist/resources/alpha/index.js +3 -1
- package/dist/resources/alpha/index.js.map +1 -1
- package/dist/resources/alpha/index.mjs +1 -0
- package/dist/resources/alpha/index.mjs.map +1 -1
- package/dist/resources/alpha/inference.d.ts +58 -7
- package/dist/resources/alpha/inference.d.ts.map +1 -1
- package/dist/resources/alpha/post-training/index.d.ts +2 -2
- package/dist/resources/alpha/post-training/index.d.ts.map +1 -1
- package/dist/resources/alpha/post-training/index.js.map +1 -1
- package/dist/resources/alpha/post-training/index.mjs +1 -1
- package/dist/resources/alpha/post-training/index.mjs.map +1 -1
- package/dist/resources/alpha/post-training/job.d.ts +4 -16
- package/dist/resources/alpha/post-training/job.d.ts.map +1 -1
- package/dist/resources/alpha/post-training/job.js +5 -6
- package/dist/resources/alpha/post-training/job.js.map +1 -1
- package/dist/resources/alpha/post-training/job.mjs +5 -6
- package/dist/resources/alpha/post-training/job.mjs.map +1 -1
- package/dist/resources/alpha/post-training/post-training.d.ts +38 -11
- package/dist/resources/alpha/post-training/post-training.d.ts.map +1 -1
- package/dist/resources/alpha/post-training/post-training.js.map +1 -1
- package/dist/resources/alpha/post-training/post-training.mjs +1 -1
- package/dist/resources/alpha/post-training/post-training.mjs.map +1 -1
- package/dist/resources/beta/datasets.d.ts +102 -8
- package/dist/resources/beta/datasets.d.ts.map +1 -1
- package/dist/resources/chat/chat.d.ts +119 -17
- 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 +1130 -73
- package/dist/resources/chat/completions.d.ts.map +1 -1
- package/dist/resources/chat/completions.js +0 -2
- package/dist/resources/chat/completions.js.map +1 -1
- package/dist/resources/chat/completions.mjs +0 -2
- package/dist/resources/chat/completions.mjs.map +1 -1
- package/dist/resources/completions.d.ts +135 -26
- package/dist/resources/completions.d.ts.map +1 -1
- package/dist/resources/completions.js.map +1 -1
- package/dist/resources/completions.mjs.map +1 -1
- package/dist/resources/conversations/conversations.d.ts +56 -12
- package/dist/resources/conversations/conversations.d.ts.map +1 -1
- package/dist/resources/conversations/conversations.js +0 -8
- package/dist/resources/conversations/conversations.js.map +1 -1
- package/dist/resources/conversations/conversations.mjs +0 -8
- package/dist/resources/conversations/conversations.mjs.map +1 -1
- package/dist/resources/conversations/items.d.ts +364 -81
- package/dist/resources/conversations/items.d.ts.map +1 -1
- package/dist/resources/conversations/items.js +0 -6
- package/dist/resources/conversations/items.js.map +1 -1
- package/dist/resources/conversations/items.mjs +0 -6
- package/dist/resources/conversations/items.mjs.map +1 -1
- package/dist/resources/embeddings.d.ts +46 -8
- package/dist/resources/embeddings.d.ts.map +1 -1
- package/dist/resources/embeddings.js +0 -2
- package/dist/resources/embeddings.js.map +1 -1
- package/dist/resources/embeddings.mjs +0 -2
- package/dist/resources/embeddings.mjs.map +1 -1
- package/dist/resources/files.d.ts +58 -31
- package/dist/resources/files.d.ts.map +1 -1
- package/dist/resources/files.js +4 -16
- package/dist/resources/files.js.map +1 -1
- package/dist/resources/files.mjs +4 -16
- package/dist/resources/files.mjs.map +1 -1
- package/dist/resources/index.d.ts +3 -3
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/index.js.map +1 -1
- package/dist/resources/index.mjs.map +1 -1
- package/dist/resources/inspect.d.ts +3 -45
- package/dist/resources/inspect.d.ts.map +1 -1
- package/dist/resources/inspect.js +0 -4
- package/dist/resources/inspect.js.map +1 -1
- package/dist/resources/inspect.mjs +0 -4
- package/dist/resources/inspect.mjs.map +1 -1
- package/dist/resources/models/models.d.ts +21 -6
- package/dist/resources/models/models.d.ts.map +1 -1
- package/dist/resources/models/models.js +0 -6
- package/dist/resources/models/models.js.map +1 -1
- package/dist/resources/models/models.mjs +0 -6
- package/dist/resources/models/models.mjs.map +1 -1
- package/dist/resources/moderations.d.ts +38 -5
- package/dist/resources/moderations.d.ts.map +1 -1
- package/dist/resources/moderations.js +1 -3
- package/dist/resources/moderations.js.map +1 -1
- package/dist/resources/moderations.mjs +1 -3
- package/dist/resources/moderations.mjs.map +1 -1
- package/dist/resources/prompts/prompts.d.ts +24 -10
- package/dist/resources/prompts/prompts.d.ts.map +1 -1
- package/dist/resources/prompts/prompts.js +2 -10
- package/dist/resources/prompts/prompts.js.map +1 -1
- package/dist/resources/prompts/prompts.mjs +2 -10
- package/dist/resources/prompts/prompts.mjs.map +1 -1
- package/dist/resources/prompts/versions.d.ts +0 -2
- package/dist/resources/prompts/versions.d.ts.map +1 -1
- package/dist/resources/prompts/versions.js +0 -2
- package/dist/resources/prompts/versions.js.map +1 -1
- package/dist/resources/prompts/versions.mjs +0 -2
- package/dist/resources/prompts/versions.mjs.map +1 -1
- package/dist/resources/providers.d.ts +5 -12
- package/dist/resources/providers.d.ts.map +1 -1
- package/dist/resources/providers.js +0 -4
- package/dist/resources/providers.js.map +1 -1
- package/dist/resources/providers.mjs +0 -4
- package/dist/resources/providers.mjs.map +1 -1
- package/dist/resources/responses/input-items.d.ts +108 -9
- package/dist/resources/responses/input-items.d.ts.map +1 -1
- package/dist/resources/responses/responses.d.ts +881 -124
- 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 +10 -9
- package/dist/resources/routes.d.ts.map +1 -1
- package/dist/resources/routes.js.map +1 -1
- package/dist/resources/routes.mjs.map +1 -1
- package/dist/resources/safety.d.ts +131 -9
- package/dist/resources/safety.d.ts.map +1 -1
- package/dist/resources/safety.js +1 -3
- package/dist/resources/safety.js.map +1 -1
- package/dist/resources/safety.mjs +1 -3
- package/dist/resources/safety.mjs.map +1 -1
- package/dist/resources/scoring-functions.d.ts +23 -1
- package/dist/resources/scoring-functions.d.ts.map +1 -1
- package/dist/resources/scoring.d.ts +24 -0
- package/dist/resources/scoring.d.ts.map +1 -1
- package/dist/resources/shared.d.ts +139 -7
- package/dist/resources/shared.d.ts.map +1 -1
- package/dist/resources/shields.d.ts +21 -0
- package/dist/resources/shields.d.ts.map +1 -1
- package/dist/resources/vector-io.d.ts +75 -58
- package/dist/resources/vector-io.d.ts.map +1 -1
- package/dist/resources/vector-io.js +1 -1
- package/dist/resources/vector-io.mjs +1 -1
- package/dist/resources/vector-stores/file-batches.d.ts +13 -7
- package/dist/resources/vector-stores/file-batches.d.ts.map +1 -1
- package/dist/resources/vector-stores/file-batches.js +3 -6
- package/dist/resources/vector-stores/file-batches.js.map +1 -1
- package/dist/resources/vector-stores/file-batches.mjs +3 -6
- package/dist/resources/vector-stores/file-batches.mjs.map +1 -1
- package/dist/resources/vector-stores/files.d.ts +31 -9
- package/dist/resources/vector-stores/files.d.ts.map +1 -1
- package/dist/resources/vector-stores/files.js +4 -4
- package/dist/resources/vector-stores/files.js.map +1 -1
- package/dist/resources/vector-stores/files.mjs +4 -4
- package/dist/resources/vector-stores/files.mjs.map +1 -1
- package/dist/resources/vector-stores/vector-stores.d.ts +87 -13
- package/dist/resources/vector-stores/vector-stores.d.ts.map +1 -1
- package/dist/resources/vector-stores/vector-stores.js +5 -10
- package/dist/resources/vector-stores/vector-stores.js.map +1 -1
- package/dist/resources/vector-stores/vector-stores.mjs +5 -10
- package/dist/resources/vector-stores/vector-stores.mjs.map +1 -1
- package/dist/src/core.ts +6 -0
- package/dist/src/index.ts +11 -16
- package/dist/src/resources/alpha/admin.ts +84 -0
- package/dist/src/resources/alpha/alpha.ts +16 -8
- package/dist/src/resources/alpha/benchmarks.ts +37 -1
- package/dist/src/resources/alpha/eval/eval.ts +28 -7
- package/dist/src/resources/alpha/index.ts +2 -0
- package/dist/src/resources/alpha/inference.ts +58 -7
- package/dist/src/resources/alpha/post-training/index.ts +2 -10
- package/dist/src/resources/alpha/post-training/job.ts +5 -26
- package/dist/src/resources/alpha/post-training/post-training.ts +38 -22
- package/dist/src/resources/beta/datasets.ts +103 -8
- package/dist/src/resources/chat/chat.ts +122 -20
- package/dist/src/resources/chat/completions.ts +1138 -79
- package/dist/src/resources/completions.ts +137 -28
- package/dist/src/resources/conversations/conversations.ts +67 -15
- package/dist/src/resources/conversations/items.ts +479 -110
- package/dist/src/resources/embeddings.ts +46 -8
- package/dist/src/resources/files.ts +58 -31
- package/dist/src/resources/index.ts +3 -3
- package/dist/src/resources/inspect.ts +3 -57
- package/dist/src/resources/models/models.ts +21 -6
- package/dist/src/resources/moderations.ts +38 -5
- package/dist/src/resources/prompts/prompts.ts +26 -12
- package/dist/src/resources/prompts/versions.ts +0 -2
- package/dist/src/resources/providers.ts +5 -16
- package/dist/src/resources/responses/input-items.ts +138 -15
- package/dist/src/resources/responses/responses.ts +1076 -196
- package/dist/src/resources/routes.ts +10 -14
- package/dist/src/resources/safety.ts +131 -8
- package/dist/src/resources/scoring-functions.ts +23 -1
- package/dist/src/resources/scoring.ts +24 -0
- package/dist/src/resources/shared.ts +148 -7
- package/dist/src/resources/shields.ts +21 -0
- package/dist/src/resources/vector-io.ts +95 -78
- package/dist/src/resources/vector-stores/file-batches.ts +13 -7
- package/dist/src/resources/vector-stores/files.ts +31 -11
- package/dist/src/resources/vector-stores/vector-stores.ts +89 -15
- package/dist/src/version.ts +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/src/core.ts +6 -0
- package/src/index.ts +11 -16
- package/src/resources/alpha/admin.ts +84 -0
- package/src/resources/alpha/alpha.ts +16 -8
- package/src/resources/alpha/benchmarks.ts +37 -1
- package/src/resources/alpha/eval/eval.ts +28 -7
- package/src/resources/alpha/index.ts +2 -0
- package/src/resources/alpha/inference.ts +58 -7
- package/src/resources/alpha/post-training/index.ts +2 -10
- package/src/resources/alpha/post-training/job.ts +5 -26
- package/src/resources/alpha/post-training/post-training.ts +38 -22
- package/src/resources/beta/datasets.ts +103 -8
- package/src/resources/chat/chat.ts +122 -20
- package/src/resources/chat/completions.ts +1138 -79
- package/src/resources/completions.ts +137 -28
- package/src/resources/conversations/conversations.ts +67 -15
- package/src/resources/conversations/items.ts +479 -110
- package/src/resources/embeddings.ts +46 -8
- package/src/resources/files.ts +58 -31
- package/src/resources/index.ts +3 -3
- package/src/resources/inspect.ts +3 -57
- package/src/resources/models/models.ts +21 -6
- package/src/resources/moderations.ts +38 -5
- package/src/resources/prompts/prompts.ts +26 -12
- package/src/resources/prompts/versions.ts +0 -2
- package/src/resources/providers.ts +5 -16
- package/src/resources/responses/input-items.ts +138 -15
- package/src/resources/responses/responses.ts +1076 -196
- package/src/resources/routes.ts +10 -14
- package/src/resources/safety.ts +131 -8
- package/src/resources/scoring-functions.ts +23 -1
- package/src/resources/scoring.ts +24 -0
- package/src/resources/shared.ts +148 -7
- package/src/resources/shields.ts +21 -0
- package/src/resources/vector-io.ts +95 -78
- package/src/resources/vector-stores/file-batches.ts +13 -7
- package/src/resources/vector-stores/files.ts +31 -11
- package/src/resources/vector-stores/vector-stores.ts +89 -15
- package/src/version.ts +1 -1
- package/tests/api-resources/alpha/admin.test.ts +111 -0
- package/tests/api-resources/alpha/eval/eval.test.ts +40 -20
- package/tests/api-resources/alpha/inference.test.ts +1 -1
- package/tests/api-resources/alpha/post-training/job.test.ts +21 -12
- package/tests/api-resources/alpha/post-training/post-training.test.ts +12 -2
- package/tests/api-resources/beta/datasets.test.ts +9 -3
- package/tests/api-resources/chat/completions.test.ts +20 -7
- package/tests/api-resources/completions.test.ts +5 -5
- package/tests/api-resources/conversations/items.test.ts +22 -3
- package/tests/api-resources/embeddings.test.ts +2 -2
- package/tests/api-resources/files.test.ts +6 -1
- package/tests/api-resources/responses/input-items.test.ts +7 -1
- package/tests/api-resources/responses/responses.test.ts +19 -5
- package/tests/api-resources/safety.test.ts +9 -5
- package/tests/api-resources/tool-runtime.test.ts +9 -2
- package/tests/api-resources/vector-io.test.ts +13 -4
- package/tests/api-resources/vector-stores/file-batches.test.ts +7 -1
- package/tests/api-resources/vector-stores/files.test.ts +7 -1
- package/tests/api-resources/vector-stores/vector-stores.test.ts +14 -2
|
@@ -11,8 +11,6 @@ import * as Core from '../core';
|
|
|
11
11
|
|
|
12
12
|
export class Embeddings extends APIResource {
|
|
13
13
|
/**
|
|
14
|
-
* Create embeddings.
|
|
15
|
-
*
|
|
16
14
|
* Generate OpenAI-compatible embeddings for the given input using the specified
|
|
17
15
|
* model.
|
|
18
16
|
*/
|
|
@@ -28,15 +26,24 @@ export class Embeddings extends APIResource {
|
|
|
28
26
|
* Response from an OpenAI-compatible embeddings request.
|
|
29
27
|
*/
|
|
30
28
|
export interface CreateEmbeddingsResponse {
|
|
29
|
+
/**
|
|
30
|
+
* List of embedding data objects.
|
|
31
|
+
*/
|
|
31
32
|
data: Array<CreateEmbeddingsResponse.Data>;
|
|
32
33
|
|
|
34
|
+
/**
|
|
35
|
+
* The model that was used to generate the embeddings.
|
|
36
|
+
*/
|
|
33
37
|
model: string;
|
|
34
38
|
|
|
35
39
|
/**
|
|
36
|
-
* Usage information
|
|
40
|
+
* Usage information.
|
|
37
41
|
*/
|
|
38
42
|
usage: CreateEmbeddingsResponse.Usage;
|
|
39
43
|
|
|
44
|
+
/**
|
|
45
|
+
* The object type.
|
|
46
|
+
*/
|
|
40
47
|
object?: 'list';
|
|
41
48
|
}
|
|
42
49
|
|
|
@@ -45,33 +52,64 @@ export namespace CreateEmbeddingsResponse {
|
|
|
45
52
|
* A single embedding data object from an OpenAI-compatible embeddings response.
|
|
46
53
|
*/
|
|
47
54
|
export interface Data {
|
|
55
|
+
/**
|
|
56
|
+
* The embedding vector as a list of floats (when encoding_format='float') or as a
|
|
57
|
+
* base64-encoded string.
|
|
58
|
+
*/
|
|
48
59
|
embedding: Array<number> | string;
|
|
49
60
|
|
|
61
|
+
/**
|
|
62
|
+
* The index of the embedding in the input list.
|
|
63
|
+
*/
|
|
50
64
|
index: number;
|
|
51
65
|
|
|
66
|
+
/**
|
|
67
|
+
* The object type.
|
|
68
|
+
*/
|
|
52
69
|
object?: 'embedding';
|
|
53
70
|
}
|
|
54
71
|
|
|
55
72
|
/**
|
|
56
|
-
* Usage information
|
|
73
|
+
* Usage information.
|
|
57
74
|
*/
|
|
58
75
|
export interface Usage {
|
|
76
|
+
/**
|
|
77
|
+
* The number of tokens in the input.
|
|
78
|
+
*/
|
|
59
79
|
prompt_tokens: number;
|
|
60
80
|
|
|
81
|
+
/**
|
|
82
|
+
* The total number of tokens used.
|
|
83
|
+
*/
|
|
61
84
|
total_tokens: number;
|
|
62
85
|
}
|
|
63
86
|
}
|
|
64
87
|
|
|
65
88
|
export interface EmbeddingCreateParams {
|
|
66
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Input text to embed, encoded as a string or array of tokens.
|
|
91
|
+
*/
|
|
92
|
+
input: string | Array<string> | Array<number> | Array<Array<number>>;
|
|
67
93
|
|
|
94
|
+
/**
|
|
95
|
+
* The identifier of the model to use.
|
|
96
|
+
*/
|
|
68
97
|
model: string;
|
|
69
98
|
|
|
70
|
-
|
|
99
|
+
/**
|
|
100
|
+
* The number of dimensions for output embeddings.
|
|
101
|
+
*/
|
|
102
|
+
dimensions?: number;
|
|
71
103
|
|
|
72
|
-
|
|
104
|
+
/**
|
|
105
|
+
* The format to return the embeddings in.
|
|
106
|
+
*/
|
|
107
|
+
encoding_format?: 'float' | 'base64';
|
|
73
108
|
|
|
74
|
-
|
|
109
|
+
/**
|
|
110
|
+
* A unique identifier representing your end-user.
|
|
111
|
+
*/
|
|
112
|
+
user?: string;
|
|
75
113
|
|
|
76
114
|
[k: string]: unknown;
|
|
77
115
|
}
|
package/src/resources/files.ts
CHANGED
|
@@ -13,33 +13,21 @@ import { OpenAICursorPage, type OpenAICursorPageParams } from '../pagination';
|
|
|
13
13
|
|
|
14
14
|
export class Files extends APIResource {
|
|
15
15
|
/**
|
|
16
|
-
* Upload file.
|
|
17
|
-
*
|
|
18
|
-
* Upload a file that can be used across various endpoints.
|
|
19
|
-
*
|
|
20
|
-
* The file upload should be a multipart form request with:
|
|
21
|
-
*
|
|
22
|
-
* - file: The File object (not file name) to be uploaded.
|
|
23
|
-
* - purpose: The intended purpose of the uploaded file.
|
|
24
|
-
* - expires_after: Optional form values describing expiration for the file.
|
|
16
|
+
* Upload a file.
|
|
25
17
|
*/
|
|
26
18
|
create(body: FileCreateParams, options?: Core.RequestOptions): Core.APIPromise<File> {
|
|
27
19
|
return this._client.post('/v1/files', Core.multipartFormRequestOptions({ body, ...options }));
|
|
28
20
|
}
|
|
29
21
|
|
|
30
22
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* Returns information about a specific file.
|
|
23
|
+
* Get file
|
|
34
24
|
*/
|
|
35
25
|
retrieve(fileId: string, options?: Core.RequestOptions): Core.APIPromise<File> {
|
|
36
26
|
return this._client.get(`/v1/files/${fileId}`, options);
|
|
37
27
|
}
|
|
38
28
|
|
|
39
29
|
/**
|
|
40
|
-
* List files
|
|
41
|
-
*
|
|
42
|
-
* Returns a list of files that belong to the user's organization.
|
|
30
|
+
* List files
|
|
43
31
|
*/
|
|
44
32
|
list(query?: FileListParams, options?: Core.RequestOptions): Core.PagePromise<FilesOpenAICursorPage, File>;
|
|
45
33
|
list(options?: Core.RequestOptions): Core.PagePromise<FilesOpenAICursorPage, File>;
|
|
@@ -54,16 +42,14 @@ export class Files extends APIResource {
|
|
|
54
42
|
}
|
|
55
43
|
|
|
56
44
|
/**
|
|
57
|
-
* Delete file
|
|
45
|
+
* Delete file
|
|
58
46
|
*/
|
|
59
47
|
delete(fileId: string, options?: Core.RequestOptions): Core.APIPromise<DeleteFileResponse> {
|
|
60
48
|
return this._client.delete(`/v1/files/${fileId}`, options);
|
|
61
49
|
}
|
|
62
50
|
|
|
63
51
|
/**
|
|
64
|
-
* Retrieve file content
|
|
65
|
-
*
|
|
66
|
-
* Returns the contents of the specified file.
|
|
52
|
+
* Retrieve file content
|
|
67
53
|
*/
|
|
68
54
|
content(fileId: string, options?: Core.RequestOptions): Core.APIPromise<unknown> {
|
|
69
55
|
return this._client.get(`/v1/files/${fileId}/content`, options);
|
|
@@ -76,10 +62,19 @@ export class FilesOpenAICursorPage extends OpenAICursorPage<File> {}
|
|
|
76
62
|
* Response for deleting a file in OpenAI Files API.
|
|
77
63
|
*/
|
|
78
64
|
export interface DeleteFileResponse {
|
|
65
|
+
/**
|
|
66
|
+
* The file identifier that was deleted.
|
|
67
|
+
*/
|
|
79
68
|
id: string;
|
|
80
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Whether the file was successfully deleted.
|
|
72
|
+
*/
|
|
81
73
|
deleted: boolean;
|
|
82
74
|
|
|
75
|
+
/**
|
|
76
|
+
* The object type, which is always 'file'.
|
|
77
|
+
*/
|
|
83
78
|
object?: 'file';
|
|
84
79
|
}
|
|
85
80
|
|
|
@@ -87,21 +82,39 @@ export interface DeleteFileResponse {
|
|
|
87
82
|
* OpenAI File object as defined in the OpenAI Files API.
|
|
88
83
|
*/
|
|
89
84
|
export interface File {
|
|
85
|
+
/**
|
|
86
|
+
* The file identifier, which can be referenced in the API endpoints.
|
|
87
|
+
*/
|
|
90
88
|
id: string;
|
|
91
89
|
|
|
90
|
+
/**
|
|
91
|
+
* The size of the file, in bytes.
|
|
92
|
+
*/
|
|
92
93
|
bytes: number;
|
|
93
94
|
|
|
95
|
+
/**
|
|
96
|
+
* The Unix timestamp (in seconds) for when the file was created.
|
|
97
|
+
*/
|
|
94
98
|
created_at: number;
|
|
95
99
|
|
|
100
|
+
/**
|
|
101
|
+
* The Unix timestamp (in seconds) for when the file expires.
|
|
102
|
+
*/
|
|
96
103
|
expires_at: number;
|
|
97
104
|
|
|
105
|
+
/**
|
|
106
|
+
* The name of the file.
|
|
107
|
+
*/
|
|
98
108
|
filename: string;
|
|
99
109
|
|
|
100
110
|
/**
|
|
101
|
-
*
|
|
111
|
+
* The intended purpose of the file.
|
|
102
112
|
*/
|
|
103
113
|
purpose: 'assistants' | 'batch';
|
|
104
114
|
|
|
115
|
+
/**
|
|
116
|
+
* The object type, which is always 'file'.
|
|
117
|
+
*/
|
|
105
118
|
object?: 'file';
|
|
106
119
|
}
|
|
107
120
|
|
|
@@ -109,34 +122,47 @@ export interface File {
|
|
|
109
122
|
* Response for listing files in OpenAI Files API.
|
|
110
123
|
*/
|
|
111
124
|
export interface ListFilesResponse {
|
|
125
|
+
/**
|
|
126
|
+
* The list of files.
|
|
127
|
+
*/
|
|
112
128
|
data: Array<File>;
|
|
113
129
|
|
|
130
|
+
/**
|
|
131
|
+
* The ID of the first file in the list for pagination.
|
|
132
|
+
*/
|
|
114
133
|
first_id: string;
|
|
115
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Whether there are more files available beyond this page.
|
|
137
|
+
*/
|
|
116
138
|
has_more: boolean;
|
|
117
139
|
|
|
140
|
+
/**
|
|
141
|
+
* The ID of the last file in the list for pagination.
|
|
142
|
+
*/
|
|
118
143
|
last_id: string;
|
|
119
144
|
|
|
145
|
+
/**
|
|
146
|
+
* The object type, which is always 'list'.
|
|
147
|
+
*/
|
|
120
148
|
object?: 'list';
|
|
121
149
|
}
|
|
122
150
|
|
|
123
151
|
export type FileContentResponse = unknown;
|
|
124
152
|
|
|
125
153
|
export interface FileCreateParams {
|
|
154
|
+
/**
|
|
155
|
+
* The file to upload.
|
|
156
|
+
*/
|
|
126
157
|
file: Core.Uploadable;
|
|
127
158
|
|
|
128
159
|
/**
|
|
129
|
-
*
|
|
160
|
+
* The intended purpose of the uploaded file.
|
|
130
161
|
*/
|
|
131
162
|
purpose: 'assistants' | 'batch';
|
|
132
163
|
|
|
133
164
|
/**
|
|
134
165
|
* Control expiration of uploaded files.
|
|
135
|
-
*
|
|
136
|
-
* Params:
|
|
137
|
-
*
|
|
138
|
-
* - anchor, must be "created_at"
|
|
139
|
-
* - seconds, must be int between 3600 and 2592000 (1 hour to 30 days)
|
|
140
166
|
*/
|
|
141
167
|
expires_after?: FileCreateParams.ExpiresAfter | null;
|
|
142
168
|
}
|
|
@@ -144,15 +170,16 @@ export interface FileCreateParams {
|
|
|
144
170
|
export namespace FileCreateParams {
|
|
145
171
|
/**
|
|
146
172
|
* Control expiration of uploaded files.
|
|
147
|
-
*
|
|
148
|
-
* Params:
|
|
149
|
-
*
|
|
150
|
-
* - anchor, must be "created_at"
|
|
151
|
-
* - seconds, must be int between 3600 and 2592000 (1 hour to 30 days)
|
|
152
173
|
*/
|
|
153
174
|
export interface ExpiresAfter {
|
|
175
|
+
/**
|
|
176
|
+
* The anchor point for expiration, must be 'created_at'.
|
|
177
|
+
*/
|
|
154
178
|
anchor: 'created_at';
|
|
155
179
|
|
|
180
|
+
/**
|
|
181
|
+
* Seconds until expiration, between 3600 (1 hour) and 2592000 (30 days).
|
|
182
|
+
*/
|
|
156
183
|
seconds: number;
|
|
157
184
|
}
|
|
158
185
|
}
|
package/src/resources/index.ts
CHANGED
|
@@ -45,7 +45,7 @@ export {
|
|
|
45
45
|
type FileCreateParams,
|
|
46
46
|
type FileListParams,
|
|
47
47
|
} from './files';
|
|
48
|
-
export { Inspect
|
|
48
|
+
export { Inspect } from './inspect';
|
|
49
49
|
export {
|
|
50
50
|
Models,
|
|
51
51
|
type ListModelsResponse,
|
|
@@ -66,7 +66,7 @@ export {
|
|
|
66
66
|
type PromptUpdateParams,
|
|
67
67
|
type PromptSetDefaultVersionParams,
|
|
68
68
|
} from './prompts/prompts';
|
|
69
|
-
export { Providers, type
|
|
69
|
+
export { Providers, type ProviderListResponse } from './providers';
|
|
70
70
|
export {
|
|
71
71
|
ResponseListResponsesOpenAICursorPage,
|
|
72
72
|
Responses,
|
|
@@ -79,7 +79,7 @@ export {
|
|
|
79
79
|
type ResponseCreateParamsStreaming,
|
|
80
80
|
type ResponseListParams,
|
|
81
81
|
} from './responses/responses';
|
|
82
|
-
export { Routes, type
|
|
82
|
+
export { Routes, type RouteListResponse, type RouteListParams } from './routes';
|
|
83
83
|
export { Safety, type RunShieldResponse, type SafetyRunShieldParams } from './safety';
|
|
84
84
|
export {
|
|
85
85
|
Scoring,
|
package/src/resources/inspect.ts
CHANGED
|
@@ -8,74 +8,20 @@
|
|
|
8
8
|
|
|
9
9
|
import { APIResource } from '../resource';
|
|
10
10
|
import * as Core from '../core';
|
|
11
|
+
import * as Shared from './shared';
|
|
11
12
|
|
|
12
13
|
export class Inspect extends APIResource {
|
|
13
14
|
/**
|
|
14
|
-
* Get health status.
|
|
15
|
-
*
|
|
16
15
|
* Get the current health status of the service.
|
|
17
16
|
*/
|
|
18
|
-
health(options?: Core.RequestOptions): Core.APIPromise<HealthInfo> {
|
|
17
|
+
health(options?: Core.RequestOptions): Core.APIPromise<Shared.HealthInfo> {
|
|
19
18
|
return this._client.get('/v1/health', options);
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
|
-
* Get version.
|
|
24
|
-
*
|
|
25
22
|
* Get the version of the service.
|
|
26
23
|
*/
|
|
27
|
-
version(options?: Core.RequestOptions): Core.APIPromise<VersionInfo> {
|
|
24
|
+
version(options?: Core.RequestOptions): Core.APIPromise<Shared.VersionInfo> {
|
|
28
25
|
return this._client.get('/v1/version', options);
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Health status information for the service.
|
|
34
|
-
*/
|
|
35
|
-
export interface HealthInfo {
|
|
36
|
-
status: 'OK' | 'Error' | 'Not Implemented';
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Information about a registered provider including its configuration and health
|
|
41
|
-
* status.
|
|
42
|
-
*/
|
|
43
|
-
export interface ProviderInfo {
|
|
44
|
-
api: string;
|
|
45
|
-
|
|
46
|
-
config: { [key: string]: unknown };
|
|
47
|
-
|
|
48
|
-
health: { [key: string]: unknown };
|
|
49
|
-
|
|
50
|
-
provider_id: string;
|
|
51
|
-
|
|
52
|
-
provider_type: string;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Information about an API route including its path, method, and implementing
|
|
57
|
-
* providers.
|
|
58
|
-
*/
|
|
59
|
-
export interface RouteInfo {
|
|
60
|
-
method: string;
|
|
61
|
-
|
|
62
|
-
provider_types: Array<string>;
|
|
63
|
-
|
|
64
|
-
route: string;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Version information for the service.
|
|
69
|
-
*/
|
|
70
|
-
export interface VersionInfo {
|
|
71
|
-
version: string;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export declare namespace Inspect {
|
|
75
|
-
export {
|
|
76
|
-
type HealthInfo as HealthInfo,
|
|
77
|
-
type ProviderInfo as ProviderInfo,
|
|
78
|
-
type RouteInfo as RouteInfo,
|
|
79
|
-
type VersionInfo as VersionInfo,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
@@ -15,8 +15,6 @@ export class Models extends APIResource {
|
|
|
15
15
|
openai: OpenAIAPI.OpenAI = new OpenAIAPI.OpenAI(this._client);
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Get model.
|
|
19
|
-
*
|
|
20
18
|
* Get a model by its identifier.
|
|
21
19
|
*/
|
|
22
20
|
retrieve(modelId: string, options?: Core.RequestOptions): Core.APIPromise<ModelRetrieveResponse> {
|
|
@@ -33,8 +31,6 @@ export class Models extends APIResource {
|
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
/**
|
|
36
|
-
* Register model.
|
|
37
|
-
*
|
|
38
34
|
* Register a model.
|
|
39
35
|
*
|
|
40
36
|
* @deprecated
|
|
@@ -44,8 +40,6 @@ export class Models extends APIResource {
|
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
/**
|
|
47
|
-
* Unregister model.
|
|
48
|
-
*
|
|
49
43
|
* Unregister a model.
|
|
50
44
|
*
|
|
51
45
|
* @deprecated
|
|
@@ -58,7 +52,13 @@ export class Models extends APIResource {
|
|
|
58
52
|
}
|
|
59
53
|
}
|
|
60
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Response containing a list of OpenAI model objects.
|
|
57
|
+
*/
|
|
61
58
|
export interface ListModelsResponse {
|
|
59
|
+
/**
|
|
60
|
+
* List of OpenAI model objects.
|
|
61
|
+
*/
|
|
62
62
|
data: ModelListResponse;
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -114,6 +114,9 @@ export interface ModelRetrieveResponse {
|
|
|
114
114
|
type?: 'model';
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/**
|
|
118
|
+
* List of OpenAI model objects.
|
|
119
|
+
*/
|
|
117
120
|
export type ModelListResponse = Array<Model>;
|
|
118
121
|
|
|
119
122
|
/**
|
|
@@ -149,8 +152,14 @@ export interface ModelRegisterResponse {
|
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
export interface ModelRegisterParams {
|
|
155
|
+
/**
|
|
156
|
+
* The identifier of the model to register.
|
|
157
|
+
*/
|
|
152
158
|
model_id: string;
|
|
153
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Any additional metadata for this model.
|
|
162
|
+
*/
|
|
154
163
|
metadata?: { [key: string]: unknown } | null;
|
|
155
164
|
|
|
156
165
|
/**
|
|
@@ -158,8 +167,14 @@ export interface ModelRegisterParams {
|
|
|
158
167
|
*/
|
|
159
168
|
model_type?: 'llm' | 'embedding' | 'rerank' | null;
|
|
160
169
|
|
|
170
|
+
/**
|
|
171
|
+
* The identifier of the provider.
|
|
172
|
+
*/
|
|
161
173
|
provider_id?: string | null;
|
|
162
174
|
|
|
175
|
+
/**
|
|
176
|
+
* The identifier of the model in the provider.
|
|
177
|
+
*/
|
|
163
178
|
provider_model_id?: string | null;
|
|
164
179
|
}
|
|
165
180
|
|
|
@@ -11,9 +11,7 @@ import * as Core from '../core';
|
|
|
11
11
|
|
|
12
12
|
export class Moderations extends APIResource {
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* Classifies if text and/or image inputs are potentially harmful.
|
|
14
|
+
* Classifies if text inputs are potentially harmful. OpenAI-compatible endpoint.
|
|
17
15
|
*/
|
|
18
16
|
create(body: ModerationCreateParams, options?: Core.RequestOptions): Core.APIPromise<CreateResponse> {
|
|
19
17
|
return this._client.post('/v1/moderations', { body, ...options });
|
|
@@ -21,38 +19,73 @@ export class Moderations extends APIResource {
|
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
/**
|
|
24
|
-
* A moderation object.
|
|
22
|
+
* A moderation object containing the results of content classification.
|
|
25
23
|
*/
|
|
26
24
|
export interface CreateResponse {
|
|
25
|
+
/**
|
|
26
|
+
* The unique identifier for the moderation request
|
|
27
|
+
*/
|
|
27
28
|
id: string;
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* The model used to generate the moderation results
|
|
32
|
+
*/
|
|
29
33
|
model: string;
|
|
30
34
|
|
|
35
|
+
/**
|
|
36
|
+
* A list of moderation result objects
|
|
37
|
+
*/
|
|
31
38
|
results: Array<CreateResponse.Result>;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
export namespace CreateResponse {
|
|
35
42
|
/**
|
|
36
|
-
* A moderation object.
|
|
43
|
+
* A moderation result object containing flagged status and category information.
|
|
37
44
|
*/
|
|
38
45
|
export interface Result {
|
|
46
|
+
/**
|
|
47
|
+
* Whether any of the below categories are flagged
|
|
48
|
+
*/
|
|
39
49
|
flagged: boolean;
|
|
40
50
|
|
|
51
|
+
/**
|
|
52
|
+
* A dictionary of the categories, and whether they are flagged or not
|
|
53
|
+
*/
|
|
41
54
|
categories?: { [key: string]: boolean } | null;
|
|
42
55
|
|
|
56
|
+
/**
|
|
57
|
+
* A dictionary of the categories along with the input type(s) that the score
|
|
58
|
+
* applies to
|
|
59
|
+
*/
|
|
43
60
|
category_applied_input_types?: { [key: string]: Array<string> } | null;
|
|
44
61
|
|
|
62
|
+
/**
|
|
63
|
+
* A dictionary of the categories along with their scores as predicted by model
|
|
64
|
+
*/
|
|
45
65
|
category_scores?: { [key: string]: number } | null;
|
|
46
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Additional metadata about the moderation
|
|
69
|
+
*/
|
|
47
70
|
metadata?: { [key: string]: unknown };
|
|
48
71
|
|
|
72
|
+
/**
|
|
73
|
+
* A message to convey to the user about the moderation result
|
|
74
|
+
*/
|
|
49
75
|
user_message?: string | null;
|
|
50
76
|
}
|
|
51
77
|
}
|
|
52
78
|
|
|
53
79
|
export interface ModerationCreateParams {
|
|
80
|
+
/**
|
|
81
|
+
* Input (or inputs) to classify. Can be a single string or an array of strings.
|
|
82
|
+
*/
|
|
54
83
|
input: string | Array<string>;
|
|
55
84
|
|
|
85
|
+
/**
|
|
86
|
+
* The content moderation model to use. If not specified, the default shield will
|
|
87
|
+
* be used.
|
|
88
|
+
*/
|
|
56
89
|
model?: string | null;
|
|
57
90
|
}
|
|
58
91
|
|
|
@@ -16,8 +16,6 @@ export class Prompts extends APIResource {
|
|
|
16
16
|
versions: VersionsAPI.Versions = new VersionsAPI.Versions(this._client);
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* Create prompt.
|
|
20
|
-
*
|
|
21
19
|
* Create a new prompt.
|
|
22
20
|
*/
|
|
23
21
|
create(body: PromptCreateParams, options?: Core.RequestOptions): Core.APIPromise<Prompt> {
|
|
@@ -25,8 +23,6 @@ export class Prompts extends APIResource {
|
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
/**
|
|
28
|
-
* Get prompt.
|
|
29
|
-
*
|
|
30
26
|
* Get a prompt by its identifier and optional version.
|
|
31
27
|
*/
|
|
32
28
|
retrieve(
|
|
@@ -47,12 +43,10 @@ export class Prompts extends APIResource {
|
|
|
47
43
|
}
|
|
48
44
|
|
|
49
45
|
/**
|
|
50
|
-
* Update prompt.
|
|
51
|
-
*
|
|
52
46
|
* Update an existing prompt (increments version).
|
|
53
47
|
*/
|
|
54
48
|
update(promptId: string, body: PromptUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Prompt> {
|
|
55
|
-
return this._client.
|
|
49
|
+
return this._client.put(`/v1/prompts/${promptId}`, { body, ...options });
|
|
56
50
|
}
|
|
57
51
|
|
|
58
52
|
/**
|
|
@@ -65,8 +59,6 @@ export class Prompts extends APIResource {
|
|
|
65
59
|
}
|
|
66
60
|
|
|
67
61
|
/**
|
|
68
|
-
* Delete prompt.
|
|
69
|
-
*
|
|
70
62
|
* Delete a prompt.
|
|
71
63
|
*/
|
|
72
64
|
delete(promptId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
@@ -77,8 +69,6 @@ export class Prompts extends APIResource {
|
|
|
77
69
|
}
|
|
78
70
|
|
|
79
71
|
/**
|
|
80
|
-
* Set prompt version.
|
|
81
|
-
*
|
|
82
72
|
* Set which version of a prompt should be the default in get_prompt (latest).
|
|
83
73
|
*/
|
|
84
74
|
setDefaultVersion(
|
|
@@ -86,7 +76,7 @@ export class Prompts extends APIResource {
|
|
|
86
76
|
body: PromptSetDefaultVersionParams,
|
|
87
77
|
options?: Core.RequestOptions,
|
|
88
78
|
): Core.APIPromise<Prompt> {
|
|
89
|
-
return this._client.
|
|
79
|
+
return this._client.put(`/v1/prompts/${promptId}/set-default-version`, { body, ...options });
|
|
90
80
|
}
|
|
91
81
|
}
|
|
92
82
|
|
|
@@ -131,26 +121,50 @@ export interface Prompt {
|
|
|
131
121
|
export type PromptListResponse = Array<Prompt>;
|
|
132
122
|
|
|
133
123
|
export interface PromptCreateParams {
|
|
124
|
+
/**
|
|
125
|
+
* The prompt text content with variable placeholders.
|
|
126
|
+
*/
|
|
134
127
|
prompt: string;
|
|
135
128
|
|
|
129
|
+
/**
|
|
130
|
+
* List of variable names that can be used in the prompt template.
|
|
131
|
+
*/
|
|
136
132
|
variables?: Array<string> | null;
|
|
137
133
|
}
|
|
138
134
|
|
|
139
135
|
export interface PromptRetrieveParams {
|
|
136
|
+
/**
|
|
137
|
+
* The version of the prompt to get (defaults to latest).
|
|
138
|
+
*/
|
|
140
139
|
version?: number | null;
|
|
141
140
|
}
|
|
142
141
|
|
|
143
142
|
export interface PromptUpdateParams {
|
|
143
|
+
/**
|
|
144
|
+
* The updated prompt text content.
|
|
145
|
+
*/
|
|
144
146
|
prompt: string;
|
|
145
147
|
|
|
148
|
+
/**
|
|
149
|
+
* The current version of the prompt being updated.
|
|
150
|
+
*/
|
|
146
151
|
version: number;
|
|
147
152
|
|
|
153
|
+
/**
|
|
154
|
+
* Set the new version as the default (default=True).
|
|
155
|
+
*/
|
|
148
156
|
set_as_default?: boolean;
|
|
149
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Updated list of variable names that can be used in the prompt template.
|
|
160
|
+
*/
|
|
150
161
|
variables?: Array<string> | null;
|
|
151
162
|
}
|
|
152
163
|
|
|
153
164
|
export interface PromptSetDefaultVersionParams {
|
|
165
|
+
/**
|
|
166
|
+
* The version to set as default.
|
|
167
|
+
*/
|
|
154
168
|
version: number;
|
|
155
169
|
}
|
|
156
170
|
|
|
@@ -12,8 +12,6 @@ import * as PromptsAPI from './prompts';
|
|
|
12
12
|
|
|
13
13
|
export class Versions extends APIResource {
|
|
14
14
|
/**
|
|
15
|
-
* List prompt versions.
|
|
16
|
-
*
|
|
17
15
|
* List all versions of a specific prompt.
|
|
18
16
|
*/
|
|
19
17
|
list(promptId: string, options?: Core.RequestOptions): Core.APIPromise<PromptsAPI.PromptListResponse> {
|