Why is using a response_schema not supported when using grounded search?

This seems to a be really “Modified by moderator” limitation, especially with the regressions in the latest stable release of 2.5, which is far from stable. I really dont want to switch back to OpenAI.

response = client.models.generate_content(
            model=model,
            contents=user_prompt,
            config=GenerateContentConfig(tools=[google_search_tool],
                                         system_instruction=system_prompt,
                                         response_schema=response_schema,
                                         response_mime_type="application/json",
                                         temperature=0.6,
                                         seed=seed,
                                         thinking_config=ThinkingConfig(include_thoughts=True)))

google.genai.errors.ClientError: 400 INVALID_ARGUMENT. {‘error’: {‘code’: 400, ‘message’: “Tool use with a response mime type: ‘application/json’ is unsupported”, ‘status’: ‘INVALID_ARGUMENT’}}

Is there any plans to support this soon?

Thanks

UPDATE:

So it seams if you remove the response_mime_type="application/json", it at least works, and does give me back JSON. Now running it at scale to see how often if doesnt. Wish me luck.

New code:

        response = client.models.generate_content(
            model=model,
            contents=user_prompt,
            config=GenerateContentConfig(tools=[google_search_tool],
                                         system_instruction=system_prompt,
                                         response_schema=response_schema,
                                         temperature=0.6,
                                         seed=seed,
                                         thinking_config=ThinkingConfig(include_thoughts=True)))

Hello,

Currently response_schema with grounded search is not supported yet.

@Lalit_Kumar as per the original post, are there any plans to support this soon? It feel like a major limitation that two major features (structured outputs & google seach) can’t be used together.

1 Like

@Lalit_Kumar Any response to my question - any plans to support it?

1 Like

Also wondering about this

Hello,

It is difficult to comment on the implementation plans for future features. For the time being, we recommend keeping an eye on the documentation for any updates.

That’s very strange, and makes no sense!
Please enable json response when using tools like search!

1 Like

Please implement! :slight_smile:

Hello,

We have communicated your request with the concerned team. Thank you for your patience.

1 Like