Skip to content

TypeError when running the example #497

@fabiorangel

Description

@fabiorangel

Description of the bug:

I am running exactly this example which is also defined as a test:

import typing_extensions as typing

class Recipe(typing.TypedDict):
    recipe_name: str

model = genai.GenerativeModel("gemini-1.5-pro-latest")
result = model.generate_content(
    "List a few popular cookie recipes.",
    generation_config=genai.GenerationConfig(
        response_mime_type="application/json", response_schema=list([Recipe])
    ),
)

The code is presented here for method models.generateContent: https://ai.google.dev/api/generate-content?hl=pt-br#method:-models.generatecontent

This is also a test defined here: https://github.com/google-gemini/generative-ai-python/blob/42d952a2429fa72c0f2617d71eb9aa3f708b6867/samples/controlled_generation.py#L18

It is raising TypeError:
TypeError: pop expected at most 1 argument, got 2

Actual vs expected behavior:

I expected the example to work with no errors and maybe this test is not being used.

Any other information you'd like to share?

Python version: Python 3.10.12
Working on Databricks using the runtime: 14.3 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions