Skip to content

fix: send litellm the gemini provider name when a Bot is set to Google - #1354

Open
pcbeingused333 wants to merge 2 commits into
CopilotKit:mainfrom
pcbeingused333:fix/google-litellm-gemini
Open

pcbeingused333 wants to merge 2 commits into
CopilotKit:mainfrom
pcbeingused333:fix/google-litellm-gemini

Conversation

@pcbeingused333

Copy link
Copy Markdown

What this changes

The CrewAI, Agno, LlamaIndex, ADK, Strands and Langroid Bots hand litellm a model as provider/model, with provider being OpenBot's own id. For Google that is google/gemini-2.5-flash, and litellm has no google provider (litellm.get_llm_provider raises BadRequestError: LLM Provider NOT provided); its name for Google AI Studio is gemini. So a Bot set to Google failed every model call. gemini/... resolves, and litellm reads GOOGLE_API_KEY for it, which is the variable Compose already passes.

shared/model_providers.py gains litellm_model_id(provider, model), which translates that one name and passes every other provider through as typed. The six _model_id() / _model() functions use it (Langroid keeps its litellm/ prefix in front).

Where it runs

  • New state that outlives a request? None.
  • What happens on the second replica? Nothing differs; it is a string built at start.
  • Anything serialised? No.
  • Anything fanned out to a browser? No.
  • New listener, port, or schedule? No.

Boundary and audit

  • Every acting call still goes through the gateway: resolve, decide, audit, then act.
  • New refusals and new failures each write a row. (none added)
  • Nothing new is trusted from the client that the server can resolve itself.

Changelog

  • A line in CHANGELOG.md under Unreleased.

Proof

In python:3.12, pytest tests -k model in each Bot directory:

  • main without the fix: agno collection error (new helper test), strands 1 failed / 13 passed, crewai 1 failed / 19 passed (the new google row)
  • with this change: agno 13 passed, strands 14 passed, crewai 20 passed

ADK, LlamaIndex and Langroid use the same helper but have no model-id test of their own; their full suites pass with this change (31, 11 and 14 passed).

With each of those three Bots' requirements.txt installed and only GOOGLE_API_KEY set, litellm.get_llm_provider raises on google/gemini-2.5-flash and resolves gemini/gemini-2.5-flash, and litellm.completion on the latter builds a generativelanguage.googleapis.com request carrying that key in x-goog-api-key. The HTTP call was stubbed: no request reached Gemini.

This change was prepared with the assistance of an AI coding agent (Claude Code).

The CrewAI, Agno, LlamaIndex, ADK, Strands and Langroid Bots address their
model to litellm as provider/model, passing OpenBot's provider id through
unchanged. For Google that is google/<model>, which litellm does not
recognise (BadRequestError: LLM Provider NOT provided); its name for Google
AI Studio is gemini. Translate that one name in a shared helper.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant