-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenaiintoit.py
More file actions
32 lines (27 loc) · 1.29 KB
/
Copy pathgenaiintoit.py
File metadata and controls
32 lines (27 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import google.genai as genai
from google.genai import types
import asyncio
from fetch_watch import bridge_function, live_search_all_sites
client = genai.Client(api_key="AIzaSyDj_dZjRY2r8tIsxErj9zjaRZfIo8RZcpQ")
def search_on_store(url: str):
return bridge_function(url)
def find_cheapest_watch(watch_name: str):
"""Searches all stores live to find the best price for a specific watch name."""
results = asyncio.run(live_search_all_sites(watch_name))
return results
chat = client.chats.create(
model="gemini-2.5-flash",
config=types.GenerateContentConfig(
tools=[search_on_store, find_cheapest_watch],
system_instruction="""asssume that you are a watch dealer
0.1) use search_on_store if user gives url to search about the watch
0.2) use find_cheapest_watch to compare price of the watch among all websites taking name as the user input
1. provide the short summary of the watch and its features and specifications
2. provide an opinion on the price of the watch
3. mention some similar watches on the same budget of the provided watch
4. maintain a friendly tone"""
)
)
url_or_name = input("enter the link or the name of the watch : ")
response = chat.send_message(url_or_name)
print("\nyour watch : ", response.text)