Skip to content

Function calls do not work on a specific system #449

Description

@YourAdorableZero

At some point, magentic started working differently on different systems.
Function calls are not working on my system:

[SystemMessage('You are server cleaner.'), UserMessage('Clear server 123')]
[SystemMessage('You are server cleaner.'), UserMessage('Clear server 123'), AssistantMessage('<think>\nOkay, the user wants to clear server 123. Let me check the available tools. There\'s a function called clr_server that takes a server_name parameter. The required parameter is server_name, which is a string. The user provided "123" as the server name. So I need to call clr_server with server_name set to "123". I should make sure the arguments are correctly formatted as JSON within the tool_call tags. No other functions are available, so that\'s the only one to use. Alright, I\'ll structure the response with the function name and the arguments.\n</think>\n\n')]
Traceback (most recent call last):
  File "D:\ollamatest\mag1.py", line 31, in <module>
    chat = chat.exec_function_call()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ollamatest\test\Lib\site-packages\magentic\_chat.py", line 149, in exec_function_call
    raise TypeError(msg)
TypeError: Last message is not a function call.

But everything works fine on my comrade's system.:

[SystemMessage('You are server cleaner.'), UserMessage('Clear server 123')]
[SystemMessage('You are server cleaner.'), UserMessage('Clear server 123'), AssistantMessage(FunctionCall(<function clr_server at 0x00000268825F3D80>, '123'))]
Server 123 has been cleared!
None
[SystemMessage('You are server cleaner.'), UserMessage('Clear server 123'), AssistantMessage(FunctionCall(<function clr_server at 0x00000268825F3D80>, '123')), FunctionResultMessage(None, FunctionCall(<function clr_server at 0x00000268825F3D80>, '123'))]

I tried reinstalling the library, reinstalling the model, changing the virtual environment, changing the location of the script.
We have absolutely no idea why it works so strangely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions