You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: typescript-sdk/apps/dojo/src/mastra/index.ts
+19-16Lines changed: 19 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -9,38 +9,41 @@ import { createTool } from "@mastra/core";
9
9
import{z}from"zod";
10
10
11
11
12
-
letstorage: LibSQLStore|DynamoDBStore
13
12
14
-
if(process.env.DYNAMODB_TABLE_NAME){
15
-
storage=newDynamoDBStore({
16
-
name: "dynamodb",
17
-
config: {
18
-
tableName: process.env.DYNAMODB_TABLE_NAME
19
-
},
20
-
});
21
-
}else{
22
-
storage=newLibSQLStore({url: "file::memory:"});
13
+
functiongetStorage(): LibSQLStore|DynamoDBStore{
14
+
if(process.env.DYNAMODB_TABLE_NAME){
15
+
returnnewDynamoDBStore({
16
+
name: "dynamodb",
17
+
config: {
18
+
tableName: process.env.DYNAMODB_TABLE_NAME
19
+
},
20
+
});
21
+
}else{
22
+
returnnewLibSQLStore({url: "file::memory:"});
23
+
}
23
24
}
24
25
26
+
27
+
25
28
exportconstmastra=newMastra({
26
29
agents: {
27
30
agentic_chat: newAgent({
28
31
name: "agentic_chat",
29
32
instructions: `
30
33
You are a helpful weather assistant that provides accurate weather information.
31
-
34
+
32
35
Your primary function is to help users get weather details for specific locations. When responding:
33
36
- Always ask for a location if none is provided
34
37
- If the location name isn’t in English, please translate it
35
38
- If giving a location with multiple parts (e.g. "New York, NY"), use the most relevant part (e.g. "New York")
36
39
- Include relevant details like humidity, wind conditions, and precipitation
37
40
- Keep responses concise but informative
38
-
41
+
39
42
Use the weatherTool to fetch current weather data.
40
43
`,
41
44
model: openai("gpt-4o"),
42
45
memory: newMemory({
43
-
storage: storage,
46
+
storage: getStorage(),
44
47
options: {
45
48
workingMemory: {
46
49
enabled: true,
@@ -54,7 +57,7 @@ export const mastra = new Mastra({
54
57
shared_state: newAgent({
55
58
name: "shared_state",
56
59
instructions: `
57
-
You are a helpful assistant for creating recipes.
60
+
You are a helpful assistant for creating recipes.
58
61
59
62
IMPORTANT:
60
63
1. Create a recipe using the existing ingredients and instructions. Make sure the recipe is complete.
@@ -63,11 +66,11 @@ export const mastra = new Mastra({
63
66
4. 'ingredients' is always an array of objects with 'icon', 'name', and 'amount' fields
64
67
5. 'instructions' is always an array of strings
65
68
66
-
If you have just created or modified the recipe, just answer in one sentence what you did. dont describe the recipe, just say what you did.
69
+
If you have just created or modified the recipe, just answer in one sentence what you did. dont describe the recipe, just say what you did. Do not mention "working memory", "memory", or "state" in your answer.
0 commit comments