Skip to content

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

Closed
@emersoftware

Description

@emersoftware

Description of the feature request:

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.

I believe this is an inconsistency

What problem are you trying to solve with this feature?

I would like to set a seed value in the GenerationConfig when using the Gemini API to ensure reproducibility of the generated output. Since the seed attribute already exists in the GenerationConfig class, adding support for it in protos.GenerationConfig would provide a more consistent experience

Any other information you'd like to share?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions