MyAgent/src/mastra/agents/multi-function-agent.ts

73 lines
2.3 KiB
TypeScript
Raw Normal View History

import { Agent } from "@mastra/core/agent";
import {
weatherTool,
timeTool,
calculatorTool,
filelistTool,
jokeTool,
goodsTool,
} from "../tools";
import { createDeepSeek } from '@ai-sdk/deepseek';
2025-12-21 23:16:00 +08:00
import { createOpenAI } from '@ai-sdk/openai';
import { Memory } from "@mastra/memory";
import { LibSQLStore } from "@mastra/libsql";
2025-12-21 23:16:00 +08:00
// const deepseek = createDeepSeek({
// apiKey: 'sk-8603b08e1125422ca6238c8b4a1a40d8',
// });
const deepseek = createDeepSeek({
2025-12-21 23:16:00 +08:00
baseURL: 'https://api.xiaomimimo.com/v1',
apiKey: 'sk-cr54p8d2k20nppdzzwyfir4b4znxoh1py6ccxpkc8qt1ahij'
});
const openai = createOpenAI({
baseURL: 'https://api.xiaomimimo.com/v1',
apiKey: 'sk-cr54p8d2k20nppdzzwyfir4b4znxoh1py6ccxpkc8qt1ahij'
});
// 创建一个基本内存实例
const memory = new Memory({
storage: new LibSQLStore({
url: "file:./memory.db", // 相对于 `.mastra/output` 目录的相对路径
}),
options: {
lastMessages: 20,
},
});
export const multiFunctionAgent = new Agent({
name: "Multi-Function Agent",
2025-12-21 23:16:00 +08:00
instructions: {
role: 'system',
content: `
1. ****使
2. ****
3. ****
4. ****
5. ****
6. ****使ID获取单个商品详情
earlier
使
使
2025-12-21 23:16:00 +08:00
`},
// model: deepseek('deepseek-chat'),
// model: openai.chat('mimo-v2-flash'),
model: deepseek.chat('mimo-v2-flash'),
memory: memory,
tools: {
weatherTool,
timeTool,
calculatorTool,
filelistTool,
jokeTool,
goodsTool,
},
});