Closed Rukomoynikov closed 1 month ago
@Rukomoynikov I'll take a look at this a bit later today.
@Rukomoynikov I'll take a look at this a bit later today.
Sure. Here is a simple way to reproduce and confirm the bug:
byebug\debugger
to https://github.com/patterns-ai-core/langchainrb/blob/89a2cbffec353a2f4eeafb92318e2c41e035b45b/lib/langchain/llm/google_gemini.rb#L101bin/console
) and run this:
llm = Langchain::LLM::GoogleGemini.new(api_key: 'api_key')
news_retriever = Langchain::Tool::NewsRetriever.new(api_key: 'api_key')
Langchain::Assistant.new( llm: llm, tools: [news_retriever], instructions: 'You are a news reporter.' ).add_message_and_run content:"What's are latest news on the 2024 elections?",auto_tool_execution: true
----
So, expected params sent to Google should contain `sort_by`. But since the method below recursively converts all hash keys to camelCase it sends `sortBy`.
https://github.com/patterns-ai-core/langchainrb/blob/89a2cbffec353a2f4eeafb92318e2c41e035b45b/lib/langchain/llm/google_gemini.rb#L65
@Rukomoynikov Yep, you're right, this is definitely a bug:
[3] pry(#<Langchain::LLM::GoogleGemini>)> Langchain::Utils::HashTransformer.camelize_lower("sort_by").to_sym
=> :sortBy
@Rukomoynikov I think it was an oversight on my side to let this change go through: https://github.com/patterns-ai-core/langchainrb/pull/665#discussion_r1634024204
I think just reverting that one change would be the proper fix.
@Rukomoynikov Closing this PR as I fixed it here: https://github.com/patterns-ai-core/langchainrb/pull/723
Google Gemini or better say news_retriever tool didn't work due to the updates in the list of arguments. See the error message: