I want to have LLM's access to predefined functions.
I've written those functions, and it works when there's no group chat.
llm_config = { "functions": [ { "name": "write_to_file", "description": "Use this function to write content to a file", "parameters": { "type": "object", "properties": { "filename": { "type": "string", "description": "The filename to write to", }, "content": { "type": "string", "description": "The content to write", } }, "required": ["filename", "content"], }, }, { "name": "read_from_file", "description": "Use this function to read the content of a file", "parameters": { "type": "object", "properties": { "filename": { "type": "string", "description": "The filename to read from", } }, "required": ["filename"], }, }, { "name": "read_pdf", "description": "Use this function to read the content of a pdf file", "parameters": { "type": "object", "properties": { "filename": { "type": "string", "description": "The filename to read from", } }, "required": ["filename"], }, }, { "name": "create_directory", "description": "Use this function to create a directory", "parameters": { "type": "object", "properties": { "directory_path": { "type": "string", "description": "The directory path to create", } }, "required": ["directory_path"], }, }, ], "config_list": config_list, "seed": 42, "request_timeout": 120 }
user_proxy = UserProxyAgent( name="user_proxy", system_message="A human that will provide the necessary information to the assistant", function_map={ "write_to_file": write_to_file, "read_from_file": read_from_file, "read_pdf": read_pdf, "create_directory": create_directory, }, code_execution_config={"work_dir": "fileread"})
assistant = AssistantAgent( name="assistant", system_message="""You are an assistant, you must blah blah""", llm_config=llm_config )
When initiating this, it works flawlessly. Functions are used properly.
But if I add another llm and a group chat
architect = AssistantAgent( name="architect", system_message="""You are a blah blah, and will get info from assistant etc etc""", llm_config=llm_config, )
groupchat = GroupChat( agents=[user_proxy, assistant, architect], messages=[],)
manager = GroupChatManager(groupchat=groupchat, llm_config=llm_config)
If I now initiate the chat to the manager, the assistant agent says the functions cannot be found
`assistant (to chat_manager):
***** Response from calling function "read_from_file" *****
Error: Function read_from_file not found.
***********************************************************`
Am I missing something here? Do I need to define functions somehow in the group chat? Because if I remove the manager and the group chat, it works fine.
I want to have LLM's access to predefined functions.
I've written those functions, and it works when there's no group chat.
llm_config = { "functions": [ { "name": "write_to_file", "description": "Use this function to write content to a file", "parameters": { "type": "object", "properties": { "filename": { "type": "string", "description": "The filename to write to", }, "content": { "type": "string", "description": "The content to write", } }, "required": ["filename", "content"], }, }, { "name": "read_from_file", "description": "Use this function to read the content of a file", "parameters": { "type": "object", "properties": { "filename": { "type": "string", "description": "The filename to read from", } }, "required": ["filename"], }, }, { "name": "read_pdf", "description": "Use this function to read the content of a pdf file", "parameters": { "type": "object", "properties": { "filename": { "type": "string", "description": "The filename to read from", } }, "required": ["filename"], }, }, { "name": "create_directory", "description": "Use this function to create a directory", "parameters": { "type": "object", "properties": { "directory_path": { "type": "string", "description": "The directory path to create", } }, "required": ["directory_path"], }, }, ], "config_list": config_list, "seed": 42, "request_timeout": 120 }user_proxy = UserProxyAgent( name="user_proxy", system_message="A human that will provide the necessary information to the assistant", function_map={ "write_to_file": write_to_file, "read_from_file": read_from_file, "read_pdf": read_pdf, "create_directory": create_directory, }, code_execution_config={"work_dir": "fileread"})assistant = AssistantAgent( name="assistant", system_message="""You are an assistant, you must blah blah""", llm_config=llm_config )When initiating this, it works flawlessly. Functions are used properly.
But if I add another llm and a group chat
architect = AssistantAgent( name="architect", system_message="""You are a blah blah, and will get info from assistant etc etc""", llm_config=llm_config, )groupchat = GroupChat( agents=[user_proxy, assistant, architect], messages=[],)manager = GroupChatManager(groupchat=groupchat, llm_config=llm_config)If I now initiate the chat to the manager, the assistant agent says the functions cannot be found
`assistant (to chat_manager):
***** Response from calling function "read_from_file" *****
Error: Function read_from_file not found.
***********************************************************`
Am I missing something here? Do I need to define functions somehow in the group chat? Because if I remove the manager and the group chat, it works fine.