Skip to content

Conversation

@JINO-ROHIT
Copy link
Collaborator

Gemini support structured output with tool call.

Links #2364

@JINO-ROHIT JINO-ROHIT requested a review from Wendong-Fan May 11, 2025 11:07
@JINO-ROHIT JINO-ROHIT linked an issue May 11, 2025 that may be closed by this pull request
2 tasks
@JINO-ROHIT JINO-ROHIT self-assigned this May 11, 2025
@Wendong-Fan Wendong-Fan added the Review Required PR need to be reviewed label May 18, 2025
@Wendong-Fan Wendong-Fan added this to the Sprint 29 milestone May 18, 2025
Copy link
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @JINO-ROHIT , With more complex tasks I’m seeing errors when we force the “tool‑call first, then structured output” sequence. Sometimes ChatAgent().step makes multiple LLM calls, which breaks that assumption. A cleaner fix might be to move the handling into ChatAgent()._format_response_if_needed instead?

else:
return await self._arequest_chat_completion(messages, tools)
# For tool calls, first get the tool response
completion = self._arequest_chat_completion(messages, tools)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use await for async function

@Wendong-Fan Wendong-Fan changed the title Gemini toolcall feat: Gemini toolcall May 18, 2025
@Wendong-Fan Wendong-Fan added Waiting for Update PR has been reviewed, need to be updated based on review comment and removed Review Required PR need to be reviewed labels May 18, 2025
@JINO-ROHIT
Copy link
Collaborator Author

hmm great suggestion, will do

@JINO-ROHIT
Copy link
Collaborator Author

can you also post a sample complex task where it fails, so i can test after my changes, thanks!

@Wendong-Fan
Copy link
Member

can you also post a sample complex task where it fails, so i can test after my changes, thanks!

https://github.com/camel-ai/camel/blob/master/examples/structured_response/json_format_reponse_with_tools.py

@JINO-ROHIT
Copy link
Collaborator Author

honestly, ive tried a lot to make this work, but in general gemini tool calling seems awful, i cant really get it to work.
(in general what i read from the internet is also along the same lines)

any ideas on what we do next?

@Wendong-Fan
Copy link
Member

honestly, ive tried a lot to make this work, but in general gemini tool calling seems awful, i cant really get it to work. (in general what i read from the internet is also along the same lines)

any ideas on what we do next?

No worries at all, Jino. I appreciate the effort you've put into the Gemini tool calling. I understand that it's tricky, and it's more of a 'nice-to-have' right now. Let's park this for the time being, and I'll take another look once I've cleared some higher-priority items from my plate

@Wendong-Fan Wendong-Fan added Pending and removed Waiting for Update PR has been reviewed, need to be updated based on review comment labels Jun 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[Feature Request] Gemini support structured output with tool call

2 participants