This might just be because we are working with Beta code or am I might be missing something. Combining function calling with file retrieval does seem to be having a strange behaviour.
Without File Retrieval
I wrote some code a while back that defines three functions to get the latitude, longitude and a display name for a given address. I provide the address in a prompt. I provide the prompt and it consistently puts the run object into a ‘requires action’ status. The section of the run object looks like this:
'required_action': {'submit_tool_outputs': {'tool_calls': [{'id': 'call_FLf8qdNeIh7YC3tauBfTkQ1d',
'function': {'arguments': '{"location": "Cobourg, Ontario"}',
'name': 'get_lat'},
'type': 'function'},
{'id': 'call_3HrT4gh7oX8Yh2gMirC6Lq2y',
'function': {'arguments': '{"location": "Cobourg, Ontario"}',
'name': 'get_long'},
'type': 'function'},
{'id': 'call_Z6lrL2GDeCoXzBKkQ23IFodR',
'function': {'arguments': '{"location": "Cobourg, Ontario"}',
'name': 'get_display_name'},
'type': 'function'}]},
'type': 'submit_tool_outputs'},
'started_at': 1701577250,
'status': 'requires_action',
You can see the three function names ‘get_lat’, ‘get_long’, and get_display_name and the argument to pass to them that was pulled from the prompt of my full address.
With File Retrieval
In the next iteration, I used file retrieval to pull the location from a plain text file that had a single contact name and address in it. Here is what the same section of the run object looked like. It’s quite muddled and I can’t find this structure documented anywhere. I suspect its simply a matter that we are dealing with beta code and OpenAI may be in the process of changing the structure of the run object.
'required_action': {'submit_tool_outputs': {'tool_calls': [{'id': 'call_O5hqVnwak0UWOEGqWRUQEKt7',
'function': {'arguments': '{\n "tool_uses": [\n {\n "recipient_name": "functions.get_lat",
\n "parameters": {\n "location": "999 William St, Cobourg, Ontario"\n }\n },\n
{\n "recipient_name": "functions.get_long",
\n "parameters": {\n "location": "999 William St, Cobourg, Ontario"\n }\n }\n ]\n}',
'name': 'parallel'},
'type': 'function'}]},
'type': 'submit_tool_outputs'},
'started_at': 1701548209,
'status': 'requires_action',
I have not defined a function with the name of parallel and I can see my function names of get_lat and get_long in the strings “functions.get_lat” and “functions.get_long”. Interesting, albeit a little wonky right now.
EDIT: Over time, I continued to get this kind of undocumented run object, not every time but frequently enough to be annoying. In the end, I simply added the instruction “Do not do function calling in parallel”. I can’t say for sure, but it seems to work.