Thanks. I’m not even talking about Gemini Live.
Please try running the following minimal reproducible example multiple times, you’ll see that Gemini very often does not say before calling the functions:
import os
from openai import OpenAI
from dotenv import load_dotenv
load_dotenv()
client = OpenAI(
api_key=os.environ["GEMINI_API_KEY"],
base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
)
weather_description = (
'Retrieves current weather for the given location. Before calling this function, '
'says "Let me check the weather for you..."'
)
population_description = (
"Retrieves current population for the given city. Before calling this function, "
"it says 'Let me check the population for you...' Args: city (str): Name of the "
"city. Returns: float: The popualation in millions of people."
)
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": weather_description,
"parameters": {
"type": "object",
"properties": {
"latitude": {"type": "number"},
"longitude": {"type": "number"},
},
"required": ["latitude", "longitude"],
},
},
},
{
"type": "function",
"function": {
"name": "get_population",
"description": population_description,
"parameters": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
},
},
]
messages = [
{
"role": "system",
"content": (
"You are a helpful assistant.\n"
"You have the following tools at your disposal:\n"
f"- get_weather: {weather_description}\n"
f"- get_population: {population_description}\n"
"\nIMPORTANT: You must call multiple functions at the same time. "
"EXTREMELY IMPORTANT: BEFORE calling the tools, says 'Let me check that for you...'."
),
},
{
"role": "user",
"content": "Please check the weather and the current population in Paris.",
},
]
stream = client.chat.completions.create(
model="gemini-3.1-flash-lite",
messages=messages,
tools=tools,
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta
if delta.content:
print("** TEXT:", repr(delta.content))
for tool_call in delta.tool_calls or []:
print("** TOOL:", tool_call)