Whenever I ask “What is the time now?” it says “It’s {{ “Current_Time(1)”: }} . Need anything else?”. the Current_Time function is defined and given access to the AI model. I am using Gemini-1.5-flash-latest and also tried it with others but it gives the same issue. I think there is a problem with server.
Here is some code:-
def Current_Time(time: int):
“”“Tells the current time”“”
import time
return time.strftime("%I:%M:%S %p")
and here is the model obj
model = genai.GenerativeModel(
model_name="gemini-1.5-flash-latest",
generation_config=generation_config,
safety_settings=safe,
tools=func,
system_instruction=system_instructions
)
the func consists of the list of functions
Call_functions = [
Open_Apps, Youtube_Player, Send_Whatsapp_Message, Wikipedia_Search, Google_Search, Close_Window,
Volume_Control, Write_Into_File, Command_Execute, Open_url, Shutdown_computer, image_generation,
Internet_Search, Universal_function, Vision_API, Screen_vision_API, Current_Time, Recent_News,
Copy_Data_to_Clipboard, Get_Clipboard_data, pdf_convertor, Read_text_from_file, Encrypt_File,
Decrypt_File, Read_pdf, Delete_file, Delete_folder, Move_file, get_current_day, get_current_date
]
you can find the automatic inbuilt function calling from Учебное пособие по вызову функций | Gemini API | Google AI for Developers