The google gemini api gives an error when used in litellm. #619

Closed
opened 2025-11-11 14:27:36 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @flyfox666 on GitHub (Apr 10, 2024).

Bug Report

Description

Bug Summary:
The google gemini api gives an error when used in litellm,when use in chat, error show:
GenerationConfig.init() got an unexpected keyword argument 'num_ctx'

Steps to Reproduce:
add gemini api in webui ,then refresh ,then use the model to chat

Expected Behavior:
no error

Actual Behavior:
error showen

Environment

  • Operating System: win11 ,ubuntu 22.04, docker for windows
  • **Browser (if applicable):**chrome latest

Reproduction Details

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.

Logs and Screenshots

Docker Container Logs:
[Include relevant Docker container logs, if applicable]
02:16:19 - LiteLLM Router:INFO: litellm.acompletion(model=gemini/gemini-pro) Exception GenerationConfig.init() got an unexpected keyword argument 'num_ctx'
INFO:LiteLLM Router:litellm.acompletion(model=gemini/gemini-pro) Exception GenerationConfig.init() got an unexpected keyword argument 'num_ctx'
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/litellm/llms/gemini.py", line 177, in async_streaming
generation_config=genai.types.GenerationConfig(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: GenerationConfig.init() got an unexpected keyword argument 'num_ctx'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/litellm/main.py", line 279, in acompletion
response = await init_response
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/litellm/llms/gemini.py", line 192, in async_streaming
raise GeminiError(status_code=500, message=str(e))

gemini pro api

Screenshots (if applicable):
[Attach any relevant screenshots to help illustrate the issue]

Originally created by @flyfox666 on GitHub (Apr 10, 2024). # Bug Report ## Description **Bug Summary:** The google gemini api gives an error when used in litellm,when use in chat, error show: GenerationConfig.__init__() got an unexpected keyword argument 'num_ctx' **Steps to Reproduce:** add gemini api in webui ,then refresh ,then use the model to chat **Expected Behavior:** no error **Actual Behavior:** error showen ## Environment - **Operating System:** win11 ,ubuntu 22.04, docker for windows - **Browser (if applicable):**chrome latest - ## Reproduction Details **Confirmation:** - [x] I have read and followed all the instructions provided in the README.md. - [x] I am on the latest version of both Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. ## Logs and Screenshots **Docker Container Logs:** [Include relevant Docker container logs, if applicable] 02:16:19 - LiteLLM Router:INFO: litellm.acompletion(model=gemini/gemini-pro) Exception GenerationConfig.__init__() got an unexpected keyword argument 'num_ctx' INFO:LiteLLM Router:litellm.acompletion(model=gemini/gemini-pro) Exception GenerationConfig.__init__() got an unexpected keyword argument 'num_ctx' Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/litellm/llms/gemini.py", line 177, in async_streaming generation_config=genai.types.GenerationConfig( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: GenerationConfig.__init__() got an unexpected keyword argument 'num_ctx' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/litellm/main.py", line 279, in acompletion response = await init_response ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/litellm/llms/gemini.py", line 192, in async_streaming raise GeminiError(status_code=500, message=str(e)) ![gemini pro api](https://github.com/open-webui/open-webui/assets/121539277/b8d16c57-eace-41d1-83df-62b21b0f215e) **Screenshots (if applicable):** [Attach any relevant screenshots to help illustrate the issue]
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#619