feat : tool description proprety

This commit is contained in:
martin legrand 2025-05-04 19:29:31 +02:00
parent 7afb79117b
commit 5949540007
3 changed files with 11 additions and 2 deletions

View File

@ -96,6 +96,15 @@ class Agent():
""" """
return list(self.tools.keys()) return list(self.tools.keys())
def get_tools_description(self) -> str:
"""
Get the list of tools names and their description.
"""
description = ""
for name in self.get_tools_name():
description += f"{tool}: {self.tools[name].description}\n"
return description
def load_prompt(self, file_path: str) -> str: def load_prompt(self, file_path: str) -> str:
try: try:
with open(file_path, 'r', encoding="utf-8") as f: with open(file_path, 'r', encoding="utf-8") as f:

View File

@ -41,8 +41,7 @@ class McpAgent(Agent):
""" """
Expands the prompt with the tools available. Expands the prompt with the tools available.
""" """
tools_name = self.get_tools_name() tools_str = self.get_tools_description()
tools_str = ", ".join(tools_name)
prompt += f""" prompt += f"""
You can use the following tools and MCPs: You can use the following tools and MCPs:
{tools_str} {tools_str}

View File

@ -171,6 +171,7 @@ class AgentRouter:
("Search the web for the latest trends in web development and build a sample site", "HIGH"), ("Search the web for the latest trends in web development and build a sample site", "HIGH"),
("Use my research_note.txt file, double check the informations on the web", "HIGH"), ("Use my research_note.txt file, double check the informations on the web", "HIGH"),
("Make a web server in go that query a flight API and display them in a app", "HIGH"), ("Make a web server in go that query a flight API and display them in a app", "HIGH"),
("Search the web for top cafes in Rennes, France, and save a list of three with their addresses in rennes_cafes.txt.", "HIGH"),
("Search the web for the latest trends in AI and demo it in pytorch", "HIGH"), ("Search the web for the latest trends in AI and demo it in pytorch", "HIGH"),
("can you lookup for api that track flight and build a web flight tracking app", "HIGH"), ("can you lookup for api that track flight and build a web flight tracking app", "HIGH"),
("Find the file toto.pdf then use its content to reply to Jojo on superforum.com", "HIGH"), ("Find the file toto.pdf then use its content to reply to Jojo on superforum.com", "HIGH"),