Title: Interactions API: image generation returns no image/text when the google_search tool includes search_types (any value); works without search_types and via generateContent
Summary:
When I call the Interactions API with an image generation model and the google_search tool, no image or text is generated if I specify search_types (any value). Without search_types, or with the generateContent API, everything works. The code is taken from the official documentation (https://ai.google.dev/gemini-api/docs/image-generation).
Observed behavior:
The raw response is cut off midway and contains neither text nor an image.
Test results (same prompt, same code except for the tools parameter):
Interactions API, models gemini-nano-banana-2.1 and gemini-3.1-flash-image (same results for both):
- tools=[{“type”: “google_search”}] → works
- tools=[{“type”: “google_search”, “search_types”: [“web_search”]}] → no image/text
- tools=[{“type”: “google_search”, “search_types”: [“image_search”]}] → no image/text
- tools=[{“type”: “google_search”, “search_types”: [“web_search”, “image_search”]}] → no image/text
generateContent API (with Google Search grounding and image search enabled): works for the same models.
Minimal reproduction (Python, google-genai SDK):
from google import genai
import base64
client = genai.Client(api_key=“API_KEY”)
interaction = client.interactions.create(
model=“gemini-nano-banana-2.1”,
input=“A detailed painting of a Timareta butterfly resting on a flower.”,
tools=[{
“type”: “google_search”,
“search_types”: [“web_search”, “image_search”]
}],
response_format=[
{“type”: “text”},
{“type”: “image”,
“mime_type”: “image/jpeg”,
“aspect_ratio”: “16:9”},
]
)
for step in interaction.steps:
if step.type == “model_output”:
for content_block in step.content:
if content_block.type == “text”:
if content_block.text:
print(content_block.text)
if content_block.type == “image”:
with open(“picture.jpg”, “wb”) as f:
f.write(base64.b64decode(content_block.data))
Raw response (truncated output):
signature=‘–omission–’ summary=None type=‘thought’
arguments={‘queries’: [‘–omission–’]} id=‘call_887936’ name=‘google:image_search’ type=‘function_call’ signature=‘–omission–’
Environment:
- google-genai version: 2.31.0
- Python: 3.14.8
- AI Studio playground: image search works there (it may use a different API path than the Interactions API)
- SDK versions: the issue reproduces with the latest and with several older google-genai versions, so it does not appear to be SDK-related
Expected behavior:
An image is generated, grounded with web and/or image search, as described in the documentation.
Since the symptom does not depend on the SDK version and only appears on the Interactions API when search_types is specified, this looks like a server-side issue in the Interactions API.
Could you please confirm whether this is a known issue and whether the search_types handling in the Interactions API for image generation models is being investigated?
Thank you.