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
return`Weather forecast in ${inputs.locationName} is ${forecastData.properties.periods[0].detailedForecast}`;
35
+
}catch(error){
36
+
console.error('Error:',error);
37
+
throwerror;
38
+
}
39
+
}
40
+
)
41
+
42
+
43
+
constWeatherAgent=newAgent(
44
+
'WeatherAgent',
45
+
{
46
+
persona: 'You are a cheerful and approachable virtual assistant dedicated to delivering accurate, concise, and engaging weather updates. Your tone is warm, lively, and always focused on making weather information easy to understand and fun to receive.',
47
+
goal: 'Provide the current weather for a specified location as soon as the city or location details are provided. Your response should be both informative and conversational, ensuring clarity and usefulness for the user.',
this.pushToMessages({role: "assistant",content: `There was an error ${error.message}`});
51
+
}
46
52
47
-
if(result.content?.stop)break;
48
53
iterationCount++;
49
54
}
50
55
@@ -85,19 +90,22 @@ export class Agent {
85
90
return`
86
91
Persona: ${config.persona}
87
92
Objective: ${config.goal}
93
+
88
94
Guidelines:
89
-
- Work diligently until the stated objective is achieved.
90
-
- Utilize only the provided tools for solving the task. Do not make up names of the functions
91
-
- Set 'stop: true' when the objective is complete.
92
-
- If you have enough information to provide the details to the user, prepare a final result collecting all the information you have.
93
-
Output Structure:
94
-
If you find a function, that can be used, directly call the function.
95
-
When providing the final answer:
96
-
{
97
-
'thoughtProcess': 'Describe the reasoning and steps that will lead to the final result.',
98
-
'output': 'The complete answer in text form.',
99
-
'stop': true
100
-
}
95
+
1. Make sure that you break the task into logical steps and execute methodically until the objective is achieved. Do not attempt to solve before breaking it into steps.
96
+
2. Provide the breakdown steps as thought process in the first step.
97
+
3. Use only the provided tools, avoiding unnecessary or improvised function calls. If a tool can assist in solving the task, do not invoke it immediately rather provide reasoning first and then invoke the tool.
98
+
4. Include thoughtProcess during intermediate steps, but omit it from the final answer.
99
+
5. Mark the completion of the task by setting 'stop': true.
100
+
6. Ensure outputs are structured in the specified JSON format:
101
+
- thoughtProcess: A concise explanation of reasoning and next steps (only for intermediate responses).
102
+
- output: The complete, user-friendly answer (final response only).
103
+
- stop: Boolean indicator of task status (false for intermediate, true for final).
104
+
105
+
106
+
Make sure that the format is followed properly:
107
+
While processing: {thoughtProcess: '<reasoning>', stop: false}
108
+
Upon completion: {output: '<final result>', stop: true}
0 commit comments