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

[Bug]: Gemini model parameters not set by using GoogleAIStudioGeminiConfig #7804

Open
mrm1001 opened this issue Jan 16, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@mrm1001
Copy link

mrm1001 commented Jan 16, 2025

What happened?

In your docs, you show how to set the parameters of OpenAI in this way:

litellm.OpenAIConfig(max_tokens=10)

response_2 = litellm.completion(
            model="gpt-3.5-turbo",
            messages=[{ "content": "Hello, how are you?","role": "user"}],
        )

I'm trying to take this approach with Gemini:

import litellm

litellm.GoogleAIStudioGeminiConfig(temperature=0, top_k=3)

def my_custom_logging_fn(model_call_dict):
    print(f"model call details: {model_call_dict}\n\n")

response = litellm.completion(
    model="gemini/gemini-2.0-flash-exp", 
    messages=[{"role": "user", "content": "hi there"}],    
    logger_fn=my_custom_logging_fn
)

response

The logs that get printed do not have the parameters in them (abbreviated). The generationConfig dictionary is empty.

Final returned optional params: {}
[...]

model call details: {'litellm_trace_id': None, 'litellm_call_id': 'd74ca109-1042-480b-b62a-e0ea776c4a2d', 'input': [{'role': 'user', 'content': 'hi there'}], 'model': 'gemini-2.0-flash-exp', 'messages': [{'role': 'user', 'content': 'hi there'}], 'additional_args': {'complete_input_dict': {'contents': [{'role': 'user', 'parts': [{'text': 'hi there'}]}], 'generationConfig': {}}, 'api_base':

If I try passing the parameters directly, as such:

response = litellm.completion(
    model="gemini/gemini-2.0-flash-exp", 
    messages=[{"role": "user", "content": "hi there"}],    
    top_k=3,
    temperature=0,
    logger_fn=my_custom_logging_fn
)

Then the parameters do get passed to the endpoint (abbreviated logs):

Final returned optional params: {'temperature': 0, 'top_k': 3}
[...]

model call details: {'litellm_trace_id': None, 'litellm_call_id': 'd74ca109-1042-480b-b62a-e0ea776c4a2d', 'input': [{'role': 'user', 'content': 'hi there'}], 'model': 'gemini-2.0-flash-exp', 'messages': [{'role': 'user', 'content': 'hi there'}], 'additional_args': {'complete_input_dict': {'contents': [{'role': 'user', 'parts': [{'text': 'hi there'}]}], 'generationConfig': {'temperature': 0, 'top_k': 3}}, 'api_base':

Relevant log output

Are you a ML Ops Team?

No

What LiteLLM version are you on ?

v1.58.2

Twitter / LinkedIn details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant