@elizaos/plugin-openai 1.0.0-alpha.62 → 1.0.0-alpha.64
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/README.md +14 -13
- package/dist/index.js +19 -47
- package/dist/index.js.map +1 -1
- package/package.json +54 -49
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ The plugin requires these environment variables (can be set in .env file or char
|
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
Or in `.env` file:
|
|
27
|
+
|
|
27
28
|
```
|
|
28
29
|
OPENAI_API_KEY=your_openai_api_key
|
|
29
30
|
# Optional overrides:
|
|
@@ -33,12 +34,14 @@ OPENAI_LARGE_MODEL=gpt-4o
|
|
|
33
34
|
```
|
|
34
35
|
|
|
35
36
|
### Configuration Options
|
|
37
|
+
|
|
36
38
|
- `OPENAI_API_KEY` (required): Your OpenAI API credentials
|
|
37
39
|
- `OPENAI_BASE_URL`: Custom API endpoint (default: https://api.openai.com/v1)
|
|
38
40
|
- `OPENAI_SMALL_MODEL`: Defaults to GPT-4o Mini ("gpt-4o-mini")
|
|
39
41
|
- `OPENAI_LARGE_MODEL`: Defaults to GPT-4o ("gpt-4o")
|
|
40
42
|
|
|
41
43
|
The plugin provides these model classes:
|
|
44
|
+
|
|
42
45
|
- `TEXT_SMALL`: Optimized for fast, cost-effective responses
|
|
43
46
|
- `TEXT_LARGE`: For complex tasks requiring deeper reasoning
|
|
44
47
|
- `TEXT_EMBEDDING`: Text embedding model (text-embedding-3-small)
|
|
@@ -51,34 +54,32 @@ The plugin provides these model classes:
|
|
|
51
54
|
## Additional Features
|
|
52
55
|
|
|
53
56
|
### Image Generation
|
|
57
|
+
|
|
54
58
|
```js
|
|
55
|
-
await runtime.useModel(
|
|
56
|
-
prompt:
|
|
59
|
+
await runtime.useModel(ModelType.IMAGE, {
|
|
60
|
+
prompt: 'A sunset over mountains',
|
|
57
61
|
n: 1, // number of images
|
|
58
|
-
size:
|
|
62
|
+
size: '1024x1024', // image resolution
|
|
59
63
|
});
|
|
60
64
|
```
|
|
61
65
|
|
|
62
66
|
### Audio Transcription
|
|
67
|
+
|
|
63
68
|
```js
|
|
64
|
-
const transcription = await runtime.useModel(
|
|
65
|
-
ModelClass.TRANSCRIPTION,
|
|
66
|
-
audioBuffer
|
|
67
|
-
);
|
|
69
|
+
const transcription = await runtime.useModel(ModelType.TRANSCRIPTION, audioBuffer);
|
|
68
70
|
```
|
|
69
71
|
|
|
70
72
|
### Image Analysis
|
|
73
|
+
|
|
71
74
|
```js
|
|
72
75
|
const { title, description } = await runtime.useModel(
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
ModelType.IMAGE_DESCRIPTION,
|
|
77
|
+
'https://example.com/image.jpg'
|
|
75
78
|
);
|
|
76
79
|
```
|
|
77
80
|
|
|
78
81
|
### Text Embeddings
|
|
82
|
+
|
|
79
83
|
```js
|
|
80
|
-
const embedding = await runtime.useModel(
|
|
81
|
-
ModelClass.TEXT_EMBEDDING,
|
|
82
|
-
"text to embed"
|
|
83
|
-
);
|
|
84
|
+
const embedding = await runtime.useModel(ModelType.TEXT_EMBEDDING, 'text to embed');
|
|
84
85
|
```
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
} from "@elizaos/core";
|
|
7
7
|
import { generateObject, generateText } from "ai";
|
|
8
8
|
import { encodingForModel } from "js-tiktoken";
|
|
9
|
-
import { z } from "zod";
|
|
10
9
|
async function tokenizeText(model, prompt) {
|
|
11
10
|
const modelName = model === ModelType.TEXT_SMALL ? process.env.OPENAI_SMALL_MODEL ?? process.env.SMALL_MODEL ?? "gpt-4o-mini" : process.env.LARGE_MODEL ?? "gpt-4o";
|
|
12
11
|
const encoding = encodingForModel(modelName);
|
|
@@ -43,30 +42,22 @@ var openaiPlugin = {
|
|
|
43
42
|
headers: { Authorization: `Bearer ${process.env.OPENAI_API_KEY}` }
|
|
44
43
|
});
|
|
45
44
|
if (!response.ok) {
|
|
46
|
-
logger.warn(
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
logger.warn(
|
|
50
|
-
"OpenAI functionality will be limited until a valid API key is provided"
|
|
51
|
-
);
|
|
45
|
+
logger.warn(`OpenAI API key validation failed: ${response.statusText}`);
|
|
46
|
+
logger.warn("OpenAI functionality will be limited until a valid API key is provided");
|
|
52
47
|
} else {
|
|
53
48
|
}
|
|
54
49
|
} catch (fetchError) {
|
|
55
50
|
logger.warn(`Error validating OpenAI API key: ${fetchError}`);
|
|
56
|
-
logger.warn(
|
|
57
|
-
"OpenAI functionality will be limited until a valid API key is provided"
|
|
58
|
-
);
|
|
51
|
+
logger.warn("OpenAI functionality will be limited until a valid API key is provided");
|
|
59
52
|
}
|
|
60
53
|
} catch (error) {
|
|
61
54
|
logger.warn(
|
|
62
|
-
`OpenAI plugin configuration issue: ${error.errors.map((e) => e.message).join(
|
|
63
|
-
", "
|
|
64
|
-
)} - You need to configure the OPENAI_API_KEY in your environment variables`
|
|
55
|
+
`OpenAI plugin configuration issue: ${error.errors.map((e) => e.message).join(", ")} - You need to configure the OPENAI_API_KEY in your environment variables`
|
|
65
56
|
);
|
|
66
57
|
}
|
|
67
58
|
},
|
|
68
59
|
models: {
|
|
69
|
-
[ModelType.TEXT_EMBEDDING]: async (
|
|
60
|
+
[ModelType.TEXT_EMBEDDING]: async (_runtime, params) => {
|
|
70
61
|
if (params === null) {
|
|
71
62
|
logger.debug("Creating test embedding for initialization");
|
|
72
63
|
const testVector = Array(1536).fill(0);
|
|
@@ -104,9 +95,7 @@ var openaiPlugin = {
|
|
|
104
95
|
})
|
|
105
96
|
});
|
|
106
97
|
if (!response.ok) {
|
|
107
|
-
logger.error(
|
|
108
|
-
`OpenAI API error: ${response.status} - ${response.statusText}`
|
|
109
|
-
);
|
|
98
|
+
logger.error(`OpenAI API error: ${response.status} - ${response.statusText}`);
|
|
110
99
|
const errorVector = Array(1536).fill(0);
|
|
111
100
|
errorVector[0] = 0.4;
|
|
112
101
|
return errorVector;
|
|
@@ -305,9 +294,10 @@ var openaiPlugin = {
|
|
|
305
294
|
const model = runtime.getSetting("OPENAI_SMALL_MODEL") ?? runtime.getSetting("SMALL_MODEL") ?? "gpt-4o-mini";
|
|
306
295
|
try {
|
|
307
296
|
if (params.schema) {
|
|
297
|
+
logger.info("Using OBJECT_SMALL without schema validation");
|
|
308
298
|
const { object: object2 } = await generateObject({
|
|
309
299
|
model: openai.languageModel(model),
|
|
310
|
-
|
|
300
|
+
output: "no-schema",
|
|
311
301
|
prompt: params.prompt,
|
|
312
302
|
temperature: params.temperature
|
|
313
303
|
});
|
|
@@ -334,9 +324,10 @@ var openaiPlugin = {
|
|
|
334
324
|
const model = runtime.getSetting("OPENAI_LARGE_MODEL") ?? runtime.getSetting("LARGE_MODEL") ?? "gpt-4o";
|
|
335
325
|
try {
|
|
336
326
|
if (params.schema) {
|
|
327
|
+
logger.info("Using OBJECT_LARGE without schema validation");
|
|
337
328
|
const { object: object2 } = await generateObject({
|
|
338
329
|
model: openai.languageModel(model),
|
|
339
|
-
|
|
330
|
+
output: "no-schema",
|
|
340
331
|
prompt: params.prompt,
|
|
341
332
|
temperature: params.temperature
|
|
342
333
|
});
|
|
@@ -371,9 +362,7 @@ var openaiPlugin = {
|
|
|
371
362
|
const data = await response.json();
|
|
372
363
|
logger.log("Models Available:", data?.data.length);
|
|
373
364
|
if (!response.ok) {
|
|
374
|
-
throw new Error(
|
|
375
|
-
`Failed to validate OpenAI API key: ${response.statusText}`
|
|
376
|
-
);
|
|
365
|
+
throw new Error(`Failed to validate OpenAI API key: ${response.statusText}`);
|
|
377
366
|
}
|
|
378
367
|
}
|
|
379
368
|
},
|
|
@@ -381,12 +370,9 @@ var openaiPlugin = {
|
|
|
381
370
|
name: "openai_test_text_embedding",
|
|
382
371
|
fn: async (runtime) => {
|
|
383
372
|
try {
|
|
384
|
-
const embedding = await runtime.useModel(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
text: "Hello, world!"
|
|
388
|
-
}
|
|
389
|
-
);
|
|
373
|
+
const embedding = await runtime.useModel(ModelType.TEXT_EMBEDDING, {
|
|
374
|
+
text: "Hello, world!"
|
|
375
|
+
});
|
|
390
376
|
logger.log("embedding", embedding);
|
|
391
377
|
} catch (error) {
|
|
392
378
|
logger.error("Error in test_text_embedding:", error);
|
|
@@ -458,10 +444,7 @@ var openaiPlugin = {
|
|
|
458
444
|
if (result && typeof result === "object" && "title" in result && "description" in result) {
|
|
459
445
|
logger.log("Image description:", result);
|
|
460
446
|
} else {
|
|
461
|
-
logger.error(
|
|
462
|
-
"Invalid image description result format:",
|
|
463
|
-
result
|
|
464
|
-
);
|
|
447
|
+
logger.error("Invalid image description result format:", result);
|
|
465
448
|
}
|
|
466
449
|
} catch (e) {
|
|
467
450
|
logger.error("Error in image description test:", e);
|
|
@@ -495,14 +478,9 @@ var openaiPlugin = {
|
|
|
495
478
|
name: "openai_test_text_tokenizer_encode",
|
|
496
479
|
fn: async (runtime) => {
|
|
497
480
|
const prompt = "Hello tokenizer encode!";
|
|
498
|
-
const tokens = await runtime.useModel(
|
|
499
|
-
ModelType.TEXT_TOKENIZER_ENCODE,
|
|
500
|
-
{ prompt }
|
|
501
|
-
);
|
|
481
|
+
const tokens = await runtime.useModel(ModelType.TEXT_TOKENIZER_ENCODE, { prompt });
|
|
502
482
|
if (!Array.isArray(tokens) || tokens.length === 0) {
|
|
503
|
-
throw new Error(
|
|
504
|
-
"Failed to tokenize text: expected non-empty array of tokens"
|
|
505
|
-
);
|
|
483
|
+
throw new Error("Failed to tokenize text: expected non-empty array of tokens");
|
|
506
484
|
}
|
|
507
485
|
logger.log("Tokenized output:", tokens);
|
|
508
486
|
}
|
|
@@ -511,14 +489,8 @@ var openaiPlugin = {
|
|
|
511
489
|
name: "openai_test_text_tokenizer_decode",
|
|
512
490
|
fn: async (runtime) => {
|
|
513
491
|
const prompt = "Hello tokenizer decode!";
|
|
514
|
-
const tokens = await runtime.useModel(
|
|
515
|
-
|
|
516
|
-
{ prompt }
|
|
517
|
-
);
|
|
518
|
-
const decodedText = await runtime.useModel(
|
|
519
|
-
ModelType.TEXT_TOKENIZER_DECODE,
|
|
520
|
-
{ tokens }
|
|
521
|
-
);
|
|
492
|
+
const tokens = await runtime.useModel(ModelType.TEXT_TOKENIZER_ENCODE, { prompt });
|
|
493
|
+
const decodedText = await runtime.useModel(ModelType.TEXT_TOKENIZER_DECODE, { tokens });
|
|
522
494
|
if (decodedText !== prompt) {
|
|
523
495
|
throw new Error(
|
|
524
496
|
`Decoded text does not match original. Expected "${prompt}", got "${decodedText}"`
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createOpenAI } from \"@ai-sdk/openai\";\nimport type {\n\tImageDescriptionParams,\n\tModelTypeName,\n\tObjectGenerationParams,\n\tPlugin,\n\tTextEmbeddingParams,\n} from \"@elizaos/core\";\nimport {\n\ttype DetokenizeTextParams,\n\ttype GenerateTextParams,\n\tModelType,\n\ttype TokenizeTextParams,\n\tlogger,\n} from \"@elizaos/core\";\nimport { generateObject, generateText } from \"ai\";\nimport { type TiktokenModel, encodingForModel } from \"js-tiktoken\";\nimport { z } from \"zod\";\n\n/**\n * Asynchronously tokenizes the given text based on the specified model and prompt.\n *\n * @param {ModelTypeName} model - The type of model to use for tokenization.\n * @param {string} prompt - The text prompt to tokenize.\n * @returns {number[]} - An array of tokens representing the encoded prompt.\n */\nasync function tokenizeText(model: ModelTypeName, prompt: string) {\n\tconst modelName =\n\t\tmodel === ModelType.TEXT_SMALL\n\t\t\t? (process.env.OPENAI_SMALL_MODEL ??\n\t\t\t\tprocess.env.SMALL_MODEL ??\n\t\t\t\t\"gpt-4o-mini\")\n\t\t\t: (process.env.LARGE_MODEL ?? \"gpt-4o\");\n\tconst encoding = encodingForModel(modelName as TiktokenModel);\n\tconst tokens = encoding.encode(prompt);\n\treturn tokens;\n}\n\n/**\n * Detokenize a sequence of tokens back into text using the specified model.\n *\n * @param {ModelTypeName} model - The type of model to use for detokenization.\n * @param {number[]} tokens - The sequence of tokens to detokenize.\n * @returns {string} The detokenized text.\n */\nasync function detokenizeText(model: ModelTypeName, tokens: number[]) {\n\tconst modelName =\n\t\tmodel === ModelType.TEXT_SMALL\n\t\t\t? (process.env.OPENAI_SMALL_MODEL ??\n\t\t\t\tprocess.env.SMALL_MODEL ??\n\t\t\t\t\"gpt-4o-mini\")\n\t\t\t: (process.env.OPENAI_LARGE_MODEL ?? process.env.LARGE_MODEL ?? \"gpt-4o\");\n\tconst encoding = encodingForModel(modelName as TiktokenModel);\n\treturn encoding.decode(tokens);\n}\n\n/**\n * Defines the OpenAI plugin with its name, description, and configuration options.\n * @type {Plugin}\n */\nexport const openaiPlugin: Plugin = {\n\tname: \"openai\",\n\tdescription: \"OpenAI plugin\",\n\tconfig: {\n\t\tOPENAI_API_KEY: process.env.OPENAI_API_KEY,\n\t\tOPENAI_BASE_URL: process.env.OPENAI_BASE_URL,\n\t\tOPENAI_SMALL_MODEL: process.env.OPENAI_SMALL_MODEL,\n\t\tOPENAI_LARGE_MODEL: process.env.OPENAI_LARGE_MODEL,\n\t\tSMALL_MODEL: process.env.SMALL_MODEL,\n\t\tLARGE_MODEL: process.env.LARGE_MODEL,\n\t},\n\tasync init(config: Record<string, string>) {\n\t\ttry {\n\t\t\t// const validatedConfig = await configSchema.parseAsync(config);\n\n\t\t\t// // Set all environment variables at once\n\t\t\t// for (const [key, value] of Object.entries(validatedConfig)) {\n\t\t\t// \tif (value) process.env[key] = value;\n\t\t\t// }\n\n\t\t\t// If API key is not set, we'll show a warning but continue\n\t\t\tif (!process.env.OPENAI_API_KEY) {\n\t\t\t\tlogger.warn(\n\t\t\t\t\t\"OPENAI_API_KEY is not set in environment - OpenAI functionality will be limited\",\n\t\t\t\t);\n\t\t\t\t// Return early without throwing an error\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Verify API key only if we have one\n\t\t\ttry {\n\t\t\t\tconst baseURL =\n\t\t\t\t\tprocess.env.OPENAI_BASE_URL ?? \"https://api.openai.com/v1\";\n\t\t\t\tconst response = await fetch(`${baseURL}/models`, {\n\t\t\t\t\theaders: { Authorization: `Bearer ${process.env.OPENAI_API_KEY}` },\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t`OpenAI API key validation failed: ${response.statusText}`,\n\t\t\t\t\t);\n\t\t\t\t\tlogger.warn(\n\t\t\t\t\t\t\"OpenAI functionality will be limited until a valid API key is provided\",\n\t\t\t\t\t);\n\t\t\t\t\t// Continue execution instead of throwing\n\t\t\t\t} else {\n\t\t\t\t\t// logger.log(\"OpenAI API key validated successfully\");\n\t\t\t\t}\n\t\t\t} catch (fetchError) {\n\t\t\t\tlogger.warn(`Error validating OpenAI API key: ${fetchError}`);\n\t\t\t\tlogger.warn(\n\t\t\t\t\t\"OpenAI functionality will be limited until a valid API key is provided\",\n\t\t\t\t);\n\t\t\t\t// Continue execution instead of throwing\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t\t// Convert to warning instead of error\n\t\t\t\tlogger.warn(\n\t\t\t\t\t`OpenAI plugin configuration issue: ${error.errors\n\t\t\t\t\t\t.map((e) => e.message)\n\t\t\t\t\t\t.join(\n\t\t\t\t\t\t\t\", \",\n\t\t\t\t\t\t)} - You need to configure the OPENAI_API_KEY in your environment variables`,\n\t\t\t\t);\n\t\t}\n\t},\n\tmodels: {\n\t\t[ModelType.TEXT_EMBEDDING]: async (\n\t\t\truntime,\n\t\t\tparams: TextEmbeddingParams | string | null,\n\t\t): Promise<number[]> => {\n\t\t\t// Handle null input (initialization case)\n\t\t\tif (params === null) {\n\t\t\t\tlogger.debug(\"Creating test embedding for initialization\");\n\t\t\t\t// Return a consistent vector for null input\n\t\t\t\tconst testVector = Array(1536).fill(0);\n\t\t\t\ttestVector[0] = 0.1; // Make it non-zero\n\t\t\t\treturn testVector;\n\t\t\t}\n\n\t\t\t// Get the text from whatever format was provided\n\t\t\tlet text: string;\n\t\t\tif (typeof params === \"string\") {\n\t\t\t\ttext = params; // Direct string input\n\t\t\t} else if (typeof params === \"object\" && params.text) {\n\t\t\t\ttext = params.text; // Object with text property\n\t\t\t} else {\n\t\t\t\tlogger.warn(\"Invalid input format for embedding\");\n\t\t\t\t// Return a fallback for invalid input\n\t\t\t\tconst fallbackVector = Array(1536).fill(0);\n\t\t\t\tfallbackVector[0] = 0.2; // Different value for tracking\n\t\t\t\treturn fallbackVector;\n\t\t\t}\n\n\t\t\t// Skip API call for empty text\n\t\t\tif (!text.trim()) {\n\t\t\t\tlogger.warn(\"Empty text for embedding\");\n\t\t\t\tconst emptyVector = Array(1536).fill(0);\n\t\t\t\temptyVector[0] = 0.3; // Different value for tracking\n\t\t\t\treturn emptyVector;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst baseURL =\n\t\t\t\t\tprocess.env.OPENAI_BASE_URL ?? \"https://api.openai.com/v1\";\n\n\t\t\t\t// Call the OpenAI API\n\t\t\t\tconst response = await fetch(`${baseURL}/embeddings`, {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\theaders: {\n\t\t\t\t\t\tAuthorization: `Bearer ${process.env.OPENAI_API_KEY}`,\n\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t},\n\t\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\t\tmodel: \"text-embedding-3-small\",\n\t\t\t\t\t\tinput: text,\n\t\t\t\t\t}),\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tlogger.error(\n\t\t\t\t\t\t`OpenAI API error: ${response.status} - ${response.statusText}`,\n\t\t\t\t\t);\n\t\t\t\t\tconst errorVector = Array(1536).fill(0);\n\t\t\t\t\terrorVector[0] = 0.4; // Different value for tracking\n\t\t\t\t\treturn errorVector;\n\t\t\t\t}\n\n\t\t\t\tconst data = (await response.json()) as {\n\t\t\t\t\tdata: [{ embedding: number[] }];\n\t\t\t\t};\n\n\t\t\t\tif (!data?.data?.[0]?.embedding) {\n\t\t\t\t\tlogger.error(\"API returned invalid structure\");\n\t\t\t\t\tconst errorVector = Array(1536).fill(0);\n\t\t\t\t\terrorVector[0] = 0.5; // Different value for tracking\n\t\t\t\t\treturn errorVector;\n\t\t\t\t}\n\n\t\t\t\tconst embedding = data.data[0].embedding;\n\t\t\t\tlogger.log(`Got valid embedding with length ${embedding.length}`);\n\t\t\t\treturn embedding;\n\t\t\t} catch (error) {\n\t\t\t\tlogger.error(\"Error generating embedding:\", error);\n\t\t\t\tconst errorVector = Array(1536).fill(0);\n\t\t\t\terrorVector[0] = 0.6; // Different value for tracking\n\t\t\t\treturn errorVector;\n\t\t\t}\n\t\t},\n\t\t[ModelType.TEXT_TOKENIZER_ENCODE]: async (\n\t\t\t_runtime,\n\t\t\t{ prompt, modelType = ModelType.TEXT_LARGE }: TokenizeTextParams,\n\t\t) => {\n\t\t\treturn await tokenizeText(modelType ?? ModelType.TEXT_LARGE, prompt);\n\t\t},\n\t\t[ModelType.TEXT_TOKENIZER_DECODE]: async (\n\t\t\t_runtime,\n\t\t\t{ tokens, modelType = ModelType.TEXT_LARGE }: DetokenizeTextParams,\n\t\t) => {\n\t\t\treturn await detokenizeText(modelType ?? ModelType.TEXT_LARGE, tokens);\n\t\t},\n\t\t[ModelType.TEXT_SMALL]: async (\n\t\t\truntime,\n\t\t\t{ prompt, stopSequences = [] }: GenerateTextParams,\n\t\t) => {\n\t\t\tconst temperature = 0.7;\n\t\t\tconst frequency_penalty = 0.7;\n\t\t\tconst presence_penalty = 0.7;\n\t\t\tconst max_response_length = 8192;\n\n\t\t\tconst baseURL =\n\t\t\t\truntime.getSetting(\"OPENAI_BASE_URL\") ?? \"https://api.openai.com/v1\";\n\n\t\t\tconst openai = createOpenAI({\n\t\t\t\tapiKey: runtime.getSetting(\"OPENAI_API_KEY\"),\n\t\t\t\tbaseURL,\n\t\t\t});\n\n\t\t\tconst model =\n\t\t\t\truntime.getSetting(\"OPENAI_SMALL_MODEL\") ??\n\t\t\t\truntime.getSetting(\"SMALL_MODEL\") ??\n\t\t\t\t\"gpt-4o-mini\";\n\n\t\t\tlogger.log(\"generating text\");\n\t\t\tlogger.log(prompt);\n\n\t\t\tconst { text: openaiResponse } = await generateText({\n\t\t\t\tmodel: openai.languageModel(model),\n\t\t\t\tprompt: prompt,\n\t\t\t\tsystem: runtime.character.system ?? undefined,\n\t\t\t\ttemperature: temperature,\n\t\t\t\tmaxTokens: max_response_length,\n\t\t\t\tfrequencyPenalty: frequency_penalty,\n\t\t\t\tpresencePenalty: presence_penalty,\n\t\t\t\tstopSequences: stopSequences,\n\t\t\t});\n\n\t\t\treturn openaiResponse;\n\t\t},\n\t\t[ModelType.TEXT_LARGE]: async (\n\t\t\truntime,\n\t\t\t{\n\t\t\t\tprompt,\n\t\t\t\tstopSequences = [],\n\t\t\t\tmaxTokens = 8192,\n\t\t\t\ttemperature = 0.7,\n\t\t\t\tfrequencyPenalty = 0.7,\n\t\t\t\tpresencePenalty = 0.7,\n\t\t\t}: GenerateTextParams,\n\t\t) => {\n\t\t\tconst baseURL =\n\t\t\t\truntime.getSetting(\"OPENAI_BASE_URL\") ?? \"https://api.openai.com/v1\";\n\n\t\t\tconst openai = createOpenAI({\n\t\t\t\tapiKey: runtime.getSetting(\"OPENAI_API_KEY\"),\n\t\t\t\tbaseURL,\n\t\t\t});\n\n\t\t\tconst model =\n\t\t\t\truntime.getSetting(\"OPENAI_LARGE_MODEL\") ??\n\t\t\t\truntime.getSetting(\"LARGE_MODEL\") ??\n\t\t\t\t\"gpt-4o\";\n\n\t\t\tconst { text: openaiResponse } = await generateText({\n\t\t\t\tmodel: openai.languageModel(model),\n\t\t\t\tprompt: prompt,\n\t\t\t\tsystem: runtime.character.system ?? undefined,\n\t\t\t\ttemperature: temperature,\n\t\t\t\tmaxTokens: maxTokens,\n\t\t\t\tfrequencyPenalty: frequencyPenalty,\n\t\t\t\tpresencePenalty: presencePenalty,\n\t\t\t\tstopSequences: stopSequences,\n\t\t\t});\n\n\t\t\treturn openaiResponse;\n\t\t},\n\t\t[ModelType.IMAGE]: async (\n\t\t\truntime,\n\t\t\tparams: {\n\t\t\t\tprompt: string;\n\t\t\t\tn?: number;\n\t\t\t\tsize?: string;\n\t\t\t},\n\t\t) => {\n\t\t\tconst baseURL =\n\t\t\t\truntime.getSetting(\"OPENAI_BASE_URL\") ?? \"https://api.openai.com/v1\";\n\t\t\tconst response = await fetch(`${baseURL}/images/generations`, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${runtime.getSetting(\"OPENAI_API_KEY\")}`,\n\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t},\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\tprompt: params.prompt,\n\t\t\t\t\tn: params.n || 1,\n\t\t\t\t\tsize: params.size || \"1024x1024\",\n\t\t\t\t}),\n\t\t\t});\n\t\t\tif (!response.ok) {\n\t\t\t\tthrow new Error(`Failed to generate image: ${response.statusText}`);\n\t\t\t}\n\t\t\tconst data = await response.json();\n\t\t\tconst typedData = data as { data: { url: string }[] };\n\t\t\treturn typedData.data;\n\t\t},\n\t\t[ModelType.IMAGE_DESCRIPTION]: async (\n\t\t\truntime,\n\t\t\tparams: ImageDescriptionParams | string,\n\t\t) => {\n\t\t\t// Handle string case (direct URL)\n\t\t\tlet imageUrl: string;\n\t\t\tlet prompt: string | undefined;\n\n\t\t\tif (typeof params === \"string\") {\n\t\t\t\timageUrl = params;\n\t\t\t\tprompt = undefined;\n\t\t\t} else {\n\t\t\t\t// Object parameter case\n\t\t\t\timageUrl = params.imageUrl;\n\t\t\t\tprompt = params.prompt;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst baseURL =\n\t\t\t\t\tprocess.env.OPENAI_BASE_URL ?? \"https://api.openai.com/v1\";\n\t\t\t\tconst apiKey = process.env.OPENAI_API_KEY;\n\n\t\t\t\tif (!apiKey) {\n\t\t\t\t\tlogger.error(\"OpenAI API key not set\");\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttitle: \"Failed to analyze image\",\n\t\t\t\t\t\tdescription: \"API key not configured\",\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Call the GPT-4 Vision API\n\t\t\t\tconst response = await fetch(`${baseURL}/chat/completions`, {\n\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\theaders: {\n\t\t\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\t\tAuthorization: `Bearer ${apiKey}`,\n\t\t\t\t\t},\n\t\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\t\tmodel: \"gpt-4-vision-preview\",\n\t\t\t\t\t\tmessages: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\trole: \"user\",\n\t\t\t\t\t\t\t\tcontent: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: \"text\",\n\t\t\t\t\t\t\t\t\t\ttext:\n\t\t\t\t\t\t\t\t\t\t\tprompt ||\n\t\t\t\t\t\t\t\t\t\t\t\"Please analyze this image and provide a title and detailed description.\",\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: \"image_url\",\n\t\t\t\t\t\t\t\t\t\timage_url: { url: imageUrl },\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tmax_tokens: 300,\n\t\t\t\t\t}),\n\t\t\t\t});\n\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new Error(`OpenAI API error: ${response.status}`);\n\t\t\t\t}\n\n\t\t\t\tconst result: any = await response.json();\n\t\t\t\tconst content = result.choices?.[0]?.message?.content;\n\n\t\t\t\tif (!content) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttitle: \"Failed to analyze image\",\n\t\t\t\t\t\tdescription: \"No response from API\",\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Extract title and description\n\t\t\t\tconst titleMatch = content.match(/title[:\\s]+(.+?)(?:\\n|$)/i);\n\t\t\t\tconst title = titleMatch?.[1] || \"Image Analysis\";\n\n\t\t\t\t// Rest of content is the description\n\t\t\t\tconst description = content\n\t\t\t\t\t.replace(/title[:\\s]+(.+?)(?:\\n|$)/i, \"\")\n\t\t\t\t\t.trim();\n\n\t\t\t\treturn { title, description };\n\t\t\t} catch (error) {\n\t\t\t\tlogger.error(\"Error analyzing image:\", error);\n\t\t\t\treturn {\n\t\t\t\t\ttitle: \"Failed to analyze image\",\n\t\t\t\t\tdescription: `Error: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\t[ModelType.TRANSCRIPTION]: async (runtime, audioBuffer: Buffer) => {\n\t\t\tlogger.log(\"audioBuffer\", audioBuffer);\n\t\t\tconst baseURL =\n\t\t\t\truntime.getSetting(\"OPENAI_BASE_URL\") ?? \"https://api.openai.com/v1\";\n\t\t\tconst formData = new FormData();\n\t\t\tformData.append(\"file\", new Blob([audioBuffer], { type: \"audio/mp3\" }));\n\t\t\tformData.append(\"model\", \"whisper-1\");\n\t\t\tconst response = await fetch(`${baseURL}/audio/transcriptions`, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${runtime.getSetting(\"OPENAI_API_KEY\")}`,\n\t\t\t\t\t// Note: Do not set a Content-Type header—letting fetch set it for FormData is best\n\t\t\t\t},\n\t\t\t\tbody: formData,\n\t\t\t});\n\n\t\t\tlogger.log(\"response\", response);\n\t\t\tif (!response.ok) {\n\t\t\t\tthrow new Error(`Failed to transcribe audio: ${response.statusText}`);\n\t\t\t}\n\t\t\tconst data = (await response.json()) as { text: string };\n\t\t\treturn data.text;\n\t\t},\n\t\t[ModelType.OBJECT_SMALL]: async (runtime, params: ObjectGenerationParams) => {\n\t\t\tconst baseURL = runtime.getSetting(\"OPENAI_BASE_URL\") ?? \"https://api.openai.com/v1\";\n\t\t\tconst openai = createOpenAI({\n\t\t\t\tapiKey: runtime.getSetting(\"OPENAI_API_KEY\"),\n\t\t\t\tbaseURL,\n\t\t\t});\n\t\t\tconst model = runtime.getSetting(\"OPENAI_SMALL_MODEL\") ?? runtime.getSetting(\"SMALL_MODEL\") ?? \"gpt-4o-mini\";\n\t\t\t\n\t\t\ttry {\n\t\t\t\tif (params.schema) {\n\t\t\t\t\tconst { object } = await generateObject({\n\t\t\t\t\t\tmodel: openai.languageModel(model),\n\t\t\t\t\t\tschema: z.object(params.schema),\n\t\t\t\t\t\tprompt: params.prompt,\n\t\t\t\t\t\ttemperature: params.temperature,\n\t\t\t\t\t});\n\t\t\t\t\treturn object;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst { object } = await generateObject({\n\t\t\t\t\tmodel: openai.languageModel(model),\n\t\t\t\t\toutput: 'no-schema',\n\t\t\t\t\tprompt: params.prompt,\n\t\t\t\t\ttemperature: params.temperature,\n\t\t\t\t});\n\t\t\t\treturn object;\n\t\t\t} catch (error) {\n\t\t\t\tlogger.error(\"Error generating object:\", error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t},\n\t\t[ModelType.OBJECT_LARGE]: async (runtime, params: ObjectGenerationParams) => {\n\t\t\tconst baseURL = runtime.getSetting(\"OPENAI_BASE_URL\") ?? \"https://api.openai.com/v1\";\n\t\t\tconst openai = createOpenAI({\n\t\t\t\tapiKey: runtime.getSetting(\"OPENAI_API_KEY\"),\n\t\t\t\tbaseURL,\n\t\t\t});\n\t\t\tconst model = runtime.getSetting(\"OPENAI_LARGE_MODEL\") ?? runtime.getSetting(\"LARGE_MODEL\") ?? \"gpt-4o\";\n\t\t\t\n\t\t\ttry {\n\t\t\t\tif (params.schema) {\n\t\t\t\t\tconst { object } = await generateObject({\n\t\t\t\t\t\tmodel: openai.languageModel(model),\n\t\t\t\t\t\tschema: z.object(params.schema),\n\t\t\t\t\t\tprompt: params.prompt,\n\t\t\t\t\t\ttemperature: params.temperature,\n\t\t\t\t\t});\n\t\t\t\t\treturn object;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tconst { object } = await generateObject({\n\t\t\t\t\tmodel: openai.languageModel(model),\n\t\t\t\t\toutput: 'no-schema',\n\t\t\t\t\tprompt: params.prompt,\n\t\t\t\t\ttemperature: params.temperature,\n\t\t\t\t});\n\t\t\t\treturn object;\n\t\t\t} catch (error) {\n\t\t\t\tlogger.error(\"Error generating object:\", error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t},\n\t},\n\ttests: [\n\t\t{\n\t\t\tname: \"openai_plugin_tests\",\n\t\t\ttests: [\n\t\t\t\t{\n\t\t\t\t\tname: \"openai_test_url_and_api_key_validation\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\tconst baseURL =\n\t\t\t\t\t\t\truntime.getSetting(\"OPENAI_BASE_URL\") ??\n\t\t\t\t\t\t\t\"https://api.openai.com/v1\";\n\t\t\t\t\t\tconst response = await fetch(`${baseURL}/models`, {\n\t\t\t\t\t\t\theaders: {\n\t\t\t\t\t\t\t\tAuthorization: `Bearer ${runtime.getSetting(\"OPENAI_API_KEY\")}`,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst data = await response.json();\n\t\t\t\t\t\tlogger.log(\"Models Available:\", (data as any)?.data.length);\n\t\t\t\t\t\tif (!response.ok) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Failed to validate OpenAI API key: ${response.statusText}`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"openai_test_text_embedding\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst embedding = await runtime.useModel(\n\t\t\t\t\t\t\t\tModelType.TEXT_EMBEDDING,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttext: \"Hello, world!\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tlogger.log(\"embedding\", embedding);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlogger.error(\"Error in test_text_embedding:\", error);\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"openai_test_text_large\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst text = await runtime.useModel(ModelType.TEXT_LARGE, {\n\t\t\t\t\t\t\t\tprompt: \"What is the nature of reality in 10 words?\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (text.length === 0) {\n\t\t\t\t\t\t\t\tthrow new Error(\"Failed to generate text\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlogger.log(\"generated with test_text_large:\", text);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlogger.error(\"Error in test_text_large:\", error);\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"openai_test_text_small\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst text = await runtime.useModel(ModelType.TEXT_SMALL, {\n\t\t\t\t\t\t\t\tprompt: \"What is the nature of reality in 10 words?\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (text.length === 0) {\n\t\t\t\t\t\t\t\tthrow new Error(\"Failed to generate text\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlogger.log(\"generated with test_text_small:\", text);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlogger.error(\"Error in test_text_small:\", error);\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"openai_test_image_generation\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\tlogger.log(\"openai_test_image_generation\");\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst image = await runtime.useModel(ModelType.IMAGE, {\n\t\t\t\t\t\t\t\tprompt: \"A beautiful sunset over a calm ocean\",\n\t\t\t\t\t\t\t\tn: 1,\n\t\t\t\t\t\t\t\tsize: \"1024x1024\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tlogger.log(\"generated with test_image_generation:\", image);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlogger.error(\"Error in test_image_generation:\", error);\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"image-description\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tlogger.log(\"openai_test_image_description\");\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tconst result = await runtime.useModel(\n\t\t\t\t\t\t\t\t\tModelType.IMAGE_DESCRIPTION,\n\t\t\t\t\t\t\t\t\t\"https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Vitalik_Buterin_TechCrunch_London_2015_%28cropped%29.jpg/537px-Vitalik_Buterin_TechCrunch_London_2015_%28cropped%29.jpg\",\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t// Check if result has the expected structure\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tresult &&\n\t\t\t\t\t\t\t\t\ttypeof result === \"object\" &&\n\t\t\t\t\t\t\t\t\t\"title\" in result &&\n\t\t\t\t\t\t\t\t\t\"description\" in result\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tlogger.log(\"Image description:\", result);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tlogger.error(\n\t\t\t\t\t\t\t\t\t\t\"Invalid image description result format:\",\n\t\t\t\t\t\t\t\t\t\tresult,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\t\tlogger.error(\"Error in image description test:\", e);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tlogger.error(\"Error in openai_test_image_description:\", e);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"openai_test_transcription\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\tlogger.log(\"openai_test_transcription\");\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst response = await fetch(\n\t\t\t\t\t\t\t\t\"https://upload.wikimedia.org/wikipedia/en/4/40/Chris_Benoit_Voice_Message.ogg\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tconst arrayBuffer = await response.arrayBuffer();\n\t\t\t\t\t\t\tconst transcription = await runtime.useModel(\n\t\t\t\t\t\t\t\tModelType.TRANSCRIPTION,\n\t\t\t\t\t\t\t\tBuffer.from(new Uint8Array(arrayBuffer)),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tlogger.log(\"generated with test_transcription:\", transcription);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tlogger.error(\"Error in test_transcription:\", error);\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"openai_test_text_tokenizer_encode\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\tconst prompt = \"Hello tokenizer encode!\";\n\t\t\t\t\t\tconst tokens = await runtime.useModel(\n\t\t\t\t\t\t\tModelType.TEXT_TOKENIZER_ENCODE,\n\t\t\t\t\t\t\t{ prompt },\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (!Array.isArray(tokens) || tokens.length === 0) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\"Failed to tokenize text: expected non-empty array of tokens\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlogger.log(\"Tokenized output:\", tokens);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: \"openai_test_text_tokenizer_decode\",\n\t\t\t\t\tfn: async (runtime) => {\n\t\t\t\t\t\tconst prompt = \"Hello tokenizer decode!\";\n\t\t\t\t\t\t// Encode the string into tokens first\n\t\t\t\t\t\tconst tokens = await runtime.useModel(\n\t\t\t\t\t\t\tModelType.TEXT_TOKENIZER_ENCODE,\n\t\t\t\t\t\t\t{ prompt },\n\t\t\t\t\t\t);\n\t\t\t\t\t\t// Now decode tokens back into text\n\t\t\t\t\t\tconst decodedText = await runtime.useModel(\n\t\t\t\t\t\t\tModelType.TEXT_TOKENIZER_DECODE,\n\t\t\t\t\t\t\t{ tokens },\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (decodedText !== prompt) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Decoded text does not match original. Expected \"${prompt}\", got \"${decodedText}\"`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlogger.log(\"Decoded text:\", decodedText);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\nexport default openaiPlugin;\n"],"mappings":";AAAA,SAAS,oBAAoB;AAQ7B;AAAA,EAGC;AAAA,EAEA;AAAA,OACM;AACP,SAAS,gBAAgB,oBAAoB;AAC7C,SAA6B,wBAAwB;AACrD,SAAS,SAAS;AASlB,eAAe,aAAa,OAAsB,QAAgB;AACjE,QAAM,YACL,UAAU,UAAU,aAChB,QAAQ,IA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A,kBAAM,cAAc,MAAM,QAAQ;AAAA,cACjC,UAAU;AAAA,cACV,EAAE,OAAO;AAAA,YACV;AACA,gBAAI,gBAAgB,QAAQ;AAC3B,oBAAM,IAAI;AAAA,gBACT,mDAAmD,MAAM,WAAW,WAAW;AAAA,cAChF;AAAA,YACD;AACA,mBAAO,IAAI,iBAAiB,WAAW;AAAA,UACxC;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AACA,IAAO,gBAAQ;","names":["object"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createOpenAI } from '@ai-sdk/openai';\nimport type {\n ImageDescriptionParams,\n ModelTypeName,\n ObjectGenerationParams,\n Plugin,\n TextEmbeddingParams,\n} from '@elizaos/core';\nimport {\n type DetokenizeTextParams,\n type GenerateTextParams,\n ModelType,\n type TokenizeTextParams,\n logger,\n} from '@elizaos/core';\nimport { generateObject, generateText } from 'ai';\nimport { type TiktokenModel, encodingForModel } from 'js-tiktoken';\nimport { z } from 'zod';\n\n/**\n * Asynchronously tokenizes the given text based on the specified model and prompt.\n *\n * @param {ModelTypeName} model - The type of model to use for tokenization.\n * @param {string} prompt - The text prompt to tokenize.\n * @returns {number[]} - An array of tokens representing the encoded prompt.\n */\nasync function tokenizeText(model: ModelTypeName, prompt: string) {\n const modelName =\n model === ModelType.TEXT_SMALL\n ? (process.env.OPENAI_SMALL_MODEL ?? process.env.SMALL_MODEL ?? 'gpt-4o-mini')\n : (process.env.LARGE_MODEL ?? 'gpt-4o');\n const encoding = encodingForModel(modelName as TiktokenModel);\n const tokens = encoding.encode(prompt);\n return tokens;\n}\n\n/**\n * Detokenize a sequence of tokens back into text using the specified model.\n *\n * @param {ModelTypeName} model - The type of model to use for detokenization.\n * @param {number[]} tokens - The sequence of tokens to detokenize.\n * @returns {string} The detokenized text.\n */\nasync function detokenizeText(model: ModelTypeName, tokens: number[]) {\n const modelName =\n model === ModelType.TEXT_SMALL\n ? (process.env.OPENAI_SMALL_MODEL ?? process.env.SMALL_MODEL ?? 'gpt-4o-mini')\n : (process.env.OPENAI_LARGE_MODEL ?? process.env.LARGE_MODEL ?? 'gpt-4o');\n const encoding = encodingForModel(modelName as TiktokenModel);\n return encoding.decode(tokens);\n}\n\n/**\n * Defines the OpenAI plugin with its name, description, and configuration options.\n * @type {Plugin}\n */\nexport const openaiPlugin: Plugin = {\n name: 'openai',\n description: 'OpenAI plugin',\n config: {\n OPENAI_API_KEY: process.env.OPENAI_API_KEY,\n OPENAI_BASE_URL: process.env.OPENAI_BASE_URL,\n OPENAI_SMALL_MODEL: process.env.OPENAI_SMALL_MODEL,\n OPENAI_LARGE_MODEL: process.env.OPENAI_LARGE_MODEL,\n SMALL_MODEL: process.env.SMALL_MODEL,\n LARGE_MODEL: process.env.LARGE_MODEL,\n },\n async init(config: Record<string, string>) {\n try {\n // const validatedConfig = await configSchema.parseAsync(config);\n\n // // Set all environment variables at once\n // for (const [key, value] of Object.entries(validatedConfig)) {\n // \tif (value) process.env[key] = value;\n // }\n\n // If API key is not set, we'll show a warning but continue\n if (!process.env.OPENAI_API_KEY) {\n logger.warn(\n 'OPENAI_API_KEY is not set in environment - OpenAI functionality will be limited'\n );\n // Return early without throwing an error\n return;\n }\n\n // Verify API key only if we have one\n try {\n const baseURL = process.env.OPENAI_BASE_URL ?? 'https://api.openai.com/v1';\n const response = await fetch(`${baseURL}/models`, {\n headers: { Authorization: `Bearer ${process.env.OPENAI_API_KEY}` },\n });\n\n if (!response.ok) {\n logger.warn(`OpenAI API key validation failed: ${response.statusText}`);\n logger.warn('OpenAI functionality will be limited until a valid API key is provided');\n // Continue execution instead of throwing\n } else {\n // logger.log(\"OpenAI API key validated successfully\");\n }\n } catch (fetchError) {\n logger.warn(`Error validating OpenAI API key: ${fetchError}`);\n logger.warn('OpenAI functionality will be limited until a valid API key is provided');\n // Continue execution instead of throwing\n }\n } catch (error) {\n // Convert to warning instead of error\n logger.warn(\n `OpenAI plugin configuration issue: ${error.errors\n .map((e) => e.message)\n .join(', ')} - You need to configure the OPENAI_API_KEY in your environment variables`\n );\n }\n },\n models: {\n [ModelType.TEXT_EMBEDDING]: async (\n _runtime,\n params: TextEmbeddingParams | string | null\n ): Promise<number[]> => {\n // Handle null input (initialization case)\n if (params === null) {\n logger.debug('Creating test embedding for initialization');\n // Return a consistent vector for null input\n const testVector = Array(1536).fill(0);\n testVector[0] = 0.1; // Make it non-zero\n return testVector;\n }\n\n // Get the text from whatever format was provided\n let text: string;\n if (typeof params === 'string') {\n text = params; // Direct string input\n } else if (typeof params === 'object' && params.text) {\n text = params.text; // Object with text property\n } else {\n logger.warn('Invalid input format for embedding');\n // Return a fallback for invalid input\n const fallbackVector = Array(1536).fill(0);\n fallbackVector[0] = 0.2; // Different value for tracking\n return fallbackVector;\n }\n\n // Skip API call for empty text\n if (!text.trim()) {\n logger.warn('Empty text for embedding');\n const emptyVector = Array(1536).fill(0);\n emptyVector[0] = 0.3; // Different value for tracking\n return emptyVector;\n }\n\n try {\n const baseURL = process.env.OPENAI_BASE_URL ?? 'https://api.openai.com/v1';\n\n // Call the OpenAI API\n const response = await fetch(`${baseURL}/embeddings`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n model: 'text-embedding-3-small',\n input: text,\n }),\n });\n\n if (!response.ok) {\n logger.error(`OpenAI API error: ${response.status} - ${response.statusText}`);\n const errorVector = Array(1536).fill(0);\n errorVector[0] = 0.4; // Different value for tracking\n return errorVector;\n }\n\n const data = (await response.json()) as {\n data: [{ embedding: number[] }];\n };\n\n if (!data?.data?.[0]?.embedding) {\n logger.error('API returned invalid structure');\n const errorVector = Array(1536).fill(0);\n errorVector[0] = 0.5; // Different value for tracking\n return errorVector;\n }\n\n const embedding = data.data[0].embedding;\n logger.log(`Got valid embedding with length ${embedding.length}`);\n return embedding;\n } catch (error) {\n logger.error('Error generating embedding:', error);\n const errorVector = Array(1536).fill(0);\n errorVector[0] = 0.6; // Different value for tracking\n return errorVector;\n }\n },\n [ModelType.TEXT_TOKENIZER_ENCODE]: async (\n _runtime,\n { prompt, modelType = ModelType.TEXT_LARGE }: TokenizeTextParams\n ) => {\n return await tokenizeText(modelType ?? ModelType.TEXT_LARGE, prompt);\n },\n [ModelType.TEXT_TOKENIZER_DECODE]: async (\n _runtime,\n { tokens, modelType = ModelType.TEXT_LARGE }: DetokenizeTextParams\n ) => {\n return await detokenizeText(modelType ?? ModelType.TEXT_LARGE, tokens);\n },\n [ModelType.TEXT_SMALL]: async (runtime, { prompt, stopSequences = [] }: GenerateTextParams) => {\n const temperature = 0.7;\n const frequency_penalty = 0.7;\n const presence_penalty = 0.7;\n const max_response_length = 8192;\n\n const baseURL = runtime.getSetting('OPENAI_BASE_URL') ?? 'https://api.openai.com/v1';\n\n const openai = createOpenAI({\n apiKey: runtime.getSetting('OPENAI_API_KEY'),\n baseURL,\n });\n\n const model =\n runtime.getSetting('OPENAI_SMALL_MODEL') ??\n runtime.getSetting('SMALL_MODEL') ??\n 'gpt-4o-mini';\n\n logger.log('generating text');\n logger.log(prompt);\n\n const { text: openaiResponse } = await generateText({\n model: openai.languageModel(model),\n prompt: prompt,\n system: runtime.character.system ?? undefined,\n temperature: temperature,\n maxTokens: max_response_length,\n frequencyPenalty: frequency_penalty,\n presencePenalty: presence_penalty,\n stopSequences: stopSequences,\n });\n\n return openaiResponse;\n },\n [ModelType.TEXT_LARGE]: async (\n runtime,\n {\n prompt,\n stopSequences = [],\n maxTokens = 8192,\n temperature = 0.7,\n frequencyPenalty = 0.7,\n presencePenalty = 0.7,\n }: GenerateTextParams\n ) => {\n const baseURL = runtime.getSetting('OPENAI_BASE_URL') ?? 'https://api.openai.com/v1';\n\n const openai = createOpenAI({\n apiKey: runtime.getSetting('OPENAI_API_KEY'),\n baseURL,\n });\n\n const model =\n runtime.getSetting('OPENAI_LARGE_MODEL') ?? runtime.getSetting('LARGE_MODEL') ?? 'gpt-4o';\n\n const { text: openaiResponse } = await generateText({\n model: openai.languageModel(model),\n prompt: prompt,\n system: runtime.character.system ?? undefined,\n temperature: temperature,\n maxTokens: maxTokens,\n frequencyPenalty: frequencyPenalty,\n presencePenalty: presencePenalty,\n stopSequences: stopSequences,\n });\n\n return openaiResponse;\n },\n [ModelType.IMAGE]: async (\n runtime,\n params: {\n prompt: string;\n n?: number;\n size?: string;\n }\n ) => {\n const baseURL = runtime.getSetting('OPENAI_BASE_URL') ?? 'https://api.openai.com/v1';\n const response = await fetch(`${baseURL}/images/generations`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${runtime.getSetting('OPENAI_API_KEY')}`,\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n prompt: params.prompt,\n n: params.n || 1,\n size: params.size || '1024x1024',\n }),\n });\n if (!response.ok) {\n throw new Error(`Failed to generate image: ${response.statusText}`);\n }\n const data = await response.json();\n const typedData = data as { data: { url: string }[] };\n return typedData.data;\n },\n [ModelType.IMAGE_DESCRIPTION]: async (runtime, params: ImageDescriptionParams | string) => {\n // Handle string case (direct URL)\n let imageUrl: string;\n let prompt: string | undefined;\n\n if (typeof params === 'string') {\n imageUrl = params;\n prompt = undefined;\n } else {\n // Object parameter case\n imageUrl = params.imageUrl;\n prompt = params.prompt;\n }\n\n try {\n const baseURL = process.env.OPENAI_BASE_URL ?? 'https://api.openai.com/v1';\n const apiKey = process.env.OPENAI_API_KEY;\n\n if (!apiKey) {\n logger.error('OpenAI API key not set');\n return {\n title: 'Failed to analyze image',\n description: 'API key not configured',\n };\n }\n\n // Call the GPT-4 Vision API\n const response = await fetch(`${baseURL}/chat/completions`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${apiKey}`,\n },\n body: JSON.stringify({\n model: 'gpt-4-vision-preview',\n messages: [\n {\n role: 'user',\n content: [\n {\n type: 'text',\n text:\n prompt ||\n 'Please analyze this image and provide a title and detailed description.',\n },\n {\n type: 'image_url',\n image_url: { url: imageUrl },\n },\n ],\n },\n ],\n max_tokens: 300,\n }),\n });\n\n if (!response.ok) {\n throw new Error(`OpenAI API error: ${response.status}`);\n }\n\n const result: any = await response.json();\n const content = result.choices?.[0]?.message?.content;\n\n if (!content) {\n return {\n title: 'Failed to analyze image',\n description: 'No response from API',\n };\n }\n\n // Extract title and description\n const titleMatch = content.match(/title[:\\s]+(.+?)(?:\\n|$)/i);\n const title = titleMatch?.[1] || 'Image Analysis';\n\n // Rest of content is the description\n const description = content.replace(/title[:\\s]+(.+?)(?:\\n|$)/i, '').trim();\n\n return { title, description };\n } catch (error) {\n logger.error('Error analyzing image:', error);\n return {\n title: 'Failed to analyze image',\n description: `Error: ${error instanceof Error ? error.message : String(error)}`,\n };\n }\n },\n [ModelType.TRANSCRIPTION]: async (runtime, audioBuffer: Buffer) => {\n logger.log('audioBuffer', audioBuffer);\n const baseURL = runtime.getSetting('OPENAI_BASE_URL') ?? 'https://api.openai.com/v1';\n const formData = new FormData();\n formData.append('file', new Blob([audioBuffer], { type: 'audio/mp3' }));\n formData.append('model', 'whisper-1');\n const response = await fetch(`${baseURL}/audio/transcriptions`, {\n method: 'POST',\n headers: {\n Authorization: `Bearer ${runtime.getSetting('OPENAI_API_KEY')}`,\n // Note: Do not set a Content-Type header—letting fetch set it for FormData is best\n },\n body: formData,\n });\n\n logger.log('response', response);\n if (!response.ok) {\n throw new Error(`Failed to transcribe audio: ${response.statusText}`);\n }\n const data = (await response.json()) as { text: string };\n return data.text;\n },\n [ModelType.OBJECT_SMALL]: async (runtime, params: ObjectGenerationParams) => {\n const baseURL = runtime.getSetting('OPENAI_BASE_URL') ?? 'https://api.openai.com/v1';\n const openai = createOpenAI({\n apiKey: runtime.getSetting('OPENAI_API_KEY'),\n baseURL,\n });\n const model =\n runtime.getSetting('OPENAI_SMALL_MODEL') ??\n runtime.getSetting('SMALL_MODEL') ??\n 'gpt-4o-mini';\n\n try {\n if (params.schema) {\n // Skip zod validation and just use the generateObject without schema\n logger.info('Using OBJECT_SMALL without schema validation');\n const { object } = await generateObject({\n model: openai.languageModel(model),\n output: 'no-schema',\n prompt: params.prompt,\n temperature: params.temperature,\n });\n return object;\n }\n\n const { object } = await generateObject({\n model: openai.languageModel(model),\n output: 'no-schema',\n prompt: params.prompt,\n temperature: params.temperature,\n });\n return object;\n } catch (error) {\n logger.error('Error generating object:', error);\n throw error;\n }\n },\n [ModelType.OBJECT_LARGE]: async (runtime, params: ObjectGenerationParams) => {\n const baseURL = runtime.getSetting('OPENAI_BASE_URL') ?? 'https://api.openai.com/v1';\n const openai = createOpenAI({\n apiKey: runtime.getSetting('OPENAI_API_KEY'),\n baseURL,\n });\n const model =\n runtime.getSetting('OPENAI_LARGE_MODEL') ?? runtime.getSetting('LARGE_MODEL') ?? 'gpt-4o';\n\n try {\n if (params.schema) {\n // Skip zod validation and just use the generateObject without schema\n logger.info('Using OBJECT_LARGE without schema validation');\n const { object } = await generateObject({\n model: openai.languageModel(model),\n output: 'no-schema',\n prompt: params.prompt,\n temperature: params.temperature,\n });\n return object;\n }\n\n const { object } = await generateObject({\n model: openai.languageModel(model),\n output: 'no-schema',\n prompt: params.prompt,\n temperature: params.temperature,\n });\n return object;\n } catch (error) {\n logger.error('Error generating object:', error);\n throw error;\n }\n },\n },\n tests: [\n {\n name: 'openai_plugin_tests',\n tests: [\n {\n name: 'openai_test_url_and_api_key_validation',\n fn: async (runtime) => {\n const baseURL = runtime.getSetting('OPENAI_BASE_URL') ?? 'https://api.openai.com/v1';\n const response = await fetch(`${baseURL}/models`, {\n headers: {\n Authorization: `Bearer ${runtime.getSetting('OPENAI_API_KEY')}`,\n },\n });\n const data = await response.json();\n logger.log('Models Available:', (data as any)?.data.length);\n if (!response.ok) {\n throw new Error(`Failed to validate OpenAI API key: ${response.statusText}`);\n }\n },\n },\n {\n name: 'openai_test_text_embedding',\n fn: async (runtime) => {\n try {\n const embedding = await runtime.useModel(ModelType.TEXT_EMBEDDING, {\n text: 'Hello, world!',\n });\n logger.log('embedding', embedding);\n } catch (error) {\n logger.error('Error in test_text_embedding:', error);\n throw error;\n }\n },\n },\n {\n name: 'openai_test_text_large',\n fn: async (runtime) => {\n try {\n const text = await runtime.useModel(ModelType.TEXT_LARGE, {\n prompt: 'What is the nature of reality in 10 words?',\n });\n if (text.length === 0) {\n throw new Error('Failed to generate text');\n }\n logger.log('generated with test_text_large:', text);\n } catch (error) {\n logger.error('Error in test_text_large:', error);\n throw error;\n }\n },\n },\n {\n name: 'openai_test_text_small',\n fn: async (runtime) => {\n try {\n const text = await runtime.useModel(ModelType.TEXT_SMALL, {\n prompt: 'What is the nature of reality in 10 words?',\n });\n if (text.length === 0) {\n throw new Error('Failed to generate text');\n }\n logger.log('generated with test_text_small:', text);\n } catch (error) {\n logger.error('Error in test_text_small:', error);\n throw error;\n }\n },\n },\n {\n name: 'openai_test_image_generation',\n fn: async (runtime) => {\n logger.log('openai_test_image_generation');\n try {\n const image = await runtime.useModel(ModelType.IMAGE, {\n prompt: 'A beautiful sunset over a calm ocean',\n n: 1,\n size: '1024x1024',\n });\n logger.log('generated with test_image_generation:', image);\n } catch (error) {\n logger.error('Error in test_image_generation:', error);\n throw error;\n }\n },\n },\n {\n name: 'image-description',\n fn: async (runtime) => {\n try {\n logger.log('openai_test_image_description');\n try {\n const result = await runtime.useModel(\n ModelType.IMAGE_DESCRIPTION,\n 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Vitalik_Buterin_TechCrunch_London_2015_%28cropped%29.jpg/537px-Vitalik_Buterin_TechCrunch_London_2015_%28cropped%29.jpg'\n );\n\n // Check if result has the expected structure\n if (\n result &&\n typeof result === 'object' &&\n 'title' in result &&\n 'description' in result\n ) {\n logger.log('Image description:', result);\n } else {\n logger.error('Invalid image description result format:', result);\n }\n } catch (e) {\n logger.error('Error in image description test:', e);\n }\n } catch (e) {\n logger.error('Error in openai_test_image_description:', e);\n }\n },\n },\n {\n name: 'openai_test_transcription',\n fn: async (runtime) => {\n logger.log('openai_test_transcription');\n try {\n const response = await fetch(\n 'https://upload.wikimedia.org/wikipedia/en/4/40/Chris_Benoit_Voice_Message.ogg'\n );\n const arrayBuffer = await response.arrayBuffer();\n const transcription = await runtime.useModel(\n ModelType.TRANSCRIPTION,\n Buffer.from(new Uint8Array(arrayBuffer))\n );\n logger.log('generated with test_transcription:', transcription);\n } catch (error) {\n logger.error('Error in test_transcription:', error);\n throw error;\n }\n },\n },\n {\n name: 'openai_test_text_tokenizer_encode',\n fn: async (runtime) => {\n const prompt = 'Hello tokenizer encode!';\n const tokens = await runtime.useModel(ModelType.TEXT_TOKENIZER_ENCODE, { prompt });\n if (!Array.isArray(tokens) || tokens.length === 0) {\n throw new Error('Failed to tokenize text: expected non-empty array of tokens');\n }\n logger.log('Tokenized output:', tokens);\n },\n },\n {\n name: 'openai_test_text_tokenizer_decode',\n fn: async (runtime) => {\n const prompt = 'Hello tokenizer decode!';\n // Encode the string into tokens first\n const tokens = await runtime.useModel(ModelType.TEXT_TOKENIZER_ENCODE, { prompt });\n // Now decode tokens back into text\n const decodedText = await runtime.useModel(ModelType.TEXT_TOKENIZER_DECODE, { tokens });\n if (decodedText !== prompt) {\n throw new Error(\n `Decoded text does not match original. Expected \"${prompt}\", got \"${decodedText}\"`\n );\n }\n logger.log('Decoded text:', decodedText);\n },\n },\n ],\n },\n ],\n};\nexport default openaiPlugin;\n"],"mappings":";AAAA,SAAS,oBAAoB;AAQ7B;AAAA,EAGE;AAAA,EAEA;AAAA,OACK;AACP,SAAS,gBAAgB,oBAAoB;AAC7C,SAA6B,wBAAwB;AAUrD,eAAe,aAAa,OAAsB,QAAgB;AAChE,QAAM,YACJ,UAAU,UAAU,aACf,QAAQ,IAAI,sBAAsB,QAAQ,IAAI,eAAe,gBAC7D,QAAQ,IAAI,eAAe;AAClC,QAAM,WAAW,iBAAiB,SAA0B;AAC5D,QAAM,SAAS,SAAS,OAAO,MAAM;AACrC,SAAO;AACT;AASA,eAAe,eAAe,OAAsB,QAAkB;AACpE,QAAM,YACJ,UAAU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O,gBAAQ;","names":["object"]}
|
package/package.json
CHANGED
|
@@ -1,51 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
2
|
+
"name": "@elizaos/plugin-openai",
|
|
3
|
+
"version": "1.0.0-alpha.64",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/elizaos-plugins/plugin-openai"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
"./package.json": "./package.json",
|
|
14
|
+
".": {
|
|
15
|
+
"import": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@ai-sdk/openai": "^1.1.9",
|
|
26
|
+
"@ai-sdk/ui-utils": "1.1.9",
|
|
27
|
+
"@elizaos/core": "^1.0.0-alpha.64",
|
|
28
|
+
"ai": "^4.1.25",
|
|
29
|
+
"js-tiktoken": "^1.0.18",
|
|
30
|
+
"tsup": "8.4.0"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsup",
|
|
34
|
+
"dev": "tsup --watch",
|
|
35
|
+
"lint": "prettier --write ./src",
|
|
36
|
+
"clean": "rm -rf dist .turbo node_modules .turbo-tsconfig.json tsconfig.tsbuildinfo",
|
|
37
|
+
"format": "prettier --write ./src",
|
|
38
|
+
"format:check": "prettier --check ./src"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"agentConfig": {
|
|
44
|
+
"pluginType": "elizaos:plugin:1.0.0",
|
|
45
|
+
"pluginParameters": {
|
|
46
|
+
"OPENAI_API_KEY": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "API key for the service"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"gitHead": "be3a1856c64c6d1ae2ec73e9f35b83ef827b0c55",
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"prettier": "3.5.3"
|
|
55
|
+
}
|
|
51
56
|
}
|