# Function Calling - Stream Model

**URL:** <https://discuss.ai.google.dev/t/function-calling-stream-model/6778>\
**Category:** Gemini API\
**Tags:** gemini-15\
**Created:** [July 1, 2024, 9:12am UTC](https://discuss.ai.google.dev/t/function-calling-stream-model/6778 "2024-07-01T09:12:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tiger\_Wang](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/tiger_wang/32/5785_2.png) [@Tiger\_Wang](https://discuss.ai.google.dev/u/Tiger_Wang)\
**Post date:** [July 1, 2024, 9:12am UTC](https://discuss.ai.google.dev/t/function-calling-stream-model/6778/1 "2024-07-01T09:12:33Z")

</div>

I am using Gemini’s1.5 streaming interface with Function Calling, the request is as follows:

```auto
{
    "contents" : [
        {
            "role" : "user",
            "parts" : [
                {
                    "text" : "What is the weather like in London"
                }
            ]
        }
    ],
    "tools" : [
        {
            "function_declarations" : [
                {
                    "name" : "get_current_weather",
                    "description" : "Get the current weather in a given location",
                    "parameters" : {
                        "type" : "object",
                        "properties" : {
                            "location" : {
                                "type" : "string",
                                "description" : "The city and state, e.g. San Francisco, CA"
                            },
                            "unit" : {
                                "type" : "string",
                                "enum" : [
                                    "celsius",
                                    "fahrenheit"
                                ]
                            }
                        },
                        "required" : [
                            "location"
                        ]
                    }
                }
            ]
        }
    ],
    "generationConfig" : {
        "maxOutputTokens" : 1024
    }
}

```

URI: /v1beta/models/gemini-1.5-pro:streamGenerateContent

The response result is throwing an error:

```auto
[{
  "error": {
    "code": 400,
    "message": "Request contains an invalid argument.",
    "status": "INVALID_ARGUMENT"
  }
}
]
type or paste code here

```

It works fine with the non-streaming interface, is there something misconfigured somewhere?

---

<div class="post-metadata">

**Author:** ![derrick](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/derrick/32/398_2.png) [@derrick](https://discuss.ai.google.dev/u/derrick)\
**Post date:** [July 1, 2024, 5:52pm UTC](https://discuss.ai.google.dev/t/function-calling-stream-model/6778/2 "2024-07-01T17:52:38Z")

</div>

Isn’t a stream supposed to contain `?alt=sse` in URI?

---

<div class="post-metadata">

**Author:** ![afirstenberg](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/afirstenberg/32/202_2.png) [@afirstenberg](https://discuss.ai.google.dev/u/afirstenberg)\
**Post date:** [July 2, 2024, 2:01pm UTC](https://discuss.ai.google.dev/t/function-calling-stream-model/6778/3 "2024-07-02T14:01:33Z")

</div>

Good thought! But…

`alt=sse` is one possible output format for streaming. (Generally a better one, but not the only one.)  
If you don’t specify that, you’ll get a streamed JSON object.

---

<div class="post-metadata">

**Author:** ![Petr\_Gazarov\_Anneal](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/petr_gazarov_anneal/32/4341_2.png) [@Petr\_Gazarov\_Anneal](https://discuss.ai.google.dev/u/Petr_Gazarov_Anneal)\
**Post date:** [July 5, 2024, 9:07pm UTC](https://discuss.ai.google.dev/t/function-calling-stream-model/6778/4 "2024-07-05T21:07:46Z")

</div>

Possibly related: [Bug - seeing Request contains an invalid argument when using tool calling](http://discuss.ai.google.dev/t/bug-seeing-request-contains-an-invalid-argument-when-using-tool-calling/6457)

---

<div class="post-metadata">

**Author:** ![Tiger\_Wang](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/tiger_wang/32/5785_2.png) [@Tiger\_Wang](https://discuss.ai.google.dev/u/Tiger_Wang)\
**Post date:** [August 3, 2024, 10:15am UTC](https://discuss.ai.google.dev/t/function-calling-stream-model/6778/5 "2024-08-03T10:15:35Z")

</div>

Thanks for the heads-up! I actually didn’t add `?alt=sse` , and I didn’t make any code changes either, but it’s working fine now. I think this was a bug with Gemini, and it looks like they’ve fixed it. That detail is really helpful!

---

<div class="post-metadata">

**Author:** ![Tiger\_Wang](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/tiger_wang/32/5785_2.png) [@Tiger\_Wang](https://discuss.ai.google.dev/u/Tiger_Wang)\
**Post date:** [August 3, 2024, 10:16am UTC](https://discuss.ai.google.dev/t/function-calling-stream-model/6778/6 "2024-08-03T10:16:23Z")

</div>

Thanks for your feedback! I thought it was a bug, and after waiting a bit, everything’s working fine now without me changing any code. Looks like Gemini has fixed the issue—great news!

---

<div class="post-metadata">

**Author:** ![system](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/system/32/1_2.png) [@system](https://discuss.ai.google.dev/u/system)\
**Post date:** [November 5, 2026, 6:17pm UTC](https://discuss.ai.google.dev/t/function-calling-stream-model/6778/7 "2026-11-05T18:17:15Z")

</div>

Closed on November 5, 2026, 6:17pm UTC

This thread was automatically closed 60 days after the last reply. If you are running into an issue, please create a new post.
