@memberjunction/ai 3.3.0 → 4.0.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/dist/generic/apiKeyDictionary.d.ts +22 -0
- package/dist/generic/apiKeyDictionary.d.ts.map +1 -1
- package/dist/generic/apiKeyDictionary.js +20 -13
- package/dist/generic/apiKeyDictionary.js.map +1 -1
- package/dist/generic/baseAudio.d.ts +107 -2
- package/dist/generic/baseAudio.d.ts.map +1 -1
- package/dist/generic/baseAudio.js +26 -20
- package/dist/generic/baseAudio.js.map +1 -1
- package/dist/generic/baseDiffusion.d.ts +5 -1
- package/dist/generic/baseDiffusion.d.ts.map +1 -1
- package/dist/generic/baseDiffusion.js +5 -17
- package/dist/generic/baseDiffusion.js.map +1 -1
- package/dist/generic/baseEmbeddings.d.ts +25 -2
- package/dist/generic/baseEmbeddings.d.ts.map +1 -1
- package/dist/generic/baseEmbeddings.js +26 -8
- package/dist/generic/baseEmbeddings.js.map +1 -1
- package/dist/generic/baseImage.d.ts +262 -2
- package/dist/generic/baseImage.d.ts.map +1 -1
- package/dist/generic/baseImage.js +83 -20
- package/dist/generic/baseImage.js.map +1 -1
- package/dist/generic/baseLLM.d.ts +100 -4
- package/dist/generic/baseLLM.d.ts.map +1 -1
- package/dist/generic/baseLLM.js +122 -14
- package/dist/generic/baseLLM.js.map +1 -1
- package/dist/generic/baseModel.d.ts +91 -0
- package/dist/generic/baseModel.d.ts.map +1 -1
- package/dist/generic/baseModel.js +37 -11
- package/dist/generic/baseModel.js.map +1 -1
- package/dist/generic/baseReranker.d.ts +81 -2
- package/dist/generic/baseReranker.d.ts.map +1 -1
- package/dist/generic/baseReranker.js +73 -6
- package/dist/generic/baseReranker.js.map +1 -1
- package/dist/generic/baseVideo.d.ts +24 -1
- package/dist/generic/baseVideo.d.ts.map +1 -1
- package/dist/generic/baseVideo.js +11 -14
- package/dist/generic/baseVideo.js.map +1 -1
- package/dist/generic/chat.types.d.ts +291 -2
- package/dist/generic/chat.types.d.ts.map +1 -1
- package/dist/generic/chat.types.js +105 -32
- package/dist/generic/chat.types.js.map +1 -1
- package/dist/generic/classify.types.d.ts +5 -2
- package/dist/generic/classify.types.d.ts.map +1 -1
- package/dist/generic/classify.types.js +8 -11
- package/dist/generic/classify.types.js.map +1 -1
- package/dist/generic/embed.types.d.ts +1 -1
- package/dist/generic/embed.types.js +1 -2
- package/dist/generic/errorAnalyzer.d.ts +94 -0
- package/dist/generic/errorAnalyzer.d.ts.map +1 -1
- package/dist/generic/errorAnalyzer.js +160 -28
- package/dist/generic/errorAnalyzer.js.map +1 -1
- package/dist/generic/errorTypes.d.ts +116 -0
- package/dist/generic/errorTypes.d.ts.map +1 -1
- package/dist/generic/errorTypes.js +1 -2
- package/dist/generic/reranker.types.d.ts +74 -0
- package/dist/generic/reranker.types.d.ts.map +1 -1
- package/dist/generic/reranker.types.js +10 -2
- package/dist/generic/reranker.types.js.map +1 -1
- package/dist/generic/summarize.types.d.ts +5 -2
- package/dist/generic/summarize.types.d.ts.map +1 -1
- package/dist/generic/summarize.types.js +8 -9
- package/dist/generic/summarize.types.js.map +1 -1
- package/dist/index.d.ts +15 -15
- package/dist/index.js +15 -31
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
|
@@ -1,102 +1,391 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { BaseParams, BaseResult, ModelUsage } from "./baseModel.js";
|
|
2
|
+
/**
|
|
3
|
+
* The possible roles for a chat message.
|
|
4
|
+
*/
|
|
3
5
|
export declare const ChatMessageRole: {
|
|
4
6
|
readonly system: "system";
|
|
5
7
|
readonly user: "user";
|
|
6
8
|
readonly assistant: "assistant";
|
|
7
9
|
};
|
|
8
10
|
export type ChatMessageRole = typeof ChatMessageRole[keyof typeof ChatMessageRole];
|
|
11
|
+
/**
|
|
12
|
+
* Defines the shape of a content block in a chat message.
|
|
13
|
+
* This can be used to represent different types of content in a message.
|
|
14
|
+
*/
|
|
9
15
|
export type ChatMessageContentBlock = {
|
|
16
|
+
/**
|
|
17
|
+
* The type of content block.
|
|
18
|
+
* Can be 'text', 'image_url', 'video_url', 'audio_url', or 'file_url'.
|
|
19
|
+
*/
|
|
10
20
|
type: 'text' | 'image_url' | 'video_url' | 'audio_url' | 'file_url';
|
|
21
|
+
/**
|
|
22
|
+
* The content of the block.
|
|
23
|
+
* This can be a string. In the case of 'image_url', 'video_url', 'audio_url', or 'file_url', it should be a URL to the resource, OR it can be a base64 encoded string.
|
|
24
|
+
* representing the content of the item. For base64 images, use the data URL format: data:image/png;base64,<data>
|
|
25
|
+
*/
|
|
11
26
|
content: string;
|
|
27
|
+
/**
|
|
28
|
+
* Optional MIME type for media content (e.g., 'image/png', 'image/jpeg', 'audio/mp3').
|
|
29
|
+
* When content is a data URL, this can be extracted from the URL. When content is raw base64, this field is required.
|
|
30
|
+
*/
|
|
12
31
|
mimeType?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Optional original filename if the content was uploaded from a file.
|
|
34
|
+
*/
|
|
13
35
|
fileName?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Optional file size in bytes.
|
|
38
|
+
*/
|
|
14
39
|
fileSize?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Optional width in pixels (for images and videos).
|
|
42
|
+
*/
|
|
15
43
|
width?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Optional height in pixels (for images and videos).
|
|
46
|
+
*/
|
|
16
47
|
height?: number;
|
|
17
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* Union type for the content of a chat message.
|
|
51
|
+
*/
|
|
18
52
|
export type ChatMessageContent = string | ChatMessageContentBlock[];
|
|
53
|
+
/**
|
|
54
|
+
* Defines the shape of an individual chat message.
|
|
55
|
+
*
|
|
56
|
+
* @template M - Optional metadata type. Use this to attach typed metadata to messages
|
|
57
|
+
* without coupling the core ChatMessage type to specific implementations.
|
|
58
|
+
*/
|
|
19
59
|
export type ChatMessage<M = any> = {
|
|
60
|
+
/**
|
|
61
|
+
* Role of the message in the conversation.
|
|
62
|
+
*/
|
|
20
63
|
role: ChatMessageRole;
|
|
64
|
+
/**
|
|
65
|
+
* Content of the message, can be any string or an array of content blocks.
|
|
66
|
+
*/
|
|
21
67
|
content: ChatMessageContent;
|
|
68
|
+
/**
|
|
69
|
+
* Optional metadata for the message. The type can be specified via the generic parameter.
|
|
70
|
+
* This allows different consumers to attach their own typed metadata without modifying
|
|
71
|
+
* the core ChatMessage type.
|
|
72
|
+
*/
|
|
22
73
|
metadata?: M;
|
|
23
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* Defines the shape of an individual message from the model in response to a chat completion request.
|
|
77
|
+
*/
|
|
24
78
|
export type ChatCompletionMessage = {
|
|
79
|
+
/**
|
|
80
|
+
* Role of the message in the conversation. For completions, this is always 'assistant'.
|
|
81
|
+
*/
|
|
25
82
|
role: 'assistant';
|
|
83
|
+
/**
|
|
84
|
+
* Content of the message, can be any string
|
|
85
|
+
*/
|
|
26
86
|
content: string;
|
|
87
|
+
/**
|
|
88
|
+
* When using a reasoning model, this field can contain the reasoning behind the response.
|
|
89
|
+
* Not all providers/models support this field.
|
|
90
|
+
*/
|
|
27
91
|
thinking?: string | null;
|
|
28
92
|
};
|
|
93
|
+
/**
|
|
94
|
+
* Interface for streaming chat completion callbacks
|
|
95
|
+
*/
|
|
29
96
|
export interface StreamingChatCallbacks {
|
|
97
|
+
/**
|
|
98
|
+
* Called when a new chunk of content is received
|
|
99
|
+
* @param chunk The new content chunk
|
|
100
|
+
* @param isComplete Whether this is the final chunk
|
|
101
|
+
*/
|
|
30
102
|
OnContent?: (chunk: string, isComplete: boolean) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Called when the stream is complete
|
|
105
|
+
* @param finalResponse The complete ChatResult
|
|
106
|
+
*/
|
|
31
107
|
OnComplete?: (finalResponse: ChatResult) => void;
|
|
108
|
+
/**
|
|
109
|
+
* Called when an error occurs during streaming
|
|
110
|
+
* @param error The error that occurred
|
|
111
|
+
*/
|
|
32
112
|
OnError?: (error: any) => void;
|
|
33
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* Interface for callbacks used in parallel chat completions
|
|
116
|
+
*/
|
|
34
117
|
export interface ParallelChatCompletionsCallbacks {
|
|
118
|
+
/**
|
|
119
|
+
* Called when a single completion from the batch is completed
|
|
120
|
+
* @param response The completed ChatResult
|
|
121
|
+
* @param index The index of the completion in the original request array
|
|
122
|
+
*/
|
|
35
123
|
OnCompletion?: (response: ChatResult, index: number) => void;
|
|
124
|
+
/**
|
|
125
|
+
* Called when any completion in the batch encounters an error
|
|
126
|
+
* @param error The error that occurred
|
|
127
|
+
* @param index The index of the completion that failed
|
|
128
|
+
*/
|
|
36
129
|
OnError?: (error: any, index: number) => void;
|
|
130
|
+
/**
|
|
131
|
+
* Called when all completions in the batch are completed (successfully or with errors)
|
|
132
|
+
* @param responses Array of all ChatResults in the same order as the request params
|
|
133
|
+
*/
|
|
37
134
|
OnAllCompleted?: (responses: ChatResult[]) => void;
|
|
38
135
|
}
|
|
39
136
|
export declare class ChatParams extends BaseParams {
|
|
137
|
+
/**
|
|
138
|
+
* Array of messages, allows full control over the order and content of the conversation.
|
|
139
|
+
*/
|
|
40
140
|
messages: ChatMessage[];
|
|
141
|
+
/**
|
|
142
|
+
* Whether to use streaming for this request.
|
|
143
|
+
* If true and the provider supports streaming, responses will be streamed.
|
|
144
|
+
* If true but the provider doesn't support streaming, the request will fall back to non-streaming.
|
|
145
|
+
*/
|
|
41
146
|
streaming?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Callbacks for streaming responses.
|
|
149
|
+
* Only used when streaming is true.
|
|
150
|
+
*/
|
|
42
151
|
streamingCallbacks?: StreamingChatCallbacks;
|
|
152
|
+
/**
|
|
153
|
+
* If the model supports effort levels, this parameter can be used to specify the effort level.
|
|
154
|
+
*/
|
|
43
155
|
effortLevel?: string;
|
|
156
|
+
/**
|
|
157
|
+
* Whether to enable caching for this request.
|
|
158
|
+
* Implementation depends on the specific provider (the below are examples, many other providers exist):
|
|
159
|
+
* - For Anthropic: Uses Anthropic's ephemeral cache control to cache system prompt and last user message.
|
|
160
|
+
* - For OpenAI: Uses automatic caching (provider handles it).
|
|
161
|
+
* - For other providers: May be a no-op if caching isn't supported.
|
|
162
|
+
*
|
|
163
|
+
* @default true - Caching is enabled by default for providers that support it.
|
|
164
|
+
*/
|
|
44
165
|
enableCaching?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Not all AI providers support this feature. When supported, this parameter indicates if logprobs are requested.
|
|
168
|
+
* Logprobs provide information about the likelihood of each token in the response.
|
|
169
|
+
* This can be useful for debugging or understanding the model's behavior.
|
|
170
|
+
* When models support this and this property is set to true, the model will return logprobs for the tokens in the @see ChatResultData object within the array of @see ChatResultChoice objects.
|
|
171
|
+
*/
|
|
45
172
|
includeLogProbs?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Optional cancellation token to abort the chat completion request.
|
|
175
|
+
* When this signal is aborted, the provider should cancel the request
|
|
176
|
+
* and return a cancelled result as gracefully as possible.
|
|
177
|
+
*/
|
|
46
178
|
cancellationToken?: AbortSignal;
|
|
179
|
+
/**
|
|
180
|
+
* Top-p (nucleus) sampling parameter (0-1).
|
|
181
|
+
* An alternative to temperature sampling that considers the smallest set of tokens
|
|
182
|
+
* whose cumulative probability exceeds the probability p.
|
|
183
|
+
* For example, 0.1 means only the tokens comprising the top 10% probability mass are considered.
|
|
184
|
+
* Generally, use either temperature OR top-p, not both.
|
|
185
|
+
*/
|
|
47
186
|
topP?: number;
|
|
187
|
+
/**
|
|
188
|
+
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their
|
|
189
|
+
* existing frequency in the text so far, decreasing the model's likelihood to
|
|
190
|
+
* repeat the same line verbatim.
|
|
191
|
+
*/
|
|
48
192
|
frequencyPenalty?: number;
|
|
193
|
+
/**
|
|
194
|
+
* Number between -2.0 and 2.0. Positive values penalize new tokens based on whether
|
|
195
|
+
* they appear in the text so far, increasing the model's likelihood to talk about new topics.
|
|
196
|
+
*/
|
|
49
197
|
presencePenalty?: number;
|
|
198
|
+
/**
|
|
199
|
+
* Top-k sampling parameter.
|
|
200
|
+
* Limits the model to only sample from the top K most likely tokens at each step.
|
|
201
|
+
* For example, k=50 means the model will only consider the 50 most likely next tokens.
|
|
202
|
+
* Not supported by all providers (e.g., OpenAI doesn't support this).
|
|
203
|
+
*/
|
|
50
204
|
topK?: number;
|
|
205
|
+
/**
|
|
206
|
+
* Minimum probability threshold for token sampling (0-1).
|
|
207
|
+
* Tokens with probability below this threshold are filtered out before sampling.
|
|
208
|
+
* This is a newer parameter not yet widely supported.
|
|
209
|
+
*/
|
|
51
210
|
minP?: number;
|
|
211
|
+
/**
|
|
212
|
+
* Number of top log probabilities to return per token.
|
|
213
|
+
* Only used when includeLogProbs is true.
|
|
214
|
+
* Typically ranges from 2-20, depending on the provider.
|
|
215
|
+
*/
|
|
52
216
|
topLogProbs?: number;
|
|
53
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Returns the first user message from the chat params
|
|
220
|
+
* @param p
|
|
221
|
+
* @returns
|
|
222
|
+
*/
|
|
54
223
|
export declare function GetUserMessageFromChatParams(p: ChatParams): ChatMessageContent | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* Returns the first system message from the chat params
|
|
226
|
+
* @param p
|
|
227
|
+
* @returns
|
|
228
|
+
*/
|
|
55
229
|
export declare function GetSystemPromptFromChatParams(p: ChatParams): ChatMessageContent | undefined;
|
|
230
|
+
/**
|
|
231
|
+
* Single message content token with log probability information.
|
|
232
|
+
*/
|
|
56
233
|
export type ChatResultSingleLogProb = {
|
|
234
|
+
/**
|
|
235
|
+
* A list of integers representing the UTF-8 bytes representation of the token.
|
|
236
|
+
* Useful in instances where characters are represented by multiple tokens and their byte representations
|
|
237
|
+
* must be combined to generate the correct text representation. Can be null if there is no bytes representation for the token.
|
|
238
|
+
*/
|
|
57
239
|
bytes: Array<number> | null;
|
|
240
|
+
/**
|
|
241
|
+
* The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely.
|
|
242
|
+
*/
|
|
58
243
|
logprob: number;
|
|
244
|
+
/**
|
|
245
|
+
* The token itself, represented as a string. This is the actual text representation of the token.
|
|
246
|
+
*/
|
|
59
247
|
token: string;
|
|
248
|
+
/**
|
|
249
|
+
* List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested top_logprobs returned.
|
|
250
|
+
*/
|
|
60
251
|
top_logprobs: Array<{
|
|
252
|
+
/**
|
|
253
|
+
* The token
|
|
254
|
+
*/
|
|
61
255
|
token: string;
|
|
256
|
+
/**
|
|
257
|
+
* The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value -9999.0 is used to signify that the token is very unlikely.
|
|
258
|
+
*/
|
|
62
259
|
logprob: number;
|
|
260
|
+
/**
|
|
261
|
+
* A list of integers representing the UTF-8 bytes representation of the token.
|
|
262
|
+
* Useful in instances where characters are represented by multiple tokens and their byte representations must be
|
|
263
|
+
* combined to generate the correct text representation. Can be null if there is no bytes representation for the token.
|
|
264
|
+
*/
|
|
63
265
|
bytes: Array<number> | null;
|
|
64
266
|
}> | null;
|
|
65
267
|
};
|
|
268
|
+
/**
|
|
269
|
+
* Log probability information for a given ChatResultChoice.
|
|
270
|
+
*/
|
|
66
271
|
export type ChatResultLogProbs = {
|
|
272
|
+
/**
|
|
273
|
+
* A list of message content tokens with log probability information.
|
|
274
|
+
*/
|
|
67
275
|
content: Array<ChatResultSingleLogProb> | null;
|
|
276
|
+
/**
|
|
277
|
+
* A list of message refusal tokens with log probability information.
|
|
278
|
+
*/
|
|
68
279
|
refusal: Array<ChatResultSingleLogProb> | null;
|
|
69
280
|
};
|
|
281
|
+
/**
|
|
282
|
+
* A single choice in the chat completion result.
|
|
283
|
+
*/
|
|
70
284
|
export type ChatResultChoice = {
|
|
71
285
|
message: ChatCompletionMessage;
|
|
72
286
|
finish_reason: string;
|
|
73
287
|
index: number;
|
|
74
288
|
logprobs?: ChatResultLogProbs | null;
|
|
75
289
|
};
|
|
290
|
+
/**
|
|
291
|
+
* A response returned from a chat model for a given chat completion request.
|
|
292
|
+
*/
|
|
76
293
|
export type ChatResultData = {
|
|
294
|
+
/**
|
|
295
|
+
* A list of chat completion choices. Can be more than one if n is greater than 1.
|
|
296
|
+
*/
|
|
77
297
|
choices: ChatResultChoice[];
|
|
298
|
+
/**
|
|
299
|
+
* The API name of the model used to generate the response. Some AI providers may return this as undefined.
|
|
300
|
+
*/
|
|
78
301
|
model?: string;
|
|
302
|
+
/**
|
|
303
|
+
* The number of tokens used in the request and response. Some AI providers may return this as undefined.
|
|
304
|
+
*/
|
|
79
305
|
usage?: ModelUsage;
|
|
80
306
|
};
|
|
307
|
+
/**
|
|
308
|
+
* Cache metadata returned from the provider
|
|
309
|
+
*/
|
|
81
310
|
export interface CacheMetadata {
|
|
311
|
+
/**
|
|
312
|
+
* Whether the request had a cache hit
|
|
313
|
+
*/
|
|
82
314
|
cacheHit?: boolean;
|
|
315
|
+
/**
|
|
316
|
+
* The number of tokens retrieved from cache
|
|
317
|
+
*/
|
|
83
318
|
cachedTokenCount?: number;
|
|
84
319
|
}
|
|
85
320
|
export declare class ChatResult extends BaseResult {
|
|
86
321
|
data: ChatResultData;
|
|
87
322
|
success: boolean;
|
|
88
323
|
statusText: string;
|
|
324
|
+
/**
|
|
325
|
+
* Cache-related metadata if available from the provider
|
|
326
|
+
*/
|
|
89
327
|
cacheInfo?: CacheMetadata;
|
|
328
|
+
/**
|
|
329
|
+
* Optional provider-specific response metadata and details not captured in standard fields.
|
|
330
|
+
* This is a flexible field that can contain any additional information the AI provider returns.
|
|
331
|
+
* Structure varies by AI provider.
|
|
332
|
+
*/
|
|
90
333
|
modelSpecificResponseDetails?: Record<string, any>;
|
|
91
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Prefix marker used to identify serialized content blocks in storage.
|
|
337
|
+
* When a message starts with this prefix, it indicates the content is a JSON array of ChatMessageContentBlock.
|
|
338
|
+
*/
|
|
92
339
|
export declare const CONTENT_BLOCKS_PREFIX = "$$CONTENT_BLOCKS$$";
|
|
340
|
+
/**
|
|
341
|
+
* Serializes ChatMessageContent for storage in a database text field.
|
|
342
|
+
* - Plain strings are stored as-is for backward compatibility
|
|
343
|
+
* - Content block arrays are serialized as JSON with a prefix marker
|
|
344
|
+
*
|
|
345
|
+
* @param content The content to serialize
|
|
346
|
+
* @returns A string suitable for database storage
|
|
347
|
+
*/
|
|
93
348
|
export declare function serializeMessageContent(content: ChatMessageContent): string;
|
|
349
|
+
/**
|
|
350
|
+
* Deserializes a stored message back to ChatMessageContent.
|
|
351
|
+
* - Messages with the content blocks prefix are parsed as JSON arrays
|
|
352
|
+
* - Other messages are returned as plain strings
|
|
353
|
+
*
|
|
354
|
+
* @param message The stored message string
|
|
355
|
+
* @returns The deserialized ChatMessageContent
|
|
356
|
+
*/
|
|
94
357
|
export declare function deserializeMessageContent(message: string): ChatMessageContent;
|
|
358
|
+
/**
|
|
359
|
+
* Checks if the content contains any image blocks.
|
|
360
|
+
*
|
|
361
|
+
* @param content The message content to check
|
|
362
|
+
* @returns True if the content contains at least one image_url block
|
|
363
|
+
*/
|
|
95
364
|
export declare function hasImageContent(content: ChatMessageContent): boolean;
|
|
365
|
+
/**
|
|
366
|
+
* Extracts just the text content from a ChatMessageContent, ignoring media blocks.
|
|
367
|
+
* Useful for display or logging purposes.
|
|
368
|
+
*
|
|
369
|
+
* @param content The message content
|
|
370
|
+
* @returns A plain text string with all text blocks joined
|
|
371
|
+
*/
|
|
96
372
|
export declare function getTextFromContent(content: ChatMessageContent): string;
|
|
373
|
+
/**
|
|
374
|
+
* Parses a base64 data URL into its components.
|
|
375
|
+
*
|
|
376
|
+
* @param dataUrl A data URL (e.g., "data:image/png;base64,iVBORw...")
|
|
377
|
+
* @returns An object with mediaType and data, or null if not a valid data URL
|
|
378
|
+
*/
|
|
97
379
|
export declare function parseBase64DataUrl(dataUrl: string): {
|
|
98
380
|
mediaType: string;
|
|
99
381
|
data: string;
|
|
100
382
|
} | null;
|
|
383
|
+
/**
|
|
384
|
+
* Creates a data URL from raw base64 data and a MIME type.
|
|
385
|
+
*
|
|
386
|
+
* @param base64Data The raw base64 encoded data (without the data: prefix)
|
|
387
|
+
* @param mimeType The MIME type (e.g., 'image/png')
|
|
388
|
+
* @returns A complete data URL
|
|
389
|
+
*/
|
|
101
390
|
export declare function createBase64DataUrl(base64Data: string, mimeType: string): string;
|
|
102
391
|
//# sourceMappingURL=chat.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../src/generic/chat.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../src/generic/chat.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAIhE;;GAEG;AACH,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAGnF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAClC;;;OAGG;IACH,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,CAAC;IACpE;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,uBAAuB,EAAE,CAAC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gB,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAKpE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,kBAAkB,GAAG,MAAM,CAQtE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAS9F;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhF"}
|
|
@@ -1,64 +1,127 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { BaseParams, BaseResult } from "./baseModel.js";
|
|
2
|
+
/**
|
|
3
|
+
* The possible roles for a chat message.
|
|
4
|
+
*/
|
|
5
|
+
export const ChatMessageRole = {
|
|
6
6
|
system: 'system',
|
|
7
7
|
user: 'user',
|
|
8
8
|
assistant: 'assistant'
|
|
9
9
|
};
|
|
10
|
-
class ChatParams extends
|
|
10
|
+
export class ChatParams extends BaseParams {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
+
/**
|
|
14
|
+
* Array of messages, allows full control over the order and content of the conversation.
|
|
15
|
+
*/
|
|
13
16
|
this.messages = [];
|
|
17
|
+
/**
|
|
18
|
+
* Whether to use streaming for this request.
|
|
19
|
+
* If true and the provider supports streaming, responses will be streamed.
|
|
20
|
+
* If true but the provider doesn't support streaming, the request will fall back to non-streaming.
|
|
21
|
+
*/
|
|
14
22
|
this.streaming = false;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to enable caching for this request.
|
|
25
|
+
* Implementation depends on the specific provider (the below are examples, many other providers exist):
|
|
26
|
+
* - For Anthropic: Uses Anthropic's ephemeral cache control to cache system prompt and last user message.
|
|
27
|
+
* - For OpenAI: Uses automatic caching (provider handles it).
|
|
28
|
+
* - For other providers: May be a no-op if caching isn't supported.
|
|
29
|
+
*
|
|
30
|
+
* @default true - Caching is enabled by default for providers that support it.
|
|
31
|
+
*/
|
|
15
32
|
this.enableCaching = true;
|
|
33
|
+
/**
|
|
34
|
+
* Not all AI providers support this feature. When supported, this parameter indicates if logprobs are requested.
|
|
35
|
+
* Logprobs provide information about the likelihood of each token in the response.
|
|
36
|
+
* This can be useful for debugging or understanding the model's behavior.
|
|
37
|
+
* When models support this and this property is set to true, the model will return logprobs for the tokens in the @see ChatResultData object within the array of @see ChatResultChoice objects.
|
|
38
|
+
*/
|
|
16
39
|
this.includeLogProbs = false;
|
|
17
40
|
}
|
|
18
41
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Returns the first user message from the chat params
|
|
44
|
+
* @param p
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
export function GetUserMessageFromChatParams(p) {
|
|
48
|
+
return p.messages.find(m => m.role === ChatMessageRole.user)?.content;
|
|
22
49
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Returns the first system message from the chat params
|
|
52
|
+
* @param p
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
export function GetSystemPromptFromChatParams(p) {
|
|
56
|
+
return p.messages.find(m => m.role === ChatMessageRole.system)?.content;
|
|
26
57
|
}
|
|
27
|
-
|
|
28
|
-
class ChatResult extends baseModel_1.BaseResult {
|
|
58
|
+
export class ChatResult extends BaseResult {
|
|
29
59
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
60
|
+
// =============================================================================
|
|
61
|
+
// Content Serialization Utilities
|
|
62
|
+
// =============================================================================
|
|
63
|
+
/**
|
|
64
|
+
* Prefix marker used to identify serialized content blocks in storage.
|
|
65
|
+
* When a message starts with this prefix, it indicates the content is a JSON array of ChatMessageContentBlock.
|
|
66
|
+
*/
|
|
67
|
+
export const CONTENT_BLOCKS_PREFIX = '$$CONTENT_BLOCKS$$';
|
|
68
|
+
/**
|
|
69
|
+
* Serializes ChatMessageContent for storage in a database text field.
|
|
70
|
+
* - Plain strings are stored as-is for backward compatibility
|
|
71
|
+
* - Content block arrays are serialized as JSON with a prefix marker
|
|
72
|
+
*
|
|
73
|
+
* @param content The content to serialize
|
|
74
|
+
* @returns A string suitable for database storage
|
|
75
|
+
*/
|
|
76
|
+
export function serializeMessageContent(content) {
|
|
33
77
|
if (typeof content === 'string') {
|
|
34
78
|
return content;
|
|
35
79
|
}
|
|
36
|
-
return
|
|
80
|
+
return CONTENT_BLOCKS_PREFIX + JSON.stringify(content);
|
|
37
81
|
}
|
|
38
|
-
|
|
39
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Deserializes a stored message back to ChatMessageContent.
|
|
84
|
+
* - Messages with the content blocks prefix are parsed as JSON arrays
|
|
85
|
+
* - Other messages are returned as plain strings
|
|
86
|
+
*
|
|
87
|
+
* @param message The stored message string
|
|
88
|
+
* @returns The deserialized ChatMessageContent
|
|
89
|
+
*/
|
|
90
|
+
export function deserializeMessageContent(message) {
|
|
40
91
|
if (!message) {
|
|
41
92
|
return '';
|
|
42
93
|
}
|
|
43
|
-
if (message.startsWith(
|
|
94
|
+
if (message.startsWith(CONTENT_BLOCKS_PREFIX)) {
|
|
44
95
|
try {
|
|
45
|
-
return JSON.parse(message.substring(
|
|
96
|
+
return JSON.parse(message.substring(CONTENT_BLOCKS_PREFIX.length));
|
|
46
97
|
}
|
|
47
98
|
catch {
|
|
48
|
-
return message
|
|
99
|
+
// If parsing fails, return the original message minus the prefix
|
|
100
|
+
return message.substring(CONTENT_BLOCKS_PREFIX.length);
|
|
49
101
|
}
|
|
50
102
|
}
|
|
51
103
|
return message;
|
|
52
104
|
}
|
|
53
|
-
|
|
54
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Checks if the content contains any image blocks.
|
|
107
|
+
*
|
|
108
|
+
* @param content The message content to check
|
|
109
|
+
* @returns True if the content contains at least one image_url block
|
|
110
|
+
*/
|
|
111
|
+
export function hasImageContent(content) {
|
|
55
112
|
if (typeof content === 'string') {
|
|
56
113
|
return false;
|
|
57
114
|
}
|
|
58
115
|
return content.some(block => block.type === 'image_url');
|
|
59
116
|
}
|
|
60
|
-
|
|
61
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Extracts just the text content from a ChatMessageContent, ignoring media blocks.
|
|
119
|
+
* Useful for display or logging purposes.
|
|
120
|
+
*
|
|
121
|
+
* @param content The message content
|
|
122
|
+
* @returns A plain text string with all text blocks joined
|
|
123
|
+
*/
|
|
124
|
+
export function getTextFromContent(content) {
|
|
62
125
|
if (typeof content === 'string') {
|
|
63
126
|
return content;
|
|
64
127
|
}
|
|
@@ -67,8 +130,13 @@ function getTextFromContent(content) {
|
|
|
67
130
|
.map(block => block.content)
|
|
68
131
|
.join('\n');
|
|
69
132
|
}
|
|
70
|
-
|
|
71
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Parses a base64 data URL into its components.
|
|
135
|
+
*
|
|
136
|
+
* @param dataUrl A data URL (e.g., "data:image/png;base64,iVBORw...")
|
|
137
|
+
* @returns An object with mediaType and data, or null if not a valid data URL
|
|
138
|
+
*/
|
|
139
|
+
export function parseBase64DataUrl(dataUrl) {
|
|
72
140
|
if (!dataUrl.startsWith('data:')) {
|
|
73
141
|
return null;
|
|
74
142
|
}
|
|
@@ -78,9 +146,14 @@ function parseBase64DataUrl(dataUrl) {
|
|
|
78
146
|
}
|
|
79
147
|
return null;
|
|
80
148
|
}
|
|
81
|
-
|
|
82
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Creates a data URL from raw base64 data and a MIME type.
|
|
151
|
+
*
|
|
152
|
+
* @param base64Data The raw base64 encoded data (without the data: prefix)
|
|
153
|
+
* @param mimeType The MIME type (e.g., 'image/png')
|
|
154
|
+
* @returns A complete data URL
|
|
155
|
+
*/
|
|
156
|
+
export function createBase64DataUrl(base64Data, mimeType) {
|
|
83
157
|
return `data:${mimeType};base64,${base64Data}`;
|
|
84
158
|
}
|
|
85
|
-
exports.createBase64DataUrl = createBase64DataUrl;
|
|
86
159
|
//# sourceMappingURL=chat.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.types.js","sourceRoot":"","sources":["../../src/generic/chat.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chat.types.js","sourceRoot":"","sources":["../../src/generic/chat.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAc,MAAM,aAAa,CAAA;AAIhE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;CAChB,CAAC;AA8IX,MAAM,OAAO,UAAW,SAAQ,UAAU;IAA1C;;QACI;;WAEG;QACH,aAAQ,GAAkB,EAAE,CAAC;QAE7B;;;;WAIG;QACH,cAAS,GAAa,KAAK,CAAC;QAa5B;;;;;;;;WAQG;QACH,kBAAa,GAAa,IAAI,CAAC;QAE/B;;;;;WAKG;QACH,oBAAe,GAAa,KAAK,CAAC;IAwDtC,CAAC;CAAA;AACD;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAAC,CAAa;IACtD,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;AAC1E,CAAC;AACD;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAAC,CAAa;IACvD,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;AAC5E,CAAC;AAqGD,MAAM,OAAO,UAAW,SAAQ,UAAU;CAg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T,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC;SACtC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;SAC3B,IAAI,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAC9C,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC1D,IAAI,KAAK,EAAE,CAAC;QACR,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IACnD,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAkB,EAAE,QAAgB;IACpE,OAAO,QAAQ,QAAQ,WAAW,UAAU,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { BaseResult } from "./baseModel";
|
|
2
|
-
import { ChatParams } from "./chat.types";
|
|
1
|
+
import { BaseResult } from "./baseModel.js";
|
|
2
|
+
import { ChatParams } from "./chat.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Defined in order to have this type available for future use with additional properties beyond the BaseParams type.
|
|
5
|
+
*/
|
|
3
6
|
export declare class ClassifyParams extends ChatParams {
|
|
4
7
|
}
|
|
5
8
|
export declare class ClassifyTag {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify.types.d.ts","sourceRoot":"","sources":["../../src/generic/classify.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"classify.types.d.ts","sourceRoot":"","sources":["../../src/generic/classify.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAc,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;GAEG;AACH,qBAAa,cAAe,SAAQ,UAAU;CAC7C;AAED,qBAAa,WAAW;gBACR,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAI3C,GAAG,EAAE,MAAM,CAAA;IACX,UAAU,EAAE,MAAM,CAAA;CACrB;AAED,qBAAa,cAAe,SAAQ,UAAU;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,WAAW,EAAE,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;CACxB"}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class ClassifyParams extends
|
|
1
|
+
import { BaseResult } from "./baseModel.js";
|
|
2
|
+
import { ChatParams } from "./chat.types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Defined in order to have this type available for future use with additional properties beyond the BaseParams type.
|
|
5
|
+
*/
|
|
6
|
+
export class ClassifyParams extends ChatParams {
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
class ClassifyTag {
|
|
8
|
+
export class ClassifyTag {
|
|
10
9
|
constructor(tag, confidence) {
|
|
11
10
|
this.tag = tag;
|
|
12
11
|
this.confidence = confidence;
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
class ClassifyResult extends baseModel_1.BaseResult {
|
|
14
|
+
export class ClassifyResult extends BaseResult {
|
|
17
15
|
}
|
|
18
|
-
exports.ClassifyResult = ClassifyResult;
|
|
19
16
|
//# sourceMappingURL=classify.types.js.map
|