From 23dd39a16066df170279d43db349fd1c68379552 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Wed, 2 Jul 2025 00:14:50 +0000 Subject: [PATCH 1/2] Combined the two API's --- combined.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/combined.py b/combined.py index eea161f..b3004ba 100644 --- a/combined.py +++ b/combined.py @@ -24,23 +24,33 @@ } response = requests.get(url, params=data) +data_of_trip = response.json() +results = data_of_trip.get('data', []) -print(response.json()) +top_five = [] +for given in results[:5]: + name = given.get('name') + if name: + top_five.append(name) + +combined = ','.join(top_five) prompt = ( f"recommend the top {cate} " - f"in {cy} and explain why it's better." + f"in {cy}: (combined)." + "based on these, recommend the better one and why" + "two to three sentences" ) # Specify the model to use and the messages to send -response = client.models.generate_content( +ai_response = client.models.generate_content( model="gemini-2.5-flash", config=types.GenerateContentConfig( system_instruction=( - "You are a nice travel assistant who gives helpful suggestions." + "You are a helpful travel assistant." ) ), contents=prompt, ) -print(response.text) +print(ai_response.text) From 44997bf29bbf936e547c23e324d5ff7fd0b06b84 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Wed, 2 Jul 2025 00:21:35 +0000 Subject: [PATCH 2/2] Combined the two API's --- combined.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/combined.py b/combined.py index b3004ba..e8de024 100644 --- a/combined.py +++ b/combined.py @@ -37,7 +37,7 @@ prompt = ( f"recommend the top {cate} " - f"in {cy}: (combined)." + f"in {cy}: (combined)." "based on these, recommend the better one and why" "two to three sentences" )