joaomdmoura / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
16.74k stars 2.26k forks source link

Stricter way to tell LLM for function calling and delegation to agents. For open source LLM #449

Open kam-st opened 2 months ago

kam-st commented 2 months ago

Open source LLM seems to be struggling to grasp how to call Action and Action Input even after repeated errors while in runtime.

Action 'Ask question to co-worker (NewsFetcher)' don't exist, these are the only available Actions: Delegate work to co-worker: Delegate work to co-worker(coworker: str, task: str, context: str) - Delegate a specific task to one of the following co-workers: [Editor, NewsFetcher, NewsAnalyzer, NewsletterCompiler]The input to this tool should be the coworker, the task you want them to do, and ALL necessary context to exectue the task, they know nothing about the task, so share absolute everything you know, don't reference things but instead explain them. Ask question to co-worker: Ask question to co-worker(coworker: str, question: str, context: str) - Ask a specific question to one of the following co-workers: [Editor, NewsFetcher, NewsAnalyzer, NewsletterCompiler] The input to this tool should be the coworker, the question you have for them, and ALL necessary context to ask the question properly, they know nothing about the question, so share absolute everything you know, don't reference things but instead explain them.

After this error still LLM keeps on asking actions in following format.

Action: Ask question to co-worker (NewsFetcher) Action Input: { "coworker": "NewsFetcher", "question": "Could you kindly search for and provide me with the most recent articles about Artificial Intelligence from trusted sources? In your response, please include titles, authors' names, publication dates, URLs, and any other relevant metadata.", "context": "These articles will be essential in assembling an intriguing newsletter showcasing the latest advancements within the field of Artificial Intelligence." }

Notice in action it included NewsFetcher. It seems like crews is not flexible enough to understand this command. And open LLM are not smart enough to correctly use format enough after giving hints to them.

kam-st commented 2 months ago

Or it should be able to understand following.

_Thought: You should always think about what to do. Action: Ask question to co-worker (coworker="NewsFetcher", question="What are the top AI news stories from the past 24 hours?", context={"current_time": "2024-04-09 23:47:26.355354"}). Action Input: {"coworker": "NewsFetcher", "question": "What are the top AI news stories from the past 24 hours?", "context": {"currenttime": "2024-04-09 23:47:26.355354"}}

Action 'Ask question to co-worker (coworker="NewsFetcher", question="What are the top AI news stories from the past 24 hours?", context={"current_time": "2024-04-09 23:47:26.355354"}).' don't exist, these are the only available Actions: Delegate work to co-worker: Delegate work to co-worker(coworker: str, task: str, context: str) - Delegate a specific task to one of the following co-workers: [Editor, NewsFetcher, NewsAnalyzer, NewsletterCompiler] The input to this tool should be the coworker, the task you want them to do, and ALL necessary context to exectue the task, they know nothing about the task, so share absolute everything you know, don't reference things but instead explain them. Ask question to co-worker: Ask question to co-worker(coworker: str, question: str, context: str) - Ask a specific question to one of the following co-workers: [Editor, NewsFetcher, NewsAnalyzer, NewsletterCompiler] The input to this tool should be the coworker, the question you have for them, and ALL necessary context to ask the question properly, they know nothing about the question, so share absolute everything you know, don't reference things but instead explain them.