Skip to content

Commit

Permalink
feat(agent): update system prompt and open meteo schema (#72)
Browse files Browse the repository at this point in the history
Signed-off-by: Matous Havlena <[email protected]>
  • Loading branch information
matoushavlena authored Oct 8, 2024
1 parent c68bc4f commit c235522
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/agents/bee/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const BeeSystemPrompt = new PromptTemplate({
}),
template: `# Available functions
{{#tools.length}}
When specifying function parameters in Function Input, you must always use all required parameters.
{{#tools}}
Function Name: {{name}}
Description: {{description}}
Expand All @@ -57,7 +59,7 @@ Thought: A single-line plan of how to answer the user's message. It must be imme
{{#tools.length}}
Thought: A single-line step-by-step plan of how to answer the user's message. Use functions that best answer the preceding Message based on their Description. When the problem seems too hard for the function, you should try to split it into smaller ones. This line must be immediately followed by Final Answer if available information and capabilities are sufficient to provide the answer, or by Function Name when one of the available functions needs to be called. Do not provide the answer here.
Function Name: Name of the function that can best answer the preceding Thought. It must be one of the available functions defined above.
Function Input: Parameters for the function to best answer the preceding Thought. You must always strictly follow the Parameters schema. Use this instruction even if the parameters is an empty object.
Function Input: Function parameters. Use this instruction even if the parameters is an empty object.
Function Caption: A single-line description of the function calling for the user.
Function Output: Output of the function in JSON format.
Thought: Continue your thinking process.
Expand All @@ -77,7 +79,6 @@ You must always follow the communication structure and instructions defined abov
{{#tools.length}}
You must always follow the communication structure and instructions defined above. Do not forget that Thought must be immediately followed by either Function Name or Final Answer.
Functions must be used to retrieve factual or historical information to answer the message.
When the problem seems too hard for the function, you should try to split it into smaller ones.
{{/tools.length}}
If the user suggests using a function that is not available, answer that the function is not available. You can suggest alternatives if appropriate.
When the message is unclear or you need more information from the user, ask in Final Answer.
Expand All @@ -93,7 +94,7 @@ Prefer to use these capabilities over functions.
- When answering the user, use friendly formats for time and date.
- Use markdown syntax for formatting code snippets, links, JSON, tables, images, files.
- Sometimes, things don't go as planned. Functions may not provide useful information on the first few tries. You should always try a few different approaches before declaring the problem unsolvable.
- When the function doesn't give you what you were asking for, you must either use another funtion or a different function input.
- When the function doesn't give you what you were asking for, you must either use another function or a different function input.
- When using search engines, you try different formulations of the query, possibly even in a different language.
# Role
Expand Down
9 changes: 5 additions & 4 deletions src/tools/weather/openMeteo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class OpenMeteoTool extends Tool<
ToolRunOptions
> {
name = "OpenMeteo";
description = `Retrieves current, past, or future weather forecasts for a specified location.`;
description = `Retrieve current, past, or future weather forecasts for a location.`;

inputSchema() {
return z
Expand All @@ -85,13 +85,14 @@ export class OpenMeteoTool extends Tool<
.strip(),
]),
start_date: z
.union([z.string().date(), z.string().datetime()])
.string()
.date()
.describe("Start date for the weather forecast in the format YYYY-MM-DD (UTC)"),
end_date: z
.union([z.string().date(), z.string().datetime()])
.string()
.date()
.describe("End date for the weather forecast in the format YYYY-MM-DD (UTC)")
.optional(),
elevation: z.coerce.number().nullish(),
temperature_unit: z.enum(["celsius", "fahrenheit"]).default("celsius"),
})
.strip();
Expand Down

0 comments on commit c235522

Please sign in to comment.