diff --git a/packages/agent/src/plugins.test.ts b/packages/agent/src/plugins.test.ts index 3ae9a52d30..4412374ab9 100644 --- a/packages/agent/src/plugins.test.ts +++ b/packages/agent/src/plugins.test.ts @@ -195,11 +195,6 @@ class TestRunner { const plugins = this.runtime.plugins; for (const plugin of plugins) { - if (!plugin.tests) { - logger.info(`Plugin ${plugin.name} has no tests`); - continue; - } - try { logger.info(`Running tests for plugin: ${plugin.name}`); const pluginTests = plugin.tests; diff --git a/packages/plugin-anthropic/src/index.ts b/packages/plugin-anthropic/src/index.ts index ffac2c7b5d..62ca07e73e 100644 --- a/packages/plugin-anthropic/src/index.ts +++ b/packages/plugin-anthropic/src/index.ts @@ -89,23 +89,39 @@ export const anthropicPlugin: Plugin = { name: "anthropic_plugin_tests", tests: [ { - name: 'test_text_large', + name: 'anthropic_test_text_small', fn: async (runtime) => { - const { text } = await runtime.generateText({ - model: runtime.models[ModelClass.TEXT_SMALL], - prompt: "What is the nature of reality?", - }); - console.log(text, ModelClass.TEXT_SMALL); + try { + const text = await runtime.useModel(ModelClass.TEXT_SMALL, { + context: "Debug Mode:", + prompt: "What is the nature of reality in 10 words?", + }); + if (text.length === 0) { + throw new Error("Failed to generate text"); + } + console.log("generated with test_text_small:", text); + } catch (error) { + console.error("Error in test_text_small:", error); + throw error; + } } }, { - name: 'test_text_large', + name: 'anthropic_test_text_large', fn: async (runtime) => { - const { text } = await runtime.generateText({ - model: runtime.models[ModelClass.TEXT_LARGE], - prompt: "What is the nature of reality in 10 words?", - }); - console.log(text, ModelClass.TEXT_LARGE); + try { + const text = await runtime.useModel(ModelClass.TEXT_LARGE, { + context: "Debug Mode:", + prompt: "What is the nature of reality in 10 words?", + }); + if (text.length === 0) { + throw new Error("Failed to generate text"); + } + console.log("generated with test_text_small:", text); + } catch (error) { + console.error("Error in test_text_small:", error); + throw error; + } } } ] diff --git a/packages/plugin-openai/src/index.ts b/packages/plugin-openai/src/index.ts index 2acf3fb843..bfc795010c 100644 --- a/packages/plugin-openai/src/index.ts +++ b/packages/plugin-openai/src/index.ts @@ -296,27 +296,27 @@ export const openaiPlugin: Plugin = { name: "openai_plugin_tests", tests: [ { - name: 'test_url_and_api_key_validation', + name: 'openai_test_url_and_api_key_validation', fn: async (runtime) => { const baseURL = runtime.getSetting("OPENAI_BASE_URL") ?? "https://api.openai.com/v1"; const response = await fetch(`${baseURL}/models`, { headers: { Authorization: `Bearer ${runtime.getSetting("OPENAI_API_KEY")}` }, }); - console.log("response", await response.json()); + const data = await response.json(); + console.log("Models Available:", (data as any)?.data.length); if (!response.ok) { throw new Error(`Failed to validate OpenAI API key: ${response.statusText}`); } } }, { - name: 'test_text_large', + name: 'openai_test_text_large', fn: async (runtime) => { - console.log("test_openai_plugin"); try { const text = await runtime.useModel(ModelClass.TEXT_LARGE, { - context: "Test Mode: Reply with a short answer", - prompt: "What is the nature of reality?", + context: "Debug Mode:", + prompt: "What is the nature of reality in 10 words?", }); if (text.length === 0) { throw new Error("Failed to generate text"); @@ -329,12 +329,11 @@ export const openaiPlugin: Plugin = { } }, { - name: 'test_text_small', + name: 'openai_test_text_small', fn: async (runtime) => { - console.log("test_openai_plugin"); try { const text = await runtime.useModel(ModelClass.TEXT_SMALL, { - context: "Test Mode:", + context: "Debug Mode:", prompt: "What is the nature of reality in 10 words?", }); if (text.length === 0) { @@ -348,18 +347,15 @@ export const openaiPlugin: Plugin = { } }, { - name: 'test_image_generation', + name: 'openai_test_image_generation', fn: async (runtime) => { - console.log("test_openai_plugin"); + console.log("openai_test_image_generation"); try { const image = await runtime.useModel(ModelClass.IMAGE, { prompt: "A beautiful sunset over a calm ocean", n: 1, size: "1024x1024" }); - if (image.length === 0) { - throw new Error("Failed to generate image"); - } console.log("generated with test_image_generation:", image); } catch (error) { console.error("Error in test_image_generation:", error);