Yes, also discovered the documentation is wrong.
because messages.append(response_message)
returns an object and not like a JSON object in the form of role and content.
so this obviously throws an error.
I am able to get my code to call the function but yes responding after always throws an error:
openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid type for 'messages[4].content[0]': expected an object, but got a string instead.", 'type': 'invalid_request_error', 'param': 'messages[4].content[0]', 'code': 'invalid_type'}}
And this is messages[4]
which is after my function call:
{'tool_call_id': 'call_hhKpjAtgSxgfWgh1BK1Jcizr', 'role': 'tool', 'name': 'fetch_listing_data', 'content': {'foo': 'bar'}}]
Funny cause it’s a JSON string and I don’t know what they want in terms of an object.