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

Not able to set seed parameter in generation_config #536

Open
zya opened this issue Sep 5, 2024 · 7 comments
Open

Not able to set seed parameter in generation_config #536

zya opened this issue Sep 5, 2024 · 7 comments
Assignees
Labels
component:api Issues related to the API, not the SDK. type:feature request New feature request/enhancement

Comments

@zya
Copy link

zya commented Sep 5, 2024

Description of the bug:

Both of the following results in an error.

model = genai.GenerativeModel(
        model_name="models/gemini-1.5-pro-001",
        system_instruction=(...),
        generation_config={
           ...,
           "seed": 1
        }
    )
model = genai.GenerativeModel(
        model_name="models/gemini-1.5-pro-001",
        system_instruction=(...),
        generation_config={
           ...,
        }
    )
model.generate_content(prompt, generation_config={"seed": 1})

Error:

ValueError: Unknown field for GenerationConfig: seed

Seed is mentioned in the docs here:

Actual vs expected behavior:

Actual: Error is thrown when seed is used in generation_config
Expected: seed to be supported and passed to the underlying generate content API.

Any other information you'd like to share?

No response

@Gunand3043
Copy link

Hi @zya,

You can set the seed parameter in generation_config only when using the Vertex AI SDK. For reference, you can check this link. If you are using Python SDK, here is the documentation link.

@Gunand3043 Gunand3043 added type:bug Something isn't working status:awaiting user response Awaiting a response from the author component:python sdk Issue/PR related to Python SDK labels Sep 6, 2024
@zya
Copy link
Author

zya commented Sep 6, 2024

@Gunand3043 Thanks. Do you happen to know why seed isn't supported? And more generally, what is the purpose of having these two API's separate? Are we supposed to use Gemini API for experimentation and Vertex for production?

@Gunand3043
Copy link

At the moment, I'm not exactly sure why 'seed' isn't supported in the Google AI SDK.

I kind of agree with your idea of using the Google AI SDK for experimentation and the Vertex AI SDK for production. Since Vertex AI SDK offers more features than the Google AI SDK, such as deploying generative AI applications and building solutions end-to-end, Vertex AI is the better option. For a more detailed comparison, please check out the below link.

Hope it helps.

@Gunand3043 Gunand3043 self-assigned this Sep 11, 2024
@Gunand3043 Gunand3043 added status:awaiting user response Awaiting a response from the author and removed status:awaiting user response Awaiting a response from the author labels Sep 11, 2024
@zya
Copy link
Author

zya commented Sep 11, 2024

In that case perhaps we want to change the type of this ticket to be a feature request to add support for seed in the Gemini API?

@Gunand3043 Gunand3043 added type:feature request New feature request/enhancement and removed type:bug Something isn't working status:awaiting user response Awaiting a response from the author labels Sep 12, 2024
@t1u1
Copy link

t1u1 commented Sep 20, 2024

What does "seed" not supported in Gemini API mean? That it is constant or random?

In other words, I would like to know if the responses for the same input and configuration are going to be the same, or they will be different for each invocation?

@MarkDaoust
Copy link
Collaborator

Right now it's different each time. They're working on it.

@sr228822
Copy link

sr228822 commented Jan 9, 2025

any update on this? Unclear from above discussion whether theres plan to support seed in genai.GenerativeModel interface or whether I should switch to VertexAI?

@MarkDaoust MarkDaoust added component:api Issues related to the API, not the SDK. and removed component:python sdk Issue/PR related to Python SDK labels Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:api Issues related to the API, not the SDK. type:feature request New feature request/enhancement
Projects
None yet
Development

No branches or pull requests

6 participants
@sr228822 @MarkDaoust @zya @t1u1 @Gunand3043 and others