Is it possible to pass the response ID to a function?

I am using the API to transcribe videos. After the video is transcribed I pass that transcription to the responses API to create a summary. I have a function tool available that will email that summary. I would like to include in that summary the response ID but so far I have not been successful.

This is the JSON schema:

{
“type”: “function”,
“name”: “email_user”,
“description”: “Emails a user with the given message and logs the top-level OpenAI response ID.”,
“strict”: false,
“parameters”: {
“type”: “object”,
“properties”: {
“emailaddress”: {
“type”: “string”,
“description”: “The user’s email address to send the message to.”
},
“subject”: {
“type”: “string”,
“description”: “The subject of the email.”
},
“body”: {
“type”: “string”,
“description”: “The body/content of the email.”
},
“response_id”: {
“type”: “string”,
“description”: “The top-level OpenAI response ID (e.g., resp_0e4bb2f8fa071f1c0069137922d05081968104467f575f0b74) returned by the API when this message was generated.”
}
},
“required”: [“emailaddress”, “subject”, “body”, “response_id”]
}
}

This is sending a response ID, but it’s made up and not valid.

Let’s clarify what a developer function is: a specification that an AI receives, and a “recipient” it can send to internally that has you receive a function name and arguments. Typically this returns data to a chat AI so it can report the success or the returned data to the user.

Who is filling out all the fields of a function call? Answer: The AI model is. The AI is following the instructions of the function, and determining when the function is useful to send to get some kind of result.

Your AI might be: “You are a specialist with one job: you send to a summary emailing function always, and write a summary of the transcription you received, which completes your transaction.”

(that can also be a structured output format, as the call/return of a chat is not necessary in a single API processing)

What if you try to include, *“you also write the underlying response ID that your API output will be assigned when sent to the developer”? That doesn’t make much sense. API parameters are not exposed to the model.

“Hey, Mike, when you reply to me on the forum, tell me the reply ID that the OpenAI forum software is going to assign to your posting, please!” - just as impossible.

You should be able to construct the information in software though. There is a response ID that is used for the Responses API exclusively, and there is also a request ID returned in the header that is only useful for OpenAI staff, but could be put in your own API call database.

Your code that handles the function can get the Responses ID from either the initial Responses API created event, or await the final “done” event if streaming that has the complete gathered object response object with "id".

Then send the email with programmatic insertion like a form letter? Do you actually have some use for giving your proprietary API platform data to your end user, or you were just wondering how to get the response ID of the summary AI’s call?

I understand that I can get the response ID from the returned JSON object. The goal here is send the ID to the function call which processes and sends those messages. Those emails are coming from ai@ email address. In the event that someone responses to an email that ai sent, I need that response ID sent with it to continue the conversation. The ai@ inbox is checked periodically, and the software checks for any existing ref_id: strings. If those strings are found they are parsed out and sent to the API for the next response and those messages are replied to via open ai. How’s its currently set up, open ai is simply making up a response ID and not sending the true response ID to the function call.

You are in full control of the returned function. You have to write code to catch and handle it. You can amend it any way you want.

You may need to create a function that the AI can understand, but are sending to an API with a massive list of parameters with no semantics to the key naming. You have a translation layer.

The weather tool I use takes a latitude and longitude in a CONUS grid and has about 20 potential field returns? I’m not going to have my chat AI write coordinates from its knowledge and have a large chance of error. I use a natural language geo search service on what the AI has written as a location, have another AI compare the user input and written query to the list of about 10 ranked cities that are returned (and also don’t ask that AI to write lat/long), then run the selected location on the actual weather function with translation of days needed to time intervals, and then rewrite all that to natural language for placement.

You’re smart enough to append an API’s response ID onto the called function arguments. The AI doesn’t know it and can’t put it in a function call or structured response JSON.