mastra 0.2.0-alpha.150 → 0.2.0-alpha.152
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/{chunk-LXTKSDP6.js → chunk-6I2TYSHJ.js} +14 -7
- package/dist/commands/create/create.js +1 -1
- package/dist/index.js +2 -2
- package/dist/starter-files/workflow.ts +53 -54
- package/package.json +4 -3
- package/src/playground/dist/assets/{index-BcDMRE9o.js → index-BOrh4xwp.js} +1 -1
- package/src/playground/dist/assets/{index-BuPwogkH.js → index-DO8Ih1Yi.js} +3 -3
- package/src/playground/dist/index.html +1 -1
|
@@ -226,13 +226,19 @@ var logger = createLogger({
|
|
|
226
226
|
|
|
227
227
|
// src/commands/init/utils.ts
|
|
228
228
|
var exec = util.promisify(child_process.exec);
|
|
229
|
-
var modelToConfigMap = {
|
|
230
|
-
openai: { provider: "OPEN_AI", name: "gpt-4o", toolChoice: "auto" },
|
|
231
|
-
anthropic: { provider: "ANTHROPIC", name: "claude-3-5-sonnet-20241022", toolChoice: "auto" },
|
|
232
|
-
groq: { provider: "GROQ", name: "llama3-groq-70b-8192-tool-use-preview", toolChoice: "auto" }
|
|
233
|
-
};
|
|
234
229
|
async function writeAgentSample(llmProvider, destPath, addExampleTool) {
|
|
235
|
-
|
|
230
|
+
let providerImport = "";
|
|
231
|
+
let modelItem = "";
|
|
232
|
+
if (llmProvider === "openai") {
|
|
233
|
+
providerImport = `import { openai } from '@ai-sdk/openai';`;
|
|
234
|
+
modelItem = `openai('gpt-4o')`;
|
|
235
|
+
} else if (llmProvider === "anthropic") {
|
|
236
|
+
providerImport = `import { anthropic } from '@ai-sdk/anthropic';`;
|
|
237
|
+
modelItem = `anthropic('claude-3-5-sonnet-20241022')`;
|
|
238
|
+
} else if (llmProvider === "groq") {
|
|
239
|
+
providerImport = `import { groq } from '@ai-sdk/groq';`;
|
|
240
|
+
modelItem = `groq('llama3-groq-70b-8192-tool-use-preview')`;
|
|
241
|
+
}
|
|
236
242
|
const instructions = `
|
|
237
243
|
You are a helpful weather assistant that provides accurate weather information.
|
|
238
244
|
|
|
@@ -245,13 +251,14 @@ async function writeAgentSample(llmProvider, destPath, addExampleTool) {
|
|
|
245
251
|
${addExampleTool ? "Use the weatherTool to fetch current weather data." : ""}
|
|
246
252
|
`;
|
|
247
253
|
const content = `
|
|
254
|
+
${providerImport}
|
|
248
255
|
import { Agent } from '@mastra/core/agent';
|
|
249
256
|
${addExampleTool ? `import { weatherTool } from '../tools';` : ""}
|
|
250
257
|
|
|
251
258
|
export const weatherAgent = new Agent({
|
|
252
259
|
name: 'Weather Agent',
|
|
253
260
|
instructions: \`${instructions}\`,
|
|
254
|
-
model: ${
|
|
261
|
+
model: ${modelItem},
|
|
255
262
|
${addExampleTool ? "tools: { weatherTool }," : ""}
|
|
256
263
|
});
|
|
257
264
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { create } from '../../chunk-
|
|
1
|
+
export { create } from '../../chunk-6I2TYSHJ.js';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
import { PosthogAnalytics } from './chunk-K5HPNH5H.js';
|
|
3
3
|
export { PosthogAnalytics } from './chunk-K5HPNH5H.js';
|
|
4
|
-
import { DepsService, create, checkPkgJson, checkAndInstallCoreDeps, interactivePrompt, init, FileService, logger } from './chunk-
|
|
5
|
-
export { create } from './chunk-
|
|
4
|
+
import { DepsService, create, checkPkgJson, checkAndInstallCoreDeps, interactivePrompt, init, FileService, logger } from './chunk-6I2TYSHJ.js';
|
|
5
|
+
export { create } from './chunk-6I2TYSHJ.js';
|
|
6
6
|
import { Command } from 'commander';
|
|
7
7
|
import 'picocolors';
|
|
8
8
|
import { join, dirname } from 'node:path';
|
|
@@ -1,6 +1,58 @@
|
|
|
1
|
+
import { openai } from '@ai-sdk/openai';
|
|
2
|
+
import { Agent } from '@mastra/core/agent';
|
|
1
3
|
import { Step, Workflow } from '@mastra/core/workflows';
|
|
2
4
|
import { z } from 'zod';
|
|
3
5
|
|
|
6
|
+
const llm = openai('gpt-4o');
|
|
7
|
+
|
|
8
|
+
const agent = new Agent({
|
|
9
|
+
name: 'Weather Agent',
|
|
10
|
+
model: llm,
|
|
11
|
+
instructions: `
|
|
12
|
+
You are a local activities and travel expert who excels at weather-based planning. Analyze the weather data and provide practical activity recommendations.
|
|
13
|
+
|
|
14
|
+
For each day in the forecast, structure your response exactly as follows:
|
|
15
|
+
|
|
16
|
+
📅 [Day, Month Date, Year]
|
|
17
|
+
═══════════════════════════
|
|
18
|
+
|
|
19
|
+
🌡️ WEATHER SUMMARY
|
|
20
|
+
• Conditions: [brief description]
|
|
21
|
+
• Temperature: [X°C/Y°F to A°C/B°F]
|
|
22
|
+
• Precipitation: [X% chance]
|
|
23
|
+
|
|
24
|
+
🌅 MORNING ACTIVITIES
|
|
25
|
+
Outdoor:
|
|
26
|
+
• [Activity Name] - [Brief description including specific location/route]
|
|
27
|
+
Best timing: [specific time range]
|
|
28
|
+
Note: [relevant weather consideration]
|
|
29
|
+
|
|
30
|
+
🌞 AFTERNOON ACTIVITIES
|
|
31
|
+
Outdoor:
|
|
32
|
+
• [Activity Name] - [Brief description including specific location/route]
|
|
33
|
+
Best timing: [specific time range]
|
|
34
|
+
Note: [relevant weather consideration]
|
|
35
|
+
|
|
36
|
+
🏠 INDOOR ALTERNATIVES
|
|
37
|
+
• [Activity Name] - [Brief description including specific venue]
|
|
38
|
+
Ideal for: [weather condition that would trigger this alternative]
|
|
39
|
+
|
|
40
|
+
⚠️ SPECIAL CONSIDERATIONS
|
|
41
|
+
• [Any relevant weather warnings, UV index, wind conditions, etc.]
|
|
42
|
+
|
|
43
|
+
Guidelines:
|
|
44
|
+
- Suggest 2-3 time-specific outdoor activities per day
|
|
45
|
+
- Include 1-2 indoor backup options
|
|
46
|
+
- For precipitation >50%, lead with indoor activities
|
|
47
|
+
- All activities must be specific to the location
|
|
48
|
+
- Include specific venues, trails, or locations
|
|
49
|
+
- Consider activity intensity based on temperature
|
|
50
|
+
- Keep descriptions concise but informative
|
|
51
|
+
|
|
52
|
+
Maintain this exact formatting for consistency, using the emoji and section headers as shown.
|
|
53
|
+
`,
|
|
54
|
+
});
|
|
55
|
+
|
|
4
56
|
const fetchWeather = new Step({
|
|
5
57
|
id: 'fetch-weather',
|
|
6
58
|
description: 'Fetches weather forecast for a given city',
|
|
@@ -77,60 +129,7 @@ const planActivities = new Step({
|
|
|
77
129
|
${JSON.stringify(forecast, null, 2)}
|
|
78
130
|
`;
|
|
79
131
|
|
|
80
|
-
|
|
81
|
-
throw new Error('Mastra not found');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const llm = mastra.llm({
|
|
85
|
-
provider: 'OPEN_AI',
|
|
86
|
-
name: 'gpt-4o-mini',
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const response = await llm.stream([
|
|
90
|
-
{
|
|
91
|
-
role: 'system',
|
|
92
|
-
content: `You are a local activities and travel expert who excels at weather-based planning. Analyze the weather data and provide practical activity recommendations.
|
|
93
|
-
|
|
94
|
-
For each day in the forecast, structure your response exactly as follows:
|
|
95
|
-
|
|
96
|
-
📅 [Day, Month Date, Year]
|
|
97
|
-
═══════════════════════════
|
|
98
|
-
|
|
99
|
-
🌡️ WEATHER SUMMARY
|
|
100
|
-
• Conditions: [brief description]
|
|
101
|
-
• Temperature: [X°C/Y°F to A°C/B°F]
|
|
102
|
-
• Precipitation: [X% chance]
|
|
103
|
-
|
|
104
|
-
🌅 MORNING ACTIVITIES
|
|
105
|
-
Outdoor:
|
|
106
|
-
• [Activity Name] - [Brief description including specific location/route]
|
|
107
|
-
Best timing: [specific time range]
|
|
108
|
-
Note: [relevant weather consideration]
|
|
109
|
-
|
|
110
|
-
🌞 AFTERNOON ACTIVITIES
|
|
111
|
-
Outdoor:
|
|
112
|
-
• [Activity Name] - [Brief description including specific location/route]
|
|
113
|
-
Best timing: [specific time range]
|
|
114
|
-
Note: [relevant weather consideration]
|
|
115
|
-
|
|
116
|
-
🏠 INDOOR ALTERNATIVES
|
|
117
|
-
• [Activity Name] - [Brief description including specific venue]
|
|
118
|
-
Ideal for: [weather condition that would trigger this alternative]
|
|
119
|
-
|
|
120
|
-
⚠️ SPECIAL CONSIDERATIONS
|
|
121
|
-
• [Any relevant weather warnings, UV index, wind conditions, etc.]
|
|
122
|
-
|
|
123
|
-
Guidelines:
|
|
124
|
-
- Suggest 2-3 time-specific outdoor activities per day
|
|
125
|
-
- Include 1-2 indoor backup options
|
|
126
|
-
- For precipitation >50%, lead with indoor activities
|
|
127
|
-
- All activities must be specific to the location
|
|
128
|
-
- Include specific venues, trails, or locations
|
|
129
|
-
- Consider activity intensity based on temperature
|
|
130
|
-
- Keep descriptions concise but informative
|
|
131
|
-
|
|
132
|
-
Maintain this exact formatting for consistency, using the emoji and section headers as shown.`,
|
|
133
|
-
},
|
|
132
|
+
const response = await agent.stream([
|
|
134
133
|
{
|
|
135
134
|
role: 'user',
|
|
136
135
|
content: prompt,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mastra",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.152",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "cli for mastra",
|
|
6
6
|
"type": "module",
|
|
@@ -55,10 +55,11 @@
|
|
|
55
55
|
"yocto-spinner": "^0.1.1",
|
|
56
56
|
"zod": "^3.24.1",
|
|
57
57
|
"zod-to-json-schema": "^3.24.1",
|
|
58
|
-
"@mastra/
|
|
59
|
-
"@mastra/
|
|
58
|
+
"@mastra/core": "^0.2.0-alpha.95",
|
|
59
|
+
"@mastra/deployer": "^0.1.0-alpha.44"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
+
"@ai-sdk/openai": "^1.1.9",
|
|
62
63
|
"@types/express": "^5.0.0",
|
|
63
64
|
"@types/fs-extra": "^11.0.4",
|
|
64
65
|
"@types/node": "^22.10.0",
|