Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chat_gemini needs echo = "none" otherwise it doesn't capture full response #199

Closed
leesahanders opened this issue Dec 5, 2024 · 2 comments · Fixed by #201
Closed

chat_gemini needs echo = "none" otherwise it doesn't capture full response #199

leesahanders opened this issue Dec 5, 2024 · 2 comments · Fixed by #201

Comments

@leesahanders
Copy link

I'm trying to capture the response and save it as a variable. Default streaming (text or all) results in only the first word being captured.

chat <- chat_gemini(
  model = "gemini-1.5-flash"
)
chat1.gemini1.5flash <- chat$chat(ch1)

chat1.gemini1.5flash
[1] "The"

But if I set echo to none then it is successfully captured:

chat <- chat_gemini(
  model = "gemini-1.5-flash",
  echo = "none" # echo text or all results in only the beginning of the response being captured
)
chat1.gemini1.5flash <- chat$chat(ch1)

> chat1.gemini1.5flash
[1] "The Moon doesn't have a capital city because it's not a country or a political entity with a government.  It's a natural satellite of Earth.\n"

Its only for gemini, no issue capturing the text for openai, claude, or llama

I was asked to add this - Joe says merge_dicts is not working correctly for Gemini, and Google’s implementation is here

@jcheng5
Copy link
Collaborator

jcheng5 commented Dec 6, 2024

If you print the chat1 object you'll also see that the message that's saved in the conversation history only includes the one "The" word. So this will also cause Gemini to have no idea what you're talking about in subsequent exchanges.

hadley added a commit that referenced this issue Dec 18, 2024
Fixes #199.

---------

Co-authored-by: Hadley Wickham <[email protected]>
@jcheng5
Copy link
Collaborator

jcheng5 commented Dec 18, 2024

Thanks @leesahanders, so glad you caught this one!

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 a pull request may close this issue.

2 participants