-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Is your feature request related to a problem? Please describe.
Many non-openai models do not support messages with function_call or tool_call field so registered functions in a UserProxyAgent cannot pick them up when the code block in the message contains a function call. For example, below:
user_proxy (to assistant):
What name does machine 511V0001 have?
assistant (to user_proxy):
To get the description of machine 511V0001, you can use the `get_description_of_erp_machine` function as follows:
```python
machine_description = get_description_of_erp_machine("511V0001")
print(f"The description of machine 511V0001 is: {machine_description}")
"""
EXECUTING CODE BLOCK 0 (inferred language is python)...
SIGALRM is not supported on Windows. No timeout will be enforced.
user_proxy (to assistant):
exitcode: 1 (execution failed)
Code output:
Traceback (most recent call last):
File "", line 1, in <module>
machine_description = get_description_of_erp_machine("511V0001")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
NameError: name 'get_description_of_erp_machine' is not defined
Describe the solution you'd like
Solution 1: a new registered reply function for code execution that includes the registered functions and always include them in the code file itself. This requires parsing the function objects and collect relevant imported modules the functions need, as the script must be self-sustained.
Solution 2: a structural response generator on the producer side of the message, which always try to find registered functions in code blocks and extract the arguments to create a JSON object that is compliant with OpenAI's function_call and tool_call schema. #1309
Solution 3: append the full function definition in the system message of the AssistantAgent, and ask them to always include the definition in code blocks they produce. This should be an optional setting for non-openai models only.