Skip to content

Instantly share code, notes, and snippets.

@janakiramm
Last active May 23, 2024 07:20
Show Gist options
  • Save janakiramm/ee38f0d8caaf87745401c75858bb5eab to your computer and use it in GitHub Desktop.
Save janakiramm/ee38f0d8caaf87745401c75858bb5eab to your computer and use it in GitHub Desktop.
Function calling with Gemini 1.0 Pro
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