Realtime API function calling ignores function arguments

I am trying to use the function api, but the assistant keeps on ignoring the specified arguments.

The session configuration is

           {                                
                        "type": "session.updated",                              
                        "event_id": "event_AQy7c5TTGMpzh0Sd2LpyC",              
                        "session": {                                            
                            "id": "sess_AQy7ckaZkgiI3Ug0RHk79",                 
                            "object": "realtime.session",                       
                            "model":                                            
                    "gpt-4o-realtime-preview-2024-10-01",                       
                            "expires_at": 1730991900,                           
                            "modalities": [                                     
                                "audio",                                        
                                "text"                                          
                            ],                                                  
                            "instructions": "<<<I am not going to share my instruction to the forum :) ",                                                    
                            "voice": "alloy",                                   
                            "turn_detection": {                                 
                                "type": "server_vad",                           
                                "threshold": 0.5,                               
                                "prefix_padding_ms": 300,                       
                                "silence_duration_ms": 200                      
                            },                                                  
                            "input_audio_format": "pcm16",                      
                            "output_audio_format": "pcm16",                     
                            "input_audio_transcription": {                      
                                "model": "whisper-1"                            
                            },                                                  
                            "tool_choice": "auto",                              
                            "temperature": 0.8,                                 
                            "max_response_output_tokens": "inf",                
                            "tools": [                                          
                                {                                               
                                    "name": "get_weather",                      
                                    "description": "Get the current             
                    weather for a location, tell the user you are               
                    fetching the weather. Ask the user if you are               
                    not aware of the current location.",                        
                                    "parameters": {                             
                                        "type": "object",                       
                                        "properties": {                         
                                            "location": {                       
                                                "type": "string"                
                                            }                                   
                                        },                                      
                                        "required": [                           
                                            "location"                          
                                        ]                                       
                                    },                                          
                                    "type": "function"                          
                                }                                               
                            ]                                                   
                        }                                                       
                    }                                                           

Sadly, the function calling server event I have got is:

             {                                
                        "type": "conversation.item.created",                    
                        "event_id": "event_AQy7siDRzU3nPZqErmbBR",              
                        "previous_item_id":                                     
                    "item_AQy7rBgkMWVZzU5WkWG3s",                               
                        "item": {                                               
                            "id": "item_AQy7splFlgYC5YBzl5QLv",                 
                            "object": "realtime.item",                          
                            "type": "function_call",                            
                            "status": "in_progress",                            
                            "name": "get_weather",                              
                            "call_id": "call_vGMO4j5UGgI9uBQd",                 
                            "arguments": ""                                     
                        }                                                       
                    }   

Why am I not receiving the function arguments?
Any assistance would be greatly appreciated!

1 Like

Have a look at this … it’s a forked version of a Ms sample … you can find both c# (my code) and python implementation (original Ms code)…
The c# version has a get current weather function :slight_smile:

This is because the conversation.item is created, but it’s not finished. Hence you see “in_progress” as an item status. You just need to wait a bit more and receive a response.done event that would contain the actual function call arguments