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

Automatic Python function Support not available in LiveConnect #59

Open
arcinston opened this issue Dec 29, 2024 · 1 comment
Open

Automatic Python function Support not available in LiveConnect #59

arcinston opened this issue Dec 29, 2024 · 1 comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@arcinston
Copy link

arcinston commented Dec 29, 2024

Automatic py function works fine in

def get_weather(location: str) -> int:
    """Returns the current weather in the given location in Celsius, or -1 if an error occurs."""
    return 25

 response = client.models.generate_content(
            model="gemini-2.0-flash-exp",
            contents=prompt,
            config=types.GenerateContentConfig(tools=[get_weather]),
        )

But when trying to use the same in LiveConnect

def get_weather(location: str) -> int:
    """Returns the current weather in the given location in Celsius, or -1 if an error occurs."""
    return 25`

 async with client.aio.live.connect(
        model="gemini-2.0-flash-exp",
        config=types.LiveConnectConfig(
            response_modalities=["TEXT"], tools=[get_weather] # throws a type error here !!
        ),
    ) as session:

will throw a pydantic type error

would be really awesome if the liveconnect would also support automatic python functions

@arcinston arcinston added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Dec 29, 2024
@Giom-V
Copy link

Giom-V commented Jan 8, 2025

Hello @arcinston,

Function calling works with the Live APIs. Here's an example on how to make it work from our Cookbook.

@sasha-gitg sasha-gitg added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants