@elizaos/plugin-openai 2.0.3-beta.2 → 2.0.3-beta.4
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/browser/index.browser.js +3 -0
- package/dist/browser/index.browser.js.map +23 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/index.browser.d.ts +4 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.node.d.ts +4 -0
- package/dist/index.node.d.ts.map +1 -0
- package/dist/init.d.ts +4 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/models/audio.d.ts +9 -0
- package/dist/models/audio.d.ts.map +1 -0
- package/dist/models/embedding.d.ts +3 -0
- package/dist/models/embedding.d.ts.map +1 -0
- package/dist/models/image.d.ts +5 -0
- package/dist/models/image.d.ts.map +1 -0
- package/dist/models/index.d.ts +7 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/research.d.ts +34 -0
- package/dist/models/research.d.ts.map +1 -0
- package/dist/models/text.d.ts +62 -0
- package/dist/models/text.d.ts.map +1 -0
- package/dist/models/tokenizer.d.ts +4 -0
- package/dist/models/tokenizer.d.ts.map +1 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.node.js +2057 -0
- package/dist/node/index.node.js.map +23 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/openai.d.ts +4 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/types/index.d.ts +367 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/audio.d.ts +6 -0
- package/dist/utils/audio.d.ts.map +1 -0
- package/dist/utils/config.d.ts +47 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/events.d.ts +21 -0
- package/dist/utils/events.d.ts.map +1 -0
- package/dist/utils/tokenization.d.ts +6 -0
- package/dist/utils/tokenization.d.ts.map +1 -0
- package/package.json +7 -4
- package/registry-entry.json +189 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported audio formats for transcription
|
|
3
|
+
*/
|
|
4
|
+
export type AudioFormat = "mp3" | "wav" | "webm" | "ogg" | "flac" | "mp4";
|
|
5
|
+
/**
|
|
6
|
+
* Supported response formats for transcription
|
|
7
|
+
*/
|
|
8
|
+
export type TranscriptionResponseFormat = "json" | "text" | "srt" | "verbose_json" | "vtt";
|
|
9
|
+
/**
|
|
10
|
+
* Timestamp granularity options for transcription
|
|
11
|
+
*/
|
|
12
|
+
export type TimestampGranularity = "word" | "segment";
|
|
13
|
+
/**
|
|
14
|
+
* Supported TTS output formats
|
|
15
|
+
*/
|
|
16
|
+
export type TTSOutputFormat = "mp3" | "wav" | "flac" | "opus" | "aac" | "pcm";
|
|
17
|
+
/**
|
|
18
|
+
* Supported TTS voices
|
|
19
|
+
*/
|
|
20
|
+
export type TTSVoice = "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer";
|
|
21
|
+
/**
|
|
22
|
+
* Image sizes for DALL-E
|
|
23
|
+
*/
|
|
24
|
+
export type ImageSize = "256x256" | "512x512" | "1024x1024" | "1792x1024" | "1024x1792";
|
|
25
|
+
/**
|
|
26
|
+
* Image quality options
|
|
27
|
+
*/
|
|
28
|
+
export type ImageQuality = "standard" | "hd";
|
|
29
|
+
/**
|
|
30
|
+
* Image style options
|
|
31
|
+
*/
|
|
32
|
+
export type ImageStyle = "vivid" | "natural";
|
|
33
|
+
/**
|
|
34
|
+
* Parameters for audio transcription
|
|
35
|
+
*/
|
|
36
|
+
export interface TranscriptionParams {
|
|
37
|
+
/** The audio data to transcribe */
|
|
38
|
+
audio: Blob | File | Buffer;
|
|
39
|
+
/** The model to use for transcription */
|
|
40
|
+
model?: string;
|
|
41
|
+
/** The language of the audio (ISO-639-1 code) */
|
|
42
|
+
language?: string;
|
|
43
|
+
/** The format of the response */
|
|
44
|
+
responseFormat?: TranscriptionResponseFormat;
|
|
45
|
+
/** An optional prompt to guide the model's style */
|
|
46
|
+
prompt?: string;
|
|
47
|
+
/** Sampling temperature between 0 and 1 */
|
|
48
|
+
temperature?: number;
|
|
49
|
+
/** Timestamp granularity for verbose output */
|
|
50
|
+
timestampGranularities?: TimestampGranularity[];
|
|
51
|
+
/** MIME type hint for buffer audio data */
|
|
52
|
+
mimeType?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Parameters for text-to-speech generation
|
|
56
|
+
*/
|
|
57
|
+
export interface TextToSpeechParams {
|
|
58
|
+
/** The text to convert to speech (max 4096 characters) */
|
|
59
|
+
text: string;
|
|
60
|
+
/** The model to use */
|
|
61
|
+
model?: string;
|
|
62
|
+
/** The voice to use */
|
|
63
|
+
voice?: TTSVoice;
|
|
64
|
+
/** The output format */
|
|
65
|
+
format?: TTSOutputFormat;
|
|
66
|
+
/** Additional instructions for the TTS model */
|
|
67
|
+
instructions?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Parameters for embedding generation
|
|
71
|
+
*/
|
|
72
|
+
export interface EmbeddingParams {
|
|
73
|
+
/** The text to embed */
|
|
74
|
+
text: string;
|
|
75
|
+
/** The model to use */
|
|
76
|
+
model?: string;
|
|
77
|
+
/** The number of dimensions for the embedding */
|
|
78
|
+
dimensions?: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Parameters for image generation
|
|
82
|
+
*/
|
|
83
|
+
export interface ImageGenerationParams {
|
|
84
|
+
/** The prompt describing the image to generate */
|
|
85
|
+
prompt: string;
|
|
86
|
+
/** Number of images to generate (1-10) */
|
|
87
|
+
count?: number;
|
|
88
|
+
/** The size of the generated images */
|
|
89
|
+
size?: ImageSize;
|
|
90
|
+
/** The quality of the generated images */
|
|
91
|
+
quality?: ImageQuality;
|
|
92
|
+
/** The style of the generated images */
|
|
93
|
+
style?: ImageStyle;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Parameters for image description/analysis
|
|
97
|
+
*/
|
|
98
|
+
export interface ImageDescriptionParams {
|
|
99
|
+
/** URL of the image to analyze */
|
|
100
|
+
imageUrl: string;
|
|
101
|
+
/** Custom prompt for analysis */
|
|
102
|
+
prompt?: string;
|
|
103
|
+
/** Maximum tokens for the response */
|
|
104
|
+
maxTokens?: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Parameters for text generation
|
|
108
|
+
*/
|
|
109
|
+
export interface TextGenerationParams {
|
|
110
|
+
/** The prompt for generation */
|
|
111
|
+
prompt: string;
|
|
112
|
+
/** System message for the model */
|
|
113
|
+
system?: string;
|
|
114
|
+
/** Temperature for sampling (0-2) */
|
|
115
|
+
temperature?: number;
|
|
116
|
+
/** Maximum output tokens */
|
|
117
|
+
maxTokens?: number;
|
|
118
|
+
/** Frequency penalty (-2 to 2) */
|
|
119
|
+
frequencyPenalty?: number;
|
|
120
|
+
/** Presence penalty (-2 to 2) */
|
|
121
|
+
presencePenalty?: number;
|
|
122
|
+
/** Stop sequences */
|
|
123
|
+
stopSequences?: string[];
|
|
124
|
+
/** Whether to stream the response */
|
|
125
|
+
stream?: boolean;
|
|
126
|
+
/** Callback for streaming chunks */
|
|
127
|
+
onStreamChunk?: (chunk: string) => void;
|
|
128
|
+
/** Stable key for OpenAI prompt cache routing */
|
|
129
|
+
promptCacheKey?: string;
|
|
130
|
+
/** Optional OpenAI cache retention mode */
|
|
131
|
+
promptCacheRetention?: "in_memory" | "24h";
|
|
132
|
+
/** Provider-specific options for OpenAI requests */
|
|
133
|
+
providerOptions?: {
|
|
134
|
+
openai?: {
|
|
135
|
+
promptCacheKey?: string;
|
|
136
|
+
promptCacheRetention?: "in_memory" | "24h";
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Parameters for tokenization
|
|
142
|
+
*/
|
|
143
|
+
export interface TokenizeParams {
|
|
144
|
+
/** The text to tokenize */
|
|
145
|
+
prompt: string;
|
|
146
|
+
/** The model whose tokenizer to use */
|
|
147
|
+
modelType?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Parameters for detokenization
|
|
151
|
+
*/
|
|
152
|
+
export interface DetokenizeParams {
|
|
153
|
+
/** The tokens to decode */
|
|
154
|
+
tokens: number[];
|
|
155
|
+
/** The model whose tokenizer to use */
|
|
156
|
+
modelType?: string;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Result of image description/analysis
|
|
160
|
+
*/
|
|
161
|
+
export interface ImageDescriptionResult {
|
|
162
|
+
/** A title for the image */
|
|
163
|
+
title: string;
|
|
164
|
+
/** A detailed description of the image */
|
|
165
|
+
description: string;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Result of image generation
|
|
169
|
+
*/
|
|
170
|
+
export interface ImageGenerationResult {
|
|
171
|
+
/** URL of the generated image */
|
|
172
|
+
url: string;
|
|
173
|
+
/** Revised prompt (if applicable) */
|
|
174
|
+
revisedPrompt?: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Token usage statistics
|
|
178
|
+
*/
|
|
179
|
+
export interface TokenUsage {
|
|
180
|
+
/** Number of prompt tokens */
|
|
181
|
+
promptTokens: number;
|
|
182
|
+
/** Number of completion tokens */
|
|
183
|
+
completionTokens: number;
|
|
184
|
+
/** Total tokens used */
|
|
185
|
+
totalTokens: number;
|
|
186
|
+
/**
|
|
187
|
+
* Prompt tokens read from cache.
|
|
188
|
+
*
|
|
189
|
+
* Historical name kept for back-compat with OpenAI plugin consumers. New
|
|
190
|
+
* code should also read `cacheReadInputTokens` (the canonical v5 trajectory
|
|
191
|
+
* recorder field). The text adapter populates both when the AI SDK reports
|
|
192
|
+
* cached input.
|
|
193
|
+
*/
|
|
194
|
+
cachedPromptTokens?: number;
|
|
195
|
+
/**
|
|
196
|
+
* Canonical v5 cache-read field. Mirrors `cachedPromptTokens` for the
|
|
197
|
+
* trajectory recorder + cost table, so consumers that expect either name
|
|
198
|
+
* resolve correctly.
|
|
199
|
+
*/
|
|
200
|
+
cacheReadInputTokens?: number;
|
|
201
|
+
/**
|
|
202
|
+
* Canonical v5 cache-creation field. OpenAI does not differentiate cache
|
|
203
|
+
* write currently, so this is reserved for parity with Anthropic adapters.
|
|
204
|
+
*/
|
|
205
|
+
cacheCreationInputTokens?: number;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Streaming text result
|
|
209
|
+
*/
|
|
210
|
+
export interface TextStreamResult {
|
|
211
|
+
/** Async iterable stream of text chunks */
|
|
212
|
+
textStream: AsyncIterable<string>;
|
|
213
|
+
/** Promise resolving to final complete text */
|
|
214
|
+
text: Promise<string>;
|
|
215
|
+
/** Promise resolving to token usage */
|
|
216
|
+
usage: Promise<TokenUsage | undefined>;
|
|
217
|
+
/** Promise resolving to finish reason */
|
|
218
|
+
finishReason: Promise<string | undefined>;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* OpenAI embedding response structure
|
|
222
|
+
*/
|
|
223
|
+
export interface OpenAIEmbeddingResponse {
|
|
224
|
+
object: "list";
|
|
225
|
+
data: Array<{
|
|
226
|
+
object: "embedding";
|
|
227
|
+
embedding: number[];
|
|
228
|
+
index: number;
|
|
229
|
+
}>;
|
|
230
|
+
model: string;
|
|
231
|
+
usage: {
|
|
232
|
+
prompt_tokens: number;
|
|
233
|
+
total_tokens: number;
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* OpenAI chat completion response structure
|
|
238
|
+
*/
|
|
239
|
+
export interface OpenAIChatCompletionResponse {
|
|
240
|
+
id: string;
|
|
241
|
+
object: "chat.completion";
|
|
242
|
+
created: number;
|
|
243
|
+
model: string;
|
|
244
|
+
choices: Array<{
|
|
245
|
+
index: number;
|
|
246
|
+
message: {
|
|
247
|
+
role: "assistant";
|
|
248
|
+
content: string | null;
|
|
249
|
+
};
|
|
250
|
+
finish_reason: "stop" | "length" | "content_filter" | "tool_calls";
|
|
251
|
+
}>;
|
|
252
|
+
usage: {
|
|
253
|
+
prompt_tokens: number;
|
|
254
|
+
completion_tokens: number;
|
|
255
|
+
total_tokens: number;
|
|
256
|
+
prompt_tokens_details?: {
|
|
257
|
+
cached_tokens?: number;
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* OpenAI image generation response structure
|
|
263
|
+
*/
|
|
264
|
+
export interface OpenAIImageGenerationResponse {
|
|
265
|
+
created: number;
|
|
266
|
+
data: Array<{
|
|
267
|
+
url: string;
|
|
268
|
+
revised_prompt?: string;
|
|
269
|
+
}>;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* OpenAI transcription response structure
|
|
273
|
+
*/
|
|
274
|
+
export interface OpenAITranscriptionResponse {
|
|
275
|
+
text: string;
|
|
276
|
+
language?: string;
|
|
277
|
+
duration?: number;
|
|
278
|
+
words?: Array<{
|
|
279
|
+
word: string;
|
|
280
|
+
start: number;
|
|
281
|
+
end: number;
|
|
282
|
+
}>;
|
|
283
|
+
segments?: Array<{
|
|
284
|
+
id: number;
|
|
285
|
+
start: number;
|
|
286
|
+
end: number;
|
|
287
|
+
text: string;
|
|
288
|
+
}>;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* OpenAI models list response
|
|
292
|
+
*/
|
|
293
|
+
export interface OpenAIModelsResponse {
|
|
294
|
+
object: "list";
|
|
295
|
+
data: Array<{
|
|
296
|
+
id: string;
|
|
297
|
+
object: "model";
|
|
298
|
+
created: number;
|
|
299
|
+
owned_by: string;
|
|
300
|
+
}>;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* OpenAI plugin configuration settings
|
|
304
|
+
*/
|
|
305
|
+
export interface OpenAIPluginConfig {
|
|
306
|
+
/** OpenAI API key */
|
|
307
|
+
OPENAI_API_KEY?: string;
|
|
308
|
+
/** Base URL for API requests */
|
|
309
|
+
OPENAI_BASE_URL?: string;
|
|
310
|
+
/** Small model identifier */
|
|
311
|
+
OPENAI_SMALL_MODEL?: string;
|
|
312
|
+
/** Large model identifier */
|
|
313
|
+
OPENAI_LARGE_MODEL?: string;
|
|
314
|
+
/** Embedding model identifier */
|
|
315
|
+
OPENAI_EMBEDDING_MODEL?: string;
|
|
316
|
+
/** Separate API key for embeddings */
|
|
317
|
+
OPENAI_EMBEDDING_API_KEY?: string;
|
|
318
|
+
/** Separate base URL for embeddings */
|
|
319
|
+
OPENAI_EMBEDDING_URL?: string;
|
|
320
|
+
/** Embedding dimensions */
|
|
321
|
+
OPENAI_EMBEDDING_DIMENSIONS?: string;
|
|
322
|
+
/** Separate API key for image description */
|
|
323
|
+
OPENAI_IMAGE_DESCRIPTION_API_KEY?: string;
|
|
324
|
+
/** Separate base URL for image description */
|
|
325
|
+
OPENAI_IMAGE_DESCRIPTION_BASE_URL?: string;
|
|
326
|
+
/** Image description model */
|
|
327
|
+
OPENAI_IMAGE_DESCRIPTION_MODEL?: string;
|
|
328
|
+
/** Max tokens for image description */
|
|
329
|
+
OPENAI_IMAGE_DESCRIPTION_MAX_TOKENS?: string;
|
|
330
|
+
/** TTS model */
|
|
331
|
+
OPENAI_TTS_MODEL?: string;
|
|
332
|
+
/** TTS voice */
|
|
333
|
+
OPENAI_TTS_VOICE?: string;
|
|
334
|
+
/** TTS instructions */
|
|
335
|
+
OPENAI_TTS_INSTRUCTIONS?: string;
|
|
336
|
+
/** Enable experimental telemetry */
|
|
337
|
+
OPENAI_EXPERIMENTAL_TELEMETRY?: string;
|
|
338
|
+
/** Browser-only proxy base URL */
|
|
339
|
+
OPENAI_BROWSER_BASE_URL?: string;
|
|
340
|
+
/** Browser-only embedding proxy URL */
|
|
341
|
+
OPENAI_BROWSER_EMBEDDING_URL?: string;
|
|
342
|
+
/** Transcription model */
|
|
343
|
+
OPENAI_TRANSCRIPTION_MODEL?: string;
|
|
344
|
+
/** Image generation model */
|
|
345
|
+
OPENAI_IMAGE_MODEL?: string;
|
|
346
|
+
/** Deep research model (o3-deep-research or o4-mini-deep-research) */
|
|
347
|
+
OPENAI_RESEARCH_MODEL?: string;
|
|
348
|
+
/** Timeout for deep research requests in milliseconds (default: 3600000 = 1 hour) */
|
|
349
|
+
OPENAI_RESEARCH_TIMEOUT?: string;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Validates that a string is non-empty
|
|
353
|
+
*/
|
|
354
|
+
export declare function requireNonEmptyString(value: string, fieldName: string): string;
|
|
355
|
+
/**
|
|
356
|
+
* Validates that a number is within a range
|
|
357
|
+
*/
|
|
358
|
+
export declare function requireNumberInRange(value: number, min: number, max: number, fieldName: string): number;
|
|
359
|
+
/**
|
|
360
|
+
* Validates that an array is non-empty
|
|
361
|
+
*/
|
|
362
|
+
export declare function requireNonEmptyArray<T>(arr: T[], fieldName: string): T[];
|
|
363
|
+
/**
|
|
364
|
+
* Validates embedding dimensions
|
|
365
|
+
*/
|
|
366
|
+
export declare function validateEmbeddingDimension(dimension: number, validDimensions: readonly number[]): number;
|
|
367
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,cAAc,GAAG,KAAK,CAAC;AAE3F;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GA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imeType = "audio/wav" | "audio/mpeg" | "audio/ogg" | "audio/flac" | "audio/mp4" | "audio/webm" | "application/octet-stream";
|
|
2
|
+
export declare function detectAudioMimeType(buffer: Buffer): AudioMimeType;
|
|
3
|
+
export declare function getExtensionForMimeType(mimeType: AudioMimeType): string;
|
|
4
|
+
export declare function getFilenameForMimeType(mimeType: AudioMimeType): string;
|
|
5
|
+
export declare function validateAudioFormat(buffer: Buffer): AudioMimeType;
|
|
6
|
+
//# sourceMappingURL=audio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio.d.ts","sourceRoot":"","sources":["../../utils/audio.ts"],"names":[],"mappings":"AAgBA,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,0BAA0B,CAAC;AAY/B,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CA6CjE;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAiBvE;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAGtE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAQjE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { IAgentRuntime } from "@elizaos/core";
|
|
2
|
+
export declare function getSetting(runtime: IAgentRuntime, key: string, defaultValue?: string): string | undefined;
|
|
3
|
+
export declare function getRequiredSetting(runtime: IAgentRuntime, key: string, errorMessage?: string): string;
|
|
4
|
+
export declare function getNumericSetting(runtime: IAgentRuntime, key: string, defaultValue: number): number;
|
|
5
|
+
export declare function getBooleanSetting(runtime: IAgentRuntime, key: string, defaultValue: boolean): boolean;
|
|
6
|
+
export declare function isBrowser(): boolean;
|
|
7
|
+
export declare function isProxyMode(runtime: IAgentRuntime): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* True when the resolved base URL or `ELIZA_PROVIDER` setting marks the
|
|
10
|
+
* runtime as using Cerebras's OpenAI-compatible endpoint. Used to scope
|
|
11
|
+
* the `CEREBRAS_API_KEY` alias so OpenAI users are not affected.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isCerebrasMode(runtime: IAgentRuntime): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* True when the resolved base URL or `ELIZA_PROVIDER` setting marks the
|
|
16
|
+
* runtime as using EvoLink's OpenAI-compatible endpoint. Used to scope the
|
|
17
|
+
* `EVOLINK_API_KEY` alias so OpenAI users are not affected.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isEvoLinkMode(runtime: IAgentRuntime): boolean;
|
|
20
|
+
export declare function getApiKey(runtime: IAgentRuntime): string | undefined;
|
|
21
|
+
export declare function getEmbeddingApiKey(runtime: IAgentRuntime): string | undefined;
|
|
22
|
+
export declare function getAuthHeader(runtime: IAgentRuntime, forEmbedding?: boolean): Record<string, string>;
|
|
23
|
+
export declare function getBaseURL(runtime: IAgentRuntime): string;
|
|
24
|
+
export declare function getEmbeddingBaseURL(runtime: IAgentRuntime): string;
|
|
25
|
+
export declare function getImageDescriptionApiKey(runtime: IAgentRuntime): string | undefined;
|
|
26
|
+
export declare function getImageDescriptionAuthHeader(runtime: IAgentRuntime): Record<string, string>;
|
|
27
|
+
export declare function getImageDescriptionBaseURL(runtime: IAgentRuntime): string;
|
|
28
|
+
export declare function getSmallModel(runtime: IAgentRuntime): string;
|
|
29
|
+
export declare function getNanoModel(runtime: IAgentRuntime): string;
|
|
30
|
+
export declare function getMediumModel(runtime: IAgentRuntime): string;
|
|
31
|
+
export declare function getLargeModel(runtime: IAgentRuntime): string;
|
|
32
|
+
export declare function getMegaModel(runtime: IAgentRuntime): string;
|
|
33
|
+
export declare function getResponseHandlerModel(runtime: IAgentRuntime): string;
|
|
34
|
+
export declare function getActionPlannerModel(runtime: IAgentRuntime): string;
|
|
35
|
+
export declare function getEmbeddingModel(runtime: IAgentRuntime): string;
|
|
36
|
+
export declare function getImageDescriptionModel(runtime: IAgentRuntime): string;
|
|
37
|
+
export declare function getTranscriptionModel(runtime: IAgentRuntime): string;
|
|
38
|
+
export declare function getTTSModel(runtime: IAgentRuntime): string;
|
|
39
|
+
export declare function getTTSVoice(runtime: IAgentRuntime): string;
|
|
40
|
+
export declare function getTTSInstructions(runtime: IAgentRuntime): string;
|
|
41
|
+
export declare function getImageModel(runtime: IAgentRuntime): string;
|
|
42
|
+
export declare function getExperimentalTelemetry(runtime: IAgentRuntime): boolean;
|
|
43
|
+
export declare function getEmbeddingDimensions(runtime: IAgentRuntime): number;
|
|
44
|
+
export declare function getImageDescriptionMaxTokens(runtime: IAgentRuntime): number;
|
|
45
|
+
export declare function getResearchModel(runtime: IAgentRuntime): string;
|
|
46
|
+
export declare function getResearchTimeout(runtime: IAgentRuntime): number;
|
|
47
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAWnD,wBAAgB,UAAU,CACxB,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,MAAM,EACX,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,GAAG,SAAS,CAMpB;AACD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,MAAM,EACX,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAMR;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,GACnB,MAAM,CAUR;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,aAAa,EACtB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,OAAO,GACpB,OAAO,CAOT;AAED,wBAAgB,SAAS,IAAI,OAAO,CAKnC;AAED,wB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,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAUpE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAEhE;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAEvE;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAEpE;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAE1D;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAE1D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAEjE;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAE5D;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAExE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAErE;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAE3E;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAE/D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAEjE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IAgentRuntime, ModelTypeName } from "@elizaos/core";
|
|
2
|
+
import type { TokenUsage } from "../types";
|
|
3
|
+
interface AISDKUsage {
|
|
4
|
+
inputTokens?: number;
|
|
5
|
+
outputTokens?: number;
|
|
6
|
+
totalTokens?: number;
|
|
7
|
+
cachedInputTokens?: number;
|
|
8
|
+
}
|
|
9
|
+
interface OpenAIAPIUsage {
|
|
10
|
+
promptTokens?: number;
|
|
11
|
+
completionTokens?: number;
|
|
12
|
+
totalTokens?: number;
|
|
13
|
+
cachedPromptTokens?: number;
|
|
14
|
+
promptTokensDetails?: {
|
|
15
|
+
cachedTokens?: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
type ModelUsage = TokenUsage | AISDKUsage | OpenAIAPIUsage;
|
|
19
|
+
export declare function emitModelUsageEvent(runtime: IAgentRuntime, type: ModelTypeName, prompt: string, usage: ModelUsage): void;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../utils/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAkB3C,UAAU,UAAU;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,UAAU,cAAc;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAED,KAAK,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,cAAc,CAAC;AAuC3D,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,UAAU,GAChB,IAAI,CAoBN"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IAgentRuntime, ModelTypeName } from "@elizaos/core";
|
|
2
|
+
export declare function tokenizeText(runtime: IAgentRuntime, modelType: ModelTypeName, text: string): number[];
|
|
3
|
+
export declare function detokenizeText(runtime: IAgentRuntime, modelType: ModelTypeName, tokens: number[]): string;
|
|
4
|
+
export declare function countTokens(runtime: IAgentRuntime, modelType: ModelTypeName, text: string): number;
|
|
5
|
+
export declare function truncateToTokenLimit(runtime: IAgentRuntime, modelType: ModelTypeName, text: string, maxTokens: number): string;
|
|
6
|
+
//# sourceMappingURL=tokenization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenization.d.ts","sourceRoot":"","sources":["../../utils/tokenization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAgClE,wBAAgB,YAAY,CAC1B,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,MAAM,GACX,MAAM,EAAE,CAIV;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,MAAM,EAAE,GACf,MAAM,CAIR;AAED,wBAAgB,WAAW,CACzB,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,MAAM,GACX,MAAM,CAGR;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,aAAa,EACtB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,GAChB,MAAM,CAOR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-openai",
|
|
3
|
-
"version": "2.0.3-beta.
|
|
3
|
+
"version": "2.0.3-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/node/index.node.js",
|
|
6
6
|
"module": "dist/node/index.node.js",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
|
+
"registry-entry.json",
|
|
38
39
|
"dist",
|
|
39
40
|
"rust",
|
|
40
41
|
"auto-enable.ts"
|
|
@@ -59,7 +60,8 @@
|
|
|
59
60
|
},
|
|
60
61
|
"devDependencies": {
|
|
61
62
|
"@biomejs/biome": "^2.4.14",
|
|
62
|
-
"@elizaos/core": "2.0.3-beta.
|
|
63
|
+
"@elizaos/core": "2.0.3-beta.4",
|
|
64
|
+
"@elizaos/test-harness": "2.0.3-beta.4",
|
|
63
65
|
"@types/bun": "^1.3.8",
|
|
64
66
|
"@types/json-schema": "^7.0.15",
|
|
65
67
|
"@types/node": "^25.0.3",
|
|
@@ -68,7 +70,7 @@
|
|
|
68
70
|
"vitest": "^4.0.0"
|
|
69
71
|
},
|
|
70
72
|
"peerDependencies": {
|
|
71
|
-
"@elizaos/core": "2.0.3-beta.
|
|
73
|
+
"@elizaos/core": "2.0.3-beta.4",
|
|
72
74
|
"zod": "^4.4.3"
|
|
73
75
|
},
|
|
74
76
|
"scripts": {
|
|
@@ -82,6 +84,7 @@
|
|
|
82
84
|
"typecheck": "tsgo --noEmit",
|
|
83
85
|
"test": "vitest run --config ./vitest.config.ts",
|
|
84
86
|
"test:ts": "vitest run --config ./vitest.config.ts",
|
|
87
|
+
"test:harness": "bunx vitest run --config vitest.harness.config.ts",
|
|
85
88
|
"build": "bun run build.ts"
|
|
86
89
|
},
|
|
87
90
|
"publishConfig": {
|
|
@@ -242,7 +245,7 @@
|
|
|
242
245
|
}
|
|
243
246
|
}
|
|
244
247
|
},
|
|
245
|
-
"gitHead": "
|
|
248
|
+
"gitHead": "f76f55793a0fb8d6b869dd8ddce03970de061e34",
|
|
246
249
|
"eliza": {
|
|
247
250
|
"platforms": [
|
|
248
251
|
"browser",
|