Interesting changes in function calling api between gpt4o and gpt4

gpt4o’s function calling can now output content while giving function input. This reminds me of ReAct.

"model": "gpt-4o-2024-05-13",
"choices": [
        {
            "finish_reason": "function_call",
            "index": 0,
            "logprobs": null,
            "message": {
                "content": "Derzeit ist keine Sequenzvorlage geöffnet, die gestartet werden kann. Ich werde zunächst die verfügbaren Sequenzvorlagen abrufen und dann eine geeignete Vorlage öffnen und starten.\n\nEinen Moment bitte.",
                "function_call": {
                    "arguments": "{\"sessionId\":\"5590ba4c-d093-413b-a45b-59f91343cc95\"}",
                    "name": "getTemplates"
                },
                "role": "assistant"
            }
        }
    ],
"usage": {
        "completion_tokens": 77,
        "prompt_tokens": 1795,
        "total_tokens": 1872
    }
"model": "gpt-4-0125-preview",
"choices": [
        {
            "finish_reason": "function_call",
            "index": 0,
            "logprobs": null,
            "message": {
                "content": null,
                "function_call": {
                    "arguments": "{\"sessionId\":\"5590ba4c-d093-413b-a45b-59f91343cc95\"}",
                    "name": "getTemplates"
                },
                "role": "assistant"
            }
        }
    ],
"usage": {
        "completion_tokens": 33,
        "prompt_tokens": 1822,
        "total_tokens": 1855
    }
1 Like

And in the gpt4o API, inserting the tool into the prompt costs fewer tokens. You can observe that meaningless duplication is optimized away.

gpt-4o

**Knowledge cutoff: 2023-10**

# Tools

## functions

namespace functions {

// Get the current weather in a given location
type get_current_weather = (_: {
// The city and state, e.g. San Francisco, CA
location: string,
unit?: "celsius" | "fahrenheit",
}) => any;

// moves table to the target location
type moveTable = (_: {
// The location where the table needs to be moved, should be a int value between positionLimit
targetPosition: integer,
}) => any;

} // namespace functions

gpt4

Knowledge cutoff: 2023-04

# Tools

## functions

namespace functions {

// Get the current weather in a given location
type get_current_weather = (_: {
// The city and state, e.g. San Francisco, CA
location: string,
unit?: "celsius" | "fahrenheit",
}) => any;

} // namespace functions

# Tools

## functions

namespace functions {
    
// moves table to the target location
type moveTable = (_: {
// The location where the table needs to be moved, should be a int value between positionLimit
targetPosition: integer,
}) => any;

} // namespace functions