@glexir/sdk 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +292 -2
- package/dist/client.d.ts +61 -0
- package/dist/client.js +245 -0
- package/dist/client.js.map +1 -0
- package/dist/core/api-promise.d.ts +31 -0
- package/dist/core/api-promise.js +39 -0
- package/dist/core/api-promise.js.map +1 -0
- package/dist/core/errors.d.ts +70 -0
- package/dist/core/errors.js +118 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/multipart.d.ts +16 -0
- package/dist/core/multipart.js +68 -0
- package/dist/core/multipart.js.map +1 -0
- package/dist/core/pagination.d.ts +41 -0
- package/dist/core/pagination.js +63 -0
- package/dist/core/pagination.js.map +1 -0
- package/dist/core/request-options.d.ts +29 -0
- package/dist/core/request-options.js +2 -0
- package/dist/core/request-options.js.map +1 -0
- package/dist/core/resource.d.ts +5 -0
- package/dist/core/resource.js +7 -0
- package/dist/core/resource.js.map +1 -0
- package/dist/core/retry.d.ts +13 -0
- package/dist/core/retry.js +65 -0
- package/dist/core/retry.js.map +1 -0
- package/dist/core/streaming.d.ts +44 -0
- package/dist/core/streaming.js +238 -0
- package/dist/core/streaming.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/chat-completion-stream.d.ts +26 -0
- package/dist/lib/chat-completion-stream.js +161 -0
- package/dist/lib/chat-completion-stream.js.map +1 -0
- package/dist/lib/output-text.d.ts +4 -0
- package/dist/lib/output-text.js +22 -0
- package/dist/lib/output-text.js.map +1 -0
- package/dist/lib/response-stream.d.ts +30 -0
- package/dist/lib/response-stream.js +122 -0
- package/dist/lib/response-stream.js.map +1 -0
- package/dist/lib/strict-schema.d.ts +11 -0
- package/dist/lib/strict-schema.js +116 -0
- package/dist/lib/strict-schema.js.map +1 -0
- package/dist/resources/audio.d.ts +46 -0
- package/dist/resources/audio.js +24 -0
- package/dist/resources/audio.js.map +1 -0
- package/dist/resources/batches.d.ts +20 -0
- package/dist/resources/batches.js +24 -0
- package/dist/resources/batches.js.map +1 -0
- package/dist/resources/chat.d.ts +63 -0
- package/dist/resources/chat.js +79 -0
- package/dist/resources/chat.js.map +1 -0
- package/dist/resources/conversations.d.ts +23 -0
- package/dist/resources/conversations.js +38 -0
- package/dist/resources/conversations.js.map +1 -0
- package/dist/resources/embeddings.d.ts +12 -0
- package/dist/resources/embeddings.js +34 -0
- package/dist/resources/embeddings.js.map +1 -0
- package/dist/resources/files.d.ts +15 -0
- package/dist/resources/files.js +27 -0
- package/dist/resources/files.js.map +1 -0
- package/dist/resources/models.d.ts +10 -0
- package/dist/resources/models.js +11 -0
- package/dist/resources/models.js.map +1 -0
- package/dist/resources/responses.d.ts +61 -0
- package/dist/resources/responses.js +85 -0
- package/dist/resources/responses.js.map +1 -0
- package/dist/types/audio.d.ts +172 -0
- package/dist/types/audio.js +2 -0
- package/dist/types/audio.js.map +1 -0
- package/dist/types/chat.d.ts +316 -0
- package/dist/types/chat.js +2 -0
- package/dist/types/chat.js.map +1 -0
- package/dist/types/conversations.d.ts +46 -0
- package/dist/types/conversations.js +2 -0
- package/dist/types/conversations.js.map +1 -0
- package/dist/types/platform.d.ts +151 -0
- package/dist/types/platform.js +2 -0
- package/dist/types/platform.js.map +1 -0
- package/dist/types/responses.d.ts +640 -0
- package/dist/types/responses.js +2 -0
- package/dist/types/responses.js.map +1 -0
- package/dist/types/shared.d.ts +108 -0
- package/dist/types/shared.js +2 -0
- package/dist/types/shared.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +37 -3
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import type { ChatModel, CustomToolInputFormat, ErrorObject, FunctionDefinition, Metadata, ModerationConfig, ModerationError, ModerationResults, PromptCacheBreakpoint, PromptCacheOptions, ReasoningEffort, ResponseFormatJSONObject, ResponseFormatJSONSchema, ResponseFormatText, ServiceTier, Verbosity } from './shared.js';
|
|
2
|
+
export interface ChatCompletionContentPartText {
|
|
3
|
+
type: 'text';
|
|
4
|
+
text: string;
|
|
5
|
+
prompt_cache_breakpoint?: PromptCacheBreakpoint;
|
|
6
|
+
}
|
|
7
|
+
/** Image input (vision): an http(s) URL or a `data:` URL. */
|
|
8
|
+
export interface ChatCompletionContentPartImage {
|
|
9
|
+
type: 'image_url';
|
|
10
|
+
image_url: {
|
|
11
|
+
url: string;
|
|
12
|
+
detail?: 'auto' | 'low' | 'high' | 'original';
|
|
13
|
+
};
|
|
14
|
+
prompt_cache_breakpoint?: PromptCacheBreakpoint;
|
|
15
|
+
}
|
|
16
|
+
/** File input such as a PDF, as base64 `file_data` or an uploaded `file_id`. */
|
|
17
|
+
export interface ChatCompletionContentPartFile {
|
|
18
|
+
type: 'file';
|
|
19
|
+
file: {
|
|
20
|
+
file_data?: string;
|
|
21
|
+
file_id?: string;
|
|
22
|
+
filename?: string;
|
|
23
|
+
};
|
|
24
|
+
prompt_cache_breakpoint?: PromptCacheBreakpoint;
|
|
25
|
+
}
|
|
26
|
+
export interface ChatCompletionContentPartRefusal {
|
|
27
|
+
type: 'refusal';
|
|
28
|
+
refusal: string;
|
|
29
|
+
}
|
|
30
|
+
export type ChatCompletionContentPart = ChatCompletionContentPartText | ChatCompletionContentPartImage | ChatCompletionContentPartFile;
|
|
31
|
+
export interface ChatCompletionDeveloperMessageParam {
|
|
32
|
+
role: 'developer';
|
|
33
|
+
content: string | ChatCompletionContentPartText[];
|
|
34
|
+
name?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ChatCompletionSystemMessageParam {
|
|
37
|
+
role: 'system';
|
|
38
|
+
content: string | ChatCompletionContentPartText[];
|
|
39
|
+
name?: string;
|
|
40
|
+
}
|
|
41
|
+
export interface ChatCompletionUserMessageParam {
|
|
42
|
+
role: 'user';
|
|
43
|
+
content: string | ChatCompletionContentPart[];
|
|
44
|
+
name?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ChatCompletionMessageFunctionToolCall {
|
|
47
|
+
id: string;
|
|
48
|
+
type: 'function';
|
|
49
|
+
function: {
|
|
50
|
+
name: string;
|
|
51
|
+
arguments: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface ChatCompletionMessageCustomToolCall {
|
|
55
|
+
id: string;
|
|
56
|
+
type: 'custom';
|
|
57
|
+
custom: {
|
|
58
|
+
name: string;
|
|
59
|
+
input: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export type ChatCompletionMessageToolCall = ChatCompletionMessageFunctionToolCall | ChatCompletionMessageCustomToolCall;
|
|
63
|
+
export interface ChatCompletionAssistantMessageParam {
|
|
64
|
+
role: 'assistant';
|
|
65
|
+
content?: string | Array<ChatCompletionContentPartText | ChatCompletionContentPartRefusal> | null;
|
|
66
|
+
name?: string;
|
|
67
|
+
refusal?: string | null;
|
|
68
|
+
tool_calls?: ChatCompletionMessageToolCall[];
|
|
69
|
+
}
|
|
70
|
+
export interface ChatCompletionToolMessageParam {
|
|
71
|
+
role: 'tool';
|
|
72
|
+
content: string | ChatCompletionContentPartText[];
|
|
73
|
+
tool_call_id: string;
|
|
74
|
+
}
|
|
75
|
+
export type ChatCompletionMessageParam = ChatCompletionDeveloperMessageParam | ChatCompletionSystemMessageParam | ChatCompletionUserMessageParam | ChatCompletionAssistantMessageParam | ChatCompletionToolMessageParam;
|
|
76
|
+
export interface ChatCompletionFunctionTool {
|
|
77
|
+
type: 'function';
|
|
78
|
+
function: FunctionDefinition;
|
|
79
|
+
}
|
|
80
|
+
export interface ChatCompletionCustomTool {
|
|
81
|
+
type: 'custom';
|
|
82
|
+
custom: {
|
|
83
|
+
name: string;
|
|
84
|
+
description?: string;
|
|
85
|
+
format?: ChatCustomToolFormat;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** Chat Completions nests the grammar under `grammar`, unlike the Responses API. */
|
|
89
|
+
export type ChatCustomToolFormat = {
|
|
90
|
+
type: 'text';
|
|
91
|
+
} | {
|
|
92
|
+
type: 'grammar';
|
|
93
|
+
grammar: {
|
|
94
|
+
definition: string;
|
|
95
|
+
syntax: 'lark' | 'regex';
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export type ChatCompletionTool = ChatCompletionFunctionTool | ChatCompletionCustomTool;
|
|
99
|
+
export type ChatCompletionToolChoiceOption = 'none' | 'auto' | 'required' | {
|
|
100
|
+
type: 'function';
|
|
101
|
+
function: {
|
|
102
|
+
name: string;
|
|
103
|
+
};
|
|
104
|
+
} | {
|
|
105
|
+
type: 'custom';
|
|
106
|
+
custom: {
|
|
107
|
+
name: string;
|
|
108
|
+
};
|
|
109
|
+
} | {
|
|
110
|
+
type: 'allowed_tools';
|
|
111
|
+
allowed_tools: {
|
|
112
|
+
mode: 'auto' | 'required';
|
|
113
|
+
tools: Array<Record<string, unknown>>;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
export interface ChatCompletionCreateParamsBase {
|
|
117
|
+
model: ChatModel;
|
|
118
|
+
messages: ChatCompletionMessageParam[];
|
|
119
|
+
/**
|
|
120
|
+
* Note: on GPT-5.4+ Chat Completions only supports tools with `reasoning_effort: "none"`,
|
|
121
|
+
* and gpt-6-astra / gpt-6.1-sol need the Responses API for tool calling.
|
|
122
|
+
*/
|
|
123
|
+
tools?: ChatCompletionTool[];
|
|
124
|
+
tool_choice?: ChatCompletionToolChoiceOption;
|
|
125
|
+
parallel_tool_calls?: boolean;
|
|
126
|
+
response_format?: ResponseFormatText | ResponseFormatJSONSchema | ResponseFormatJSONObject;
|
|
127
|
+
reasoning_effort?: ReasoningEffort | null;
|
|
128
|
+
verbosity?: Verbosity | null;
|
|
129
|
+
/** Upper bound on generated tokens, including reasoning tokens. */
|
|
130
|
+
max_completion_tokens?: number | null;
|
|
131
|
+
/** @deprecated Use `max_completion_tokens`; rejected by reasoning models. */
|
|
132
|
+
max_tokens?: number | null;
|
|
133
|
+
n?: number | null;
|
|
134
|
+
stop?: string | string[] | null;
|
|
135
|
+
temperature?: number | null;
|
|
136
|
+
top_p?: number | null;
|
|
137
|
+
frequency_penalty?: number | null;
|
|
138
|
+
presence_penalty?: number | null;
|
|
139
|
+
logit_bias?: Record<string, number> | null;
|
|
140
|
+
logprobs?: boolean | null;
|
|
141
|
+
top_logprobs?: number | null;
|
|
142
|
+
prediction?: {
|
|
143
|
+
type: 'content';
|
|
144
|
+
content: string | ChatCompletionContentPartText[];
|
|
145
|
+
} | null;
|
|
146
|
+
/** Store for later retrieval via the stored-completion endpoints. Glexir defaults this to `false`. */
|
|
147
|
+
store?: boolean | null;
|
|
148
|
+
metadata?: Metadata | null;
|
|
149
|
+
service_tier?: ServiceTier | null;
|
|
150
|
+
stream_options?: {
|
|
151
|
+
include_usage?: boolean;
|
|
152
|
+
include_obfuscation?: boolean;
|
|
153
|
+
} | null;
|
|
154
|
+
moderation?: ModerationConfig | null;
|
|
155
|
+
prompt_cache_key?: string | null;
|
|
156
|
+
prompt_cache_options?: PromptCacheOptions | null;
|
|
157
|
+
/** @deprecated Use `prompt_cache_options.ttl`. */
|
|
158
|
+
prompt_cache_retention?: 'in_memory' | '24h' | null;
|
|
159
|
+
/** Stable hashed end-user ID used for abuse detection. */
|
|
160
|
+
safety_identifier?: string | null;
|
|
161
|
+
/** @deprecated */
|
|
162
|
+
seed?: number | null;
|
|
163
|
+
/** @deprecated Use `safety_identifier` and `prompt_cache_key`. */
|
|
164
|
+
user?: string;
|
|
165
|
+
web_search_options?: Record<string, unknown>;
|
|
166
|
+
[key: string]: unknown;
|
|
167
|
+
}
|
|
168
|
+
export interface ChatCompletionCreateParamsNonStreaming extends ChatCompletionCreateParamsBase {
|
|
169
|
+
stream?: false | null;
|
|
170
|
+
}
|
|
171
|
+
export interface ChatCompletionCreateParamsStreaming extends ChatCompletionCreateParamsBase {
|
|
172
|
+
stream: true;
|
|
173
|
+
}
|
|
174
|
+
export type ChatCompletionCreateParams = ChatCompletionCreateParamsNonStreaming | ChatCompletionCreateParamsStreaming;
|
|
175
|
+
export interface ChatCompletionTokenLogprob {
|
|
176
|
+
token: string;
|
|
177
|
+
bytes: number[] | null;
|
|
178
|
+
logprob: number;
|
|
179
|
+
top_logprobs: Array<{
|
|
180
|
+
token: string;
|
|
181
|
+
bytes: number[] | null;
|
|
182
|
+
logprob: number;
|
|
183
|
+
}>;
|
|
184
|
+
}
|
|
185
|
+
export interface ChatCompletionMessage {
|
|
186
|
+
role: 'assistant';
|
|
187
|
+
content: string | null;
|
|
188
|
+
refusal: string | null;
|
|
189
|
+
tool_calls?: ChatCompletionMessageToolCall[];
|
|
190
|
+
annotations?: Array<{
|
|
191
|
+
type: 'url_citation';
|
|
192
|
+
url_citation: {
|
|
193
|
+
start_index: number;
|
|
194
|
+
end_index: number;
|
|
195
|
+
title: string;
|
|
196
|
+
url: string;
|
|
197
|
+
};
|
|
198
|
+
}>;
|
|
199
|
+
}
|
|
200
|
+
export type ChatCompletionFinishReason = 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call';
|
|
201
|
+
export interface CompletionUsage {
|
|
202
|
+
prompt_tokens: number;
|
|
203
|
+
completion_tokens: number;
|
|
204
|
+
total_tokens: number;
|
|
205
|
+
prompt_tokens_details?: {
|
|
206
|
+
cached_tokens?: number;
|
|
207
|
+
cache_write_tokens?: number;
|
|
208
|
+
image_tokens?: number;
|
|
209
|
+
text_tokens?: number;
|
|
210
|
+
audio_tokens?: number;
|
|
211
|
+
[key: string]: unknown;
|
|
212
|
+
};
|
|
213
|
+
completion_tokens_details?: {
|
|
214
|
+
reasoning_tokens?: number;
|
|
215
|
+
accepted_prediction_tokens?: number;
|
|
216
|
+
rejected_prediction_tokens?: number;
|
|
217
|
+
text_tokens?: number;
|
|
218
|
+
audio_tokens?: number;
|
|
219
|
+
[key: string]: unknown;
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
export interface ChatCompletionChoice {
|
|
223
|
+
index: number;
|
|
224
|
+
finish_reason: ChatCompletionFinishReason;
|
|
225
|
+
logprobs: {
|
|
226
|
+
content: ChatCompletionTokenLogprob[] | null;
|
|
227
|
+
refusal: ChatCompletionTokenLogprob[] | null;
|
|
228
|
+
} | null;
|
|
229
|
+
message: ChatCompletionMessage;
|
|
230
|
+
}
|
|
231
|
+
export interface ChatCompletion {
|
|
232
|
+
id: string;
|
|
233
|
+
object: 'chat.completion';
|
|
234
|
+
created: number;
|
|
235
|
+
model: string;
|
|
236
|
+
choices: ChatCompletionChoice[];
|
|
237
|
+
usage?: CompletionUsage;
|
|
238
|
+
/** The tier actually used to serve (and bill) this completion. */
|
|
239
|
+
service_tier?: ServiceTier | null;
|
|
240
|
+
metadata?: Metadata | null;
|
|
241
|
+
moderation?: {
|
|
242
|
+
input: ModerationResults | ModerationError;
|
|
243
|
+
output: ModerationResults | ModerationError;
|
|
244
|
+
} | null;
|
|
245
|
+
/** @deprecated */
|
|
246
|
+
system_fingerprint?: string;
|
|
247
|
+
_request_id?: string | null;
|
|
248
|
+
}
|
|
249
|
+
export interface ChatCompletionChunkToolCallDelta {
|
|
250
|
+
index: number;
|
|
251
|
+
id?: string;
|
|
252
|
+
type?: 'function' | 'custom';
|
|
253
|
+
function?: {
|
|
254
|
+
name?: string;
|
|
255
|
+
arguments?: string;
|
|
256
|
+
};
|
|
257
|
+
custom?: {
|
|
258
|
+
name?: string;
|
|
259
|
+
input?: string;
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
export interface ChatCompletionChunk {
|
|
263
|
+
id: string;
|
|
264
|
+
object: 'chat.completion.chunk';
|
|
265
|
+
created: number;
|
|
266
|
+
model: string;
|
|
267
|
+
choices: Array<{
|
|
268
|
+
index: number;
|
|
269
|
+
delta: {
|
|
270
|
+
role?: 'developer' | 'system' | 'user' | 'assistant' | 'tool';
|
|
271
|
+
content?: string | null;
|
|
272
|
+
refusal?: string | null;
|
|
273
|
+
tool_calls?: ChatCompletionChunkToolCallDelta[];
|
|
274
|
+
};
|
|
275
|
+
finish_reason: ChatCompletionFinishReason | null;
|
|
276
|
+
logprobs?: {
|
|
277
|
+
content: ChatCompletionTokenLogprob[] | null;
|
|
278
|
+
refusal: ChatCompletionTokenLogprob[] | null;
|
|
279
|
+
} | null;
|
|
280
|
+
}>;
|
|
281
|
+
/** Present only on the final chunk when `stream_options.include_usage` is set. */
|
|
282
|
+
usage?: CompletionUsage | null;
|
|
283
|
+
service_tier?: ServiceTier | null;
|
|
284
|
+
moderation?: Record<string, unknown> | null;
|
|
285
|
+
obfuscation?: string;
|
|
286
|
+
/** @deprecated */
|
|
287
|
+
system_fingerprint?: string;
|
|
288
|
+
error?: ErrorObject;
|
|
289
|
+
}
|
|
290
|
+
export interface ChatCompletionUpdateParams {
|
|
291
|
+
metadata: Metadata | null;
|
|
292
|
+
}
|
|
293
|
+
export interface ChatCompletionListParams {
|
|
294
|
+
after?: string;
|
|
295
|
+
limit?: number;
|
|
296
|
+
/** Filter by metadata key/value pairs. */
|
|
297
|
+
metadata?: Metadata | null;
|
|
298
|
+
model?: string;
|
|
299
|
+
/** Defaults to `asc`. */
|
|
300
|
+
order?: 'asc' | 'desc';
|
|
301
|
+
}
|
|
302
|
+
export interface ChatCompletionDeleted {
|
|
303
|
+
id: string;
|
|
304
|
+
deleted: boolean;
|
|
305
|
+
object: 'chat.completion.deleted';
|
|
306
|
+
}
|
|
307
|
+
export interface ChatCompletionStoreMessage extends ChatCompletionMessage {
|
|
308
|
+
id: string;
|
|
309
|
+
content_parts?: Array<ChatCompletionContentPartText | ChatCompletionContentPartImage> | null;
|
|
310
|
+
}
|
|
311
|
+
export interface MessageListParams {
|
|
312
|
+
after?: string;
|
|
313
|
+
limit?: number;
|
|
314
|
+
order?: 'asc' | 'desc';
|
|
315
|
+
}
|
|
316
|
+
export type { CustomToolInputFormat };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/types/chat.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Metadata } from './shared.js';
|
|
2
|
+
import type { ResponseIncludable, ResponseInputItem, ResponseItem } from './responses.js';
|
|
3
|
+
export interface Conversation {
|
|
4
|
+
id: string;
|
|
5
|
+
object: 'conversation';
|
|
6
|
+
created_at: number;
|
|
7
|
+
metadata: Metadata | null;
|
|
8
|
+
_request_id?: string | null;
|
|
9
|
+
}
|
|
10
|
+
export interface ConversationCreateParams {
|
|
11
|
+
/** Initial items, at most 20 per call. */
|
|
12
|
+
items?: ResponseInputItem[] | null;
|
|
13
|
+
metadata?: Metadata | null;
|
|
14
|
+
}
|
|
15
|
+
export interface ConversationUpdateParams {
|
|
16
|
+
metadata: Metadata | null;
|
|
17
|
+
}
|
|
18
|
+
export interface ConversationDeleted {
|
|
19
|
+
id: string;
|
|
20
|
+
deleted: boolean;
|
|
21
|
+
object: 'conversation.deleted';
|
|
22
|
+
}
|
|
23
|
+
/** Items persisted in a conversation. Conversation messages may also use a plain `text` content part. */
|
|
24
|
+
export type ConversationItem = ResponseItem;
|
|
25
|
+
export interface ConversationItemList {
|
|
26
|
+
object: 'list';
|
|
27
|
+
data: ConversationItem[];
|
|
28
|
+
first_id: string;
|
|
29
|
+
last_id: string;
|
|
30
|
+
has_more: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface ItemCreateParams {
|
|
33
|
+
/** At most 20 items per call. */
|
|
34
|
+
items: ResponseInputItem[];
|
|
35
|
+
include?: ResponseIncludable[];
|
|
36
|
+
}
|
|
37
|
+
export interface ItemListParams {
|
|
38
|
+
after?: string;
|
|
39
|
+
limit?: number;
|
|
40
|
+
/** Defaults to `desc`. */
|
|
41
|
+
order?: 'asc' | 'desc';
|
|
42
|
+
include?: ResponseIncludable[];
|
|
43
|
+
}
|
|
44
|
+
export interface ItemRetrieveParams {
|
|
45
|
+
include?: ResponseIncludable[];
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/types/conversations.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { Uploadable } from '../core/multipart.js';
|
|
2
|
+
import type { Metadata } from './shared.js';
|
|
3
|
+
export type EmbeddingModel = 'text-embedding-3-small' | 'text-embedding-3-large' | 'text-embedding-ada-002' | (string & {});
|
|
4
|
+
export interface EmbeddingCreateParams {
|
|
5
|
+
model: EmbeddingModel;
|
|
6
|
+
/** Each input ≤8192 tokens; arrays ≤2048 entries; ≤300,000 tokens per request. */
|
|
7
|
+
input: string | string[] | number[] | number[][];
|
|
8
|
+
/** Output size (text-embedding-3 models only). */
|
|
9
|
+
dimensions?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Omit to receive `number[]` vectors: the SDK requests compact base64 and decodes it.
|
|
12
|
+
* Pass `"base64"` to receive the raw base64 strings.
|
|
13
|
+
*/
|
|
14
|
+
encoding_format?: 'float' | 'base64';
|
|
15
|
+
user?: string;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface Embedding<TVector = number[]> {
|
|
19
|
+
object: 'embedding';
|
|
20
|
+
index: number;
|
|
21
|
+
embedding: TVector;
|
|
22
|
+
}
|
|
23
|
+
export interface CreateEmbeddingResponse<TVector = number[]> {
|
|
24
|
+
object: 'list';
|
|
25
|
+
data: Array<Embedding<TVector>>;
|
|
26
|
+
model: string;
|
|
27
|
+
usage: {
|
|
28
|
+
prompt_tokens: number;
|
|
29
|
+
total_tokens: number;
|
|
30
|
+
};
|
|
31
|
+
_request_id?: string | null;
|
|
32
|
+
}
|
|
33
|
+
/** `user_data` for model inputs (PDFs, images), `batch` for batch JSONL. */
|
|
34
|
+
export type FilePurpose = 'user_data' | 'batch' | 'vision' | 'assistants' | 'fine-tune' | 'evals' | (string & {});
|
|
35
|
+
export interface FileObject {
|
|
36
|
+
id: string;
|
|
37
|
+
object: 'file';
|
|
38
|
+
bytes: number;
|
|
39
|
+
created_at: number;
|
|
40
|
+
filename: string;
|
|
41
|
+
purpose: 'user_data' | 'batch' | 'batch_output' | 'vision' | 'assistants' | 'assistants_output' | 'fine-tune' | 'fine-tune-results' | (string & {});
|
|
42
|
+
expires_at?: number;
|
|
43
|
+
/** @deprecated */
|
|
44
|
+
status?: 'uploaded' | 'processed' | 'error';
|
|
45
|
+
/** @deprecated */
|
|
46
|
+
status_details?: string;
|
|
47
|
+
_request_id?: string | null;
|
|
48
|
+
}
|
|
49
|
+
export interface FileCreateParams {
|
|
50
|
+
/** At most 512 MB; batch input must be `.jsonl` and ≤200 MB. */
|
|
51
|
+
file: Uploadable;
|
|
52
|
+
purpose: FilePurpose;
|
|
53
|
+
/** Batch files expire after 30 days by default; others persist until deleted. */
|
|
54
|
+
expires_after?: {
|
|
55
|
+
anchor: 'created_at';
|
|
56
|
+
seconds: number;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface FileListParams {
|
|
60
|
+
after?: string;
|
|
61
|
+
limit?: number;
|
|
62
|
+
order?: 'asc' | 'desc';
|
|
63
|
+
purpose?: string;
|
|
64
|
+
}
|
|
65
|
+
export interface FileDeleted {
|
|
66
|
+
id: string;
|
|
67
|
+
deleted: boolean;
|
|
68
|
+
object: 'file';
|
|
69
|
+
}
|
|
70
|
+
/** Endpoints Glexir accepts in batch input files. */
|
|
71
|
+
export type BatchEndpoint = '/v1/responses' | '/v1/chat/completions' | '/v1/embeddings';
|
|
72
|
+
export interface BatchCreateParams {
|
|
73
|
+
/** A `.jsonl` file uploaded with purpose `batch`. One model per file, ≤50,000 requests. */
|
|
74
|
+
input_file_id: string;
|
|
75
|
+
endpoint: BatchEndpoint;
|
|
76
|
+
completion_window: '24h';
|
|
77
|
+
metadata?: Metadata | null;
|
|
78
|
+
output_expires_after?: {
|
|
79
|
+
anchor: 'created_at';
|
|
80
|
+
seconds: number;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export type BatchStatus = 'validating' | 'failed' | 'in_progress' | 'finalizing' | 'completed' | 'expired' | 'cancelling' | 'cancelled';
|
|
84
|
+
export interface Batch {
|
|
85
|
+
id: string;
|
|
86
|
+
object: 'batch';
|
|
87
|
+
endpoint: string;
|
|
88
|
+
input_file_id: string;
|
|
89
|
+
completion_window: string;
|
|
90
|
+
status: BatchStatus;
|
|
91
|
+
created_at: number;
|
|
92
|
+
output_file_id?: string;
|
|
93
|
+
error_file_id?: string;
|
|
94
|
+
errors?: {
|
|
95
|
+
object?: string;
|
|
96
|
+
data?: Array<{
|
|
97
|
+
code?: string;
|
|
98
|
+
line?: number | null;
|
|
99
|
+
message?: string;
|
|
100
|
+
param?: string | null;
|
|
101
|
+
}>;
|
|
102
|
+
};
|
|
103
|
+
request_counts?: {
|
|
104
|
+
total: number;
|
|
105
|
+
completed: number;
|
|
106
|
+
failed: number;
|
|
107
|
+
};
|
|
108
|
+
usage?: {
|
|
109
|
+
input_tokens: number;
|
|
110
|
+
input_tokens_details: {
|
|
111
|
+
cached_tokens: number;
|
|
112
|
+
};
|
|
113
|
+
output_tokens: number;
|
|
114
|
+
output_tokens_details: {
|
|
115
|
+
reasoning_tokens: number;
|
|
116
|
+
};
|
|
117
|
+
total_tokens: number;
|
|
118
|
+
};
|
|
119
|
+
model?: string;
|
|
120
|
+
metadata?: Metadata | null;
|
|
121
|
+
in_progress_at?: number;
|
|
122
|
+
finalizing_at?: number;
|
|
123
|
+
completed_at?: number;
|
|
124
|
+
failed_at?: number;
|
|
125
|
+
expired_at?: number;
|
|
126
|
+
expires_at?: number;
|
|
127
|
+
cancelling_at?: number;
|
|
128
|
+
cancelled_at?: number;
|
|
129
|
+
_request_id?: string | null;
|
|
130
|
+
}
|
|
131
|
+
export interface BatchListParams {
|
|
132
|
+
after?: string;
|
|
133
|
+
limit?: number;
|
|
134
|
+
}
|
|
135
|
+
/** One line of a batch input file. */
|
|
136
|
+
export interface BatchRequestLine<TBody = Record<string, unknown>> {
|
|
137
|
+
/** Unique within the file; output lines may come back in any order, so join on this. */
|
|
138
|
+
custom_id: string;
|
|
139
|
+
method: 'POST';
|
|
140
|
+
url: BatchEndpoint;
|
|
141
|
+
body: TBody;
|
|
142
|
+
}
|
|
143
|
+
export interface Model {
|
|
144
|
+
id: string;
|
|
145
|
+
object: 'model';
|
|
146
|
+
created: number;
|
|
147
|
+
owned_by: string;
|
|
148
|
+
/** Set when the model is scheduled to shut down. */
|
|
149
|
+
shutdown_date?: string | null;
|
|
150
|
+
_request_id?: string | null;
|
|
151
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../../src/types/platform.ts"],"names":[],"mappings":""}
|