GenerationConfig Error: 'seed' Field Missing in Protocol Message but Present in GenerationConfig Class

Hello everyone, I’m trying to set the seed for Gemini using the ‘google-generativeai’ library:

model = genai.GenerativeModel(
    model_name,
    system_instruction=system_instruction,
    generation_config=GenerationConfig(
        temperature=0.0,
        seed=42
    )
)

However, I’m getting the following error:

"ValueError: Protocol message GenerationConfig has no \"seed\" field."

I understand that this happens because the GenerationConfig(proto.Message) class from google.generativeai.types doesn’t have a seed attribute. However, this attribute does exist in the GenerationConfig class, which is accepted as a type in GenerationConfigType = Union[protos.GenerationConfig, GenerationConfigDict, GenerationConfig] from google.generativeai.types.

Does anyone know if there’s a way to solve this? Should I open an issue on GitHub?

Thanks in advance

Best regards

Hi @emerworth , currently Gemini API doesn’t support seed parameter. But, VertexAI SDK supports seed parameter. Please refer to the colab gist file for VertexAI SDK.

1 Like