Skip to content

Conversation

@simonpcouch
Copy link
Collaborator

Closes #869.

library(ellmer)

tool_rnorm <- tool(
  function() rnorm(1),
  description = "Draw a number from a standard normal distribution"
)

gemini_3 <- chat_google_gemini(
  system_prompt = "Be terse.",
  model = "gemini-3-pro-preview"
)
gemini_3$register_tool(tool_rnorm)

gemini_3$chat("Draw a number from a standorm normal.")
#> ◯ [tool call] tool_001()
#> ● #> 0.8896
#> 0.8896

Created on 2025-11-18 with reprex v2.1.1

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

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

I think you could drop the hasName check and use compact to eliminate the NULL.

@hadley
Copy link
Member

hadley commented Nov 19, 2025

Also did we need some adjustment to params? I noticed you didn’t use it in the example.

@simonpcouch
Copy link
Collaborator Author

You got it, thank you!

Also did we need some adjustment to params? I noticed you didn’t use it in the example.

This references using params(reasoning_effort) rather than api_args(...(thinkingLevel))?

gemini_3 <- chat_google_gemini(
  model = "gemini-3-pro-preview",
  api_args = list(
    generationConfig = list(thinkingConfig = list(thinkingLevel = "low"))
  )
)

There's a default thinkingLevel, so setting that argument isn't required. The above is the same syntax as was used for Gemini 2.5 Pro, so I figured there might have been some other reason yall didn't incorporate that argument into params(reasoning_effort). I do agree that setting that params entry would be easier, but since this isn't a new API argument I left it for another PR.

@simonpcouch simonpcouch merged commit 22c93f2 into main Nov 19, 2025
11 checks passed
@simonpcouch simonpcouch deleted the thought-signatures-869 branch November 19, 2025 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check Gemini thinking signatures

3 participants