Asst api tool_call not returning valid json

instead of tool_call arguments being valid json, a literal function call is being returned?

tool_call.function.arguments == functions.rename_file(

Error Log:

Run status:  requires_action
tool_call.function.arguments: functions.rename_file(
Traceback (most recent call last):
  File "", line 377, in <module>
  File "", line 346, in main
  File "", line 157, in rename_files
    query_last_thread(f'Read {f_id}, generate a meaningful name based on the contents, and rename it using rename_file_interface.')
  File "", line 329, in query_last_thread
    return query(q, get_thread(lt_id))
  File "", line 318, in query
    run = call_tool(run, thread)
  File "", line 247, in call_tool
    arguments = json.loads(tool_call.function.arguments)
  File "/usr/lib/python3.8/json/", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/json/", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Asst details; I tried spelling it out in description too, but still won’t return json arguments:

asst_name = "File Renamer Assistant"
asst_instructions="""You help users rename uploaded files by analyzing their contents, generating a concise and descriptive new name based on the 
file contents, and calling your rename_file function, according to your rename_file_interface, including valid json arguments.
asst_model="gpt-4-1106-preview" # cheaper, faster, dumber model: gpt-3.5-turbo

# assistant functions

def rename_file(old_name, new_name):
    print(f'Renaming {old_name} to {new_name}')
    command = ['cp', old_name, f'renamed/{new_name}']
    result =, capture_output=True, text=True)
    return result.stdout if result.returncode == 0 else result.stderr

# assistant function interfaces

rename_file_interface = {
    "name": "rename_file",
    "description": """Renames the input file by passing old_name and new_name VALID JSON arguments, 
        e.g. \"arguments\": \"{\"old_name\":\"old_name.txt\", \"new_name\":\"new_name.txt\"}\"""",
    "parameters": {
        "type": "object",
        "properties": {
            "old_name": {
                "type": "string",
                "description": "The old name of the file, including it's extention; e.g. old_name.ext, NOT file_########"
            "new_name": {
                "type": "string",
                "description": "The new name of the file, including it's extention; e.g. new_name.ext"
        "required": ["old_name", "new_name"]

# assistant tools
asst_tools=[#{"type": "code_interpreter"},
            {"type": "retrieval"},
            {"type": "function", "function": rename_file_interface},