Last active
May 23, 2024 07:20
-
-
Save janakiramm/ee38f0d8caaf87745401c75858bb5eab to your computer and use it in GitHub Desktop.
Function calling with Gemini 1.0 Pro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import google.generativeai as genai | |
##The Function get_flight_status is available at https://gist.github.com/janakiramm/2143b909626f5f01d64739e3fe90c9c8 | |
def get_departure_gate(flight:str): | |
"""Returns Departure Information""" | |
return "B11" | |
model = genai.GenerativeModel( | |
model_name='gemini-1.0-pro', | |
generation_config={'temperature':0.0}, | |
tools=[get_flight_status,get_departure_gate] | |
) | |
chat = model.start_chat(enable_automatic_function_calling=True,history=[]) | |
response = chat.send_message('What is the status of EK524?') | |
print(response.text) | |
print(chat.history) | |
response = chat.send_message('What is the depature gate?') | |
print(response.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment