I have a FastAPI backend sending requests to responses-api and I’m using a chat prompt created here with a tool/function defined: Chat - OpenAI API
I have a first call that look like this:
response = await client.responses.create(
prompt={ "id": prompt_id, "variables": { "current_datetime": datetime.now(timezone.utc).isoformat(), }, }, input=message )
That call successfully gets a response back and returns a function_call.
I make the function call, complete it, and want to call response-api again to confirm the result of the function call.
I’ve read and following the instructions here: https://platform.openai.com/docs/api-reference/responses/create and for the life of me I can’t get it to work.
If I understand correctly, my request should look like this:
await client.responses.create(
input= [
{
"input item list": [
{
"item": {
"function tool call output": {
"call_id": function_call_id,
"output": {"status": "success"},
"type": "function_call_output",
"status": "completed"
},
"input message": {
"role": "user",
"status": "completed"
},
},
},
],
},
],
prompt={
"id": prompt_id,
"variables": {
"current_datetime": datetime.now(timezone.utc).isoformat(),
},
},
)
I get errors such as: Error code: 400 - {‘error’: {‘message’: “Invalid value: ‘’. Supported values are: ‘assistant’, ‘system’, ‘developer’, and ‘user’.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘input[0]’, ‘code’: ‘invalid_value’}}
which, if I understand correctly, is asking for something that isn’t part of the structure of the documentation.
Anyway, I include a role field it’s asking for, but keep getting errors.
openai.BadRequestError: Error code: 400 - {‘error’: {‘message’: “Unknown parameter: ‘input[0].input item list’.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘input[0].input item list’, ‘code’: ‘unknown_parameter’}}
whereas “input item list” is part of the documentation.
Anyone has any insights, ideas? Thanks in advance.