# Responses API returns message + function\_call

**URL:** <https://community.openai.com/t/responses-api-returns-message-function-call/1293055>\
**Category:** API\
**Tags:** responses-endpoint, responses, responses-api\
**Created:** [June 19, 2025, 4:35pm UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055 "2025-06-19T16:35:57Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dimitrius](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Dimitrius](https://community.openai.com/u/Dimitrius)\
**Post date:** [June 19, 2025, 4:35pm UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/1 "2025-06-19T16:35:57Z")

</div>

Hello All,  
I am building a chatbot using the responses API and am having a problem when `GPT-4.1-mini` returns both `message` and `function_call`. See the example below:

```auto
  "output": [{
      "id": "msg_685434d722c8819b807abcdc03cc9cc80ed0eb9962f32640",
      "role": "assistant",
      "type": "message",
      "status": "completed",
      "content": [{
          "text": "{\"assistant_message\":\"Please provide your email address used for the order so I can check the delivery status for you.\",\"assistant_quick_replies\":[]}",
          "type": "output_text",
          "annotations": []
        }
      ]
    },
	... 7 similar message cut here ...
    {
      "id": "fc_685434df74d4819b93276af011d65ede0ed0eb9962f32640",
      "name": "check_delivery_status",
      "type": "function_call",
      "status": "completed",
      "call_id": "call_HdtDqdWf9jqaKmAPLPJi2iJm",
      "arguments": "{\"email\":\"user@example.com\"}"
    }
  ],

```

Actually, here I have 3 problems:

- `message` is mixed with `function_call`, which one should I choose? Should I show the message or call the function? (In my example, showing the message is the right thing to do, as the LLM has not collected the user’s email yet)
- I have 8 similar messages. ??? Okay, I can pick up the first one, but I don’t want to pay for all eight. I read and added “Please return one complete response and then stop.” instruction, but as you can see, it does not work.
- The email address in the function call argument is hallucinated ([user@example.com](mailto:user@example.com))

To give you more context, I am using structured output like the following:

```auto
"model": "gpt-4.1-mini",
"text": {
	"format": {
	  "type": "json_schema",
	  "name": "assistant_response",
	  "schema": {
		"type": "object",
		"properties": {
		  "assistant_message": {
			"type": "string",
			"description": "Assistant's response"
		  },
		  "assistant_quick_replies": {
			"type": "array",
			"description": "List of suggested quick replies buttons for the user. May contain user's email if mentioned previously. Populated ONLY when returned by a function call (assistant_quick_replies field), otherwise it is [].",
			"items": {
			  "type": "string",
			  "description": "Short text for a quick reply button."
			}
		  }
		},
		"required": [
		  "assistant_message",
		  "assistant_quick_replies"
		],
		"additionalProperties": false
	  },
	  "strict": true
	}
}

```

Did anyone face these issues with the response API?  
I mostly interested in handling mix of `message` and `function_call`

---

<div class="post-metadata">

**Author:** ![solo](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/solo/32/256395_2.png) [@solo](https://community.openai.com/u/solo)\
**Post date:** [June 19, 2025, 10:41pm UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/2 "2025-06-19T22:41:51Z")

</div>

Can I see your tool descriptions and system prompt if you have one? I’ve 4.1-mini give me a `message` and `function_call` too but the `message` was just its reason for needing to call the tool.

---

<div class="post-metadata">

**Author:** ![Dimitrius](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Dimitrius](https://community.openai.com/u/Dimitrius)\
**Post date:** [June 20, 2025, 7:43am UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/3 "2025-06-20T07:43:03Z")

</div>

Here are 2 function definitions I use. I cut 2 other functions to make the JSON smaller

```auto
{
  "type": "function",
  "name": "check_delivery_status",
  "description": "Check the status of the user's shipment like expected delivery date, current tracking info, etc.",
  "strict": true,
  "parameters": {
    "type": "object",
    "properties": {
      "email": {
        "type": "string",
        "description": "Valid user's email address",
        "format": "email"
      }
    },
    "required": [
      "email"
    ],
    "additionalProperties": false
  }
}, {
  "type": "function",
  "name": "main_menu",
  "description": "Shows the main menu. Restarts the conversation",
  "strict": true,
  "parameters": {
    "type": "object",
    "required": [],
    "properties": {},
    "additionalProperties": false
  }
}

```

BTW, `"format": "email"` in the function property did not work for me, I had many times the model accepting incomplete emails like “dm@test”. I believe it is only supposed to be used in the structured output. Can someone from OpenAI comment on this?

---

<div class="post-metadata">

**Author:** ![Dimitrius](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Dimitrius](https://community.openai.com/u/Dimitrius)\
**Post date:** [June 20, 2025, 7:44am UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/4 "2025-06-20T07:44:18Z")

</div>

> [@solo](#):
>
> the `message` was just its reason for needing to call the tool

hmm, i never had a message that desribes a reason for function call, for me it is always variations of the same text “Please provide your email address…”

---

<div class="post-metadata">

**Author:** ![Dimitrius](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Dimitrius](https://community.openai.com/u/Dimitrius)\
**Post date:** [June 20, 2025, 8:07am UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/5 "2025-06-20T08:07:02Z")

</div>

The responses `output` list reminds me of the `choices` of the completion API, the model generates some variations of its responses, and the function call comes as one of the variants.

It also seems to me that the order of `output` items is important. **The first item is the most important one** , so taking only `output[0]` into account and ignoring everything else can be a good strategy for now, until OpenAI provides more guidelines.

Note that when you are using the `file_search` tool, it seems to always insert its output into the 1st element. That aligns with my idea of the priority of `output` items; the model considers the file search results to be the most reliable. So in that case, your `output[0]` strategy should be changed to: get the first element while ignoring the `file_search_call` element.

Can someone from OpenAI comment on this? Please!

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [June 20, 2025, 8:23am UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/6 "2025-06-20T08:23:48Z")

</div>

> [@Dimitrius](#):
>
> hmm, i never had a message that desribes a reason for function call, for me it is always variations of the same text “Please provide your email address…”

The AI has always been able to write text and then also call a function in the same output, before it finally finishes.

Responses API endpoint just makes this more annoying to handle and pass back, by making the same assistant AI generation split into two different output objects, equivalent also to out-of-band array items like reasoning summary or code interpreter inputs.

---

<div class="post-metadata">

**Author:** ![solo](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/solo/32/256395_2.png) [@solo](https://community.openai.com/u/solo)\
**Post date:** [June 20, 2025, 3:26pm UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/7 "2025-06-20T15:26:33Z")

</div>

Can you try changing the email description to this: “Valid user’s email address. This should be provided by the user. If the user hasn’t provided an email yet then ask the user before using this tool.”

Not sure what your system instructions are but there is nothing in your tool description that explicitly tells the model where the email should come from. You are expecting it to assume that it should be provided by the user but it is better to explicitly tell it that.

If your tools are clear then you _should_ be able to safely ignore any messages in the output if there is a tool call since the message _should_ only ever be reasoning about calling a tool if anything.

---

<div class="post-metadata">

**Author:** ![Dimitrius](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Dimitrius](https://community.openai.com/u/Dimitrius)\
**Post date:** [June 20, 2025, 3:28pm UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/8 "2025-06-20T15:28:51Z")

</div>

here is the sys prompt part concerning collecting email

```auto
## Function calling
- Call "check_delivery_status" when the customer asks about order status, tracking info, etc.
- Always collect the customer's email address and make sure it is valid before calling "check_delivery_status"

```

---

<div class="post-metadata">

**Author:** ![solo](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/solo/32/256395_2.png) [@solo](https://community.openai.com/u/solo)\
**Post date:** [June 20, 2025, 3:38pm UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/9 "2025-06-20T15:38:17Z")

</div>

Ah ok, there it is. Can you still try moving that to the tool description and see if that resolves your issue. Even just appending it to the overall `check_delivery_status` description as “Always collect the customer’s email address and make sure it is valid before calling this tool.”

And I know this is annoying but what does the email being “valid” mean? Does it mean formatted as an email or a valid company email? If it’s a valid company email then does the model have a tool to validate the email? I’m not trying to be difficult, just trying to remove all ambiguity since there is something here obviously tripping up the model.

Also, I’ve never seen the `format` field for a tool definition. I’m not sure why the api isn’t giving you an error for sending it. Try removing that as well.

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [June 20, 2025, 4:51pm UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/10 "2025-06-20T16:51:29Z")

</div>

> [@solo](#):
>
> I’ve never seen the `format` field for a tool definition.

That is for structured output, where text → format → JSON Schema on the Responses endpoint replaces Chat Completions’ “response\_format” parameter.

This is not a tool call specification - this is the only output format the AI can write to the user in.

---

<div class="post-metadata">

**Author:** ![natev2020](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/natev2020/32/530540_2.png) [@natev2020](https://community.openai.com/u/natev2020)\
**Post date:** [June 21, 2025, 9:29pm UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/11 "2025-06-21T21:29:32Z")

</div>

Yes I keep getting the same errors when using API in my script

---

<div class="post-metadata">

**Author:** ![Dimitrius](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Dimitrius](https://community.openai.com/u/Dimitrius)\
**Post date:** [June 23, 2025, 7:00am UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/12 "2025-06-23T07:00:33Z")

</div>

> [@\_j](#):
>
> > [@solo](#):
> >
> > I’ve never seen the `format` field for a tool definition.
> 
> That is for structured output…

Agree, `"format": "email"` for strings is described in the structured output article. It did not work for me in the function parameter. Despite it would be great to have it there.

---

<div class="post-metadata">

**Author:** ![Dimitrius](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Dimitrius](https://community.openai.com/u/Dimitrius)\
**Post date:** [June 23, 2025, 3:03pm UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/13 "2025-06-23T15:03:25Z")

</div>

Let’s stick to the main topic of this thread, which is why Responses API returns `message`s and `function_call`s in the same `output`. What should we do when we see both? Show message or call the function?

Some new info.  
After I added 2 new functions, `check_delivery_status` stopped working.  
Now Responses generate:

1. `message` “I will check the delivery status for your order. Please hold on a moment.”
2. `function_call` `check_delivery_status` with correctly extracted email

It breaks my approach, where I believe the 1st message more. What to do?

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [June 23, 2025, 3:49pm UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/14 "2025-06-23T15:49:44Z")

</div>

> [@Dimitrius](#):
>
> What should we do when we see both?

See both? Do both.

You’ll get a stream of delta events for content that can be displayed immediately.  
Then you’ll have a collection of tool calls you must satisfy and return.

Your handler must not discard one, but instead, be written so it always services and collects both.

---

<div class="post-metadata">

**Author:** ![solo](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/solo/32/256395_2.png) [@solo](https://community.openai.com/u/solo)\
**Post date:** [June 24, 2025, 2:03am UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/15 "2025-06-24T02:03:42Z")

</div>

I don’t think he is using streaming here. So it wouldn’t really make sense to output the tool reasoning messages at the same time as the final response.

If the API/Model is performing correctly it should be safe to discard any `message` if there are any `function_call` present. The original issue you were seeing is something that should not happen if your system, tool, and parameter prompts are clear and applied appropriately.

---

<div class="post-metadata">

**Author:** ![Dimitrius](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@Dimitrius](https://community.openai.com/u/Dimitrius)\
**Post date:** [June 24, 2025, 8:14am UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/16 "2025-06-24T08:14:58Z")

</div>

> [@solo](#):
>
> it should be safe to discard any `message` if there are any `function_call` present

In my case, it is true when `output` has 1 message followed by 1 `function_call`. However, when the `output` contains 3-8 messages followed by 1 `function_call`, that function call always contains a hallucinated email address. That is how I came up with the idea that items of `output` are sorted by priority, so the 1st one is most reliable.

I agree that it is not normal. It would be nice to hear some comments from OpenAi

---

<div class="post-metadata">

**Author:** ![markns](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/markns/32/614911_2.png) [@markns](https://community.openai.com/u/markns)\
**Post date:** [July 14, 2025, 10:22am UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/17 "2025-07-14T10:22:09Z")

</div>

I’m running into a similar issue when using the agents sdk (wrapping the responses API). See the github issue here: [Agent run with previous\_response\_id fails - No tool output found for function call call\_WdnUUKXKvwy3jk.... · Issue #1061 · openai/openai-agents-python · GitHub](https://github.com/openai/openai-agents-python/issues/1061). As far as I can tell, this combined message + function\_tool response breaks the agents-sdk.

---

<div class="post-metadata">

**Author:** ![baki.kucukcakiroglu](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/baki.kucukcakiroglu/32/618324_2.png) [@baki.kucukcakiroglu](https://community.openai.com/u/baki.kucukcakiroglu)\
**Post date:** [July 15, 2025, 11:04am UTC](https://community.openai.com/t/responses-api-returns-message-function-call/1293055/18 "2025-07-15T11:04:34Z")

</div>

We are having the same issue with @markns .

Please see [toolUseBehavior: run\_llm\_again (default) doesn't work · Issue #180 · openai/openai-agents-js · GitHub](https://github.com/openai/openai-agents-js/issues/180)
