From 7448a3536561cbed316e56f3daef3b199d56b204 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 01:53:57 +0000 Subject: [PATCH 01/17] Add working GenAI feature --- Project1-PairProgramming.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Project1-PairProgramming.py diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py new file mode 100644 index 0000000..2dac006 --- /dev/null +++ b/Project1-PairProgramming.py @@ -0,0 +1,31 @@ +''' Codio Day5 module: Google GenAi API. Used that lesson to write the following code''' +import os +from google import genai +from google.genai import types + +# Set environment variables +my_api_key = os.getenv('GENAI_KEY') +genai.api_key = my_api_key + +# Create an genAI client using the key from our environment variable +client = genai.Client( + api_key=my_api_key, +) + +# User Inputs +city_input = input("Enter the city that youre looking suggestions for: ") +category_input = input("What are you looking for — a hotel, restaurant, or attraction? ") + +# AI Prompt +prompt = f'recommend a toprated {category_input} in {city_input} and explain why its the better choice.' + +# Specify the model to use and the messages to send +response = client.models.generate_content( + model="gemini-2.5-flash", + config=types.GenerateContentConfig( + system_instruction="You are a friendly travel assistant who gives helpful suggestions." + ), + contents=prompt, +) + +print(response.text) \ No newline at end of file From 8e7dd1d6f60459c0b2eaba175a557c42e943a8ba Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:09:11 +0000 Subject: [PATCH 02/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index 2dac006..7f85b93 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -28,4 +28,4 @@ contents=prompt, ) -print(response.text) \ No newline at end of file +print(response.text) From fdc3102f54f9d1a6124a02edb7d1d185e95b1b6c Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:12:04 +0000 Subject: [PATCH 03/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index 7f85b93..46ea8d6 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -1,5 +1,7 @@ -''' Codio Day5 module: Google GenAi API. Used that lesson to write the following code''' -import os +'''Codio Day5 module: Google GenAI API.''' +'''This code was written using that lesson.''' + +import os from google import genai from google.genai import types From 12dd973d4c28fa2f8df47b2376cf3e314e16c691 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:13:21 +0000 Subject: [PATCH 04/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index 46ea8d6..c54dbd9 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -1,5 +1,4 @@ '''Codio Day5 module: Google GenAI API.''' -'''This code was written using that lesson.''' import os from google import genai From 9a6922196fb999c97b01e49b309d5dfe03ef318e Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:15:30 +0000 Subject: [PATCH 05/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index c54dbd9..85ae103 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -18,7 +18,10 @@ category_input = input("What are you looking for — a hotel, restaurant, or attraction? ") # AI Prompt -prompt = f'recommend a toprated {category_input} in {city_input} and explain why its the better choice.' +prompt = ( + f"recommend a toprated {category_input} in {city_input} " + "and explain why it's the better choice." +) # Specify the model to use and the messages to send response = client.models.generate_content( From 58aafffc541c26be248f5a9d168b3334d6bb4248 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:27:49 +0000 Subject: [PATCH 06/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index 85ae103..507d96e 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -20,7 +20,7 @@ # AI Prompt prompt = ( f"recommend a toprated {category_input} in {city_input} " - "and explain why it's the better choice." + f"and explain why it's the better choice." ) # Specify the model to use and the messages to send From d2f89babaeabcbe24555a36f255a19be0a98cc53 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:30:38 +0000 Subject: [PATCH 07/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index 507d96e..bf5d5ab 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -19,8 +19,9 @@ # AI Prompt prompt = ( - f"recommend a toprated {category_input} in {city_input} " - f"and explain why it's the better choice." + f"recommend the top {category_input} in" + "{city_input}" + "and explain why it's better" ) # Specify the model to use and the messages to send From 74b3b216134131f3307e596daf0704bfb4df9e0d Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:32:02 +0000 Subject: [PATCH 08/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index bf5d5ab..d5962ec 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -19,9 +19,8 @@ # AI Prompt prompt = ( - f"recommend the top {category_input} in" - "{city_input}" - "and explain why it's better" + f"recommend the top {category_input} in {city_input} " + f"and explain why it's better." ) # Specify the model to use and the messages to send From 7c663b867f904f96d8809cfa66846c7f1148daa9 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:33:56 +0000 Subject: [PATCH 09/17] Fix: Break prompt across 3 f-strings for E501 compliance --- Project1-PairProgramming.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index d5962ec..0932e29 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -19,7 +19,8 @@ # AI Prompt prompt = ( - f"recommend the top {category_input} in {city_input} " + f"recommend the top {category_input} " + f"in {city_input} " f"and explain why it's better." ) From 8417f28aa1a3bd7075833c09d5374e3f8e03b594 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:35:35 +0000 Subject: [PATCH 10/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index 0932e29..6e2c51e 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -14,13 +14,13 @@ ) # User Inputs -city_input = input("Enter the city that youre looking suggestions for: ") -category_input = input("What are you looking for — a hotel, restaurant, or attraction? ") +city = input("Enter the city that youre looking suggestions for: ") +category = input("What are you looking for — a hotel, restaurant, or attraction? ") # AI Prompt prompt = ( - f"recommend the top {category_input} " - f"in {city_input} " + f"recommend the top {category} " + f"in {city} " f"and explain why it's better." ) From 0e745d814cba0836a56cef692562f8c0eb2bf212 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:37:43 +0000 Subject: [PATCH 11/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index 6e2c51e..e2306c0 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -19,9 +19,8 @@ # AI Prompt prompt = ( - f"recommend the top {category} " - f"in {city} " - f"and explain why it's better." + f"recommend the top {category} in {city} " + "and explain why it's better." ) # Specify the model to use and the messages to send From 85ef55ddb4d00c7f4397043e5358487f42e4947d Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:48:24 +0000 Subject: [PATCH 12/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index e2306c0..35a42d4 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -32,4 +32,4 @@ contents=prompt, ) -print(response.text) +print(response.text) \ No newline at end of file From 58212dbec64ffd46440cfe796e89bb352624aa39 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:50:35 +0000 Subject: [PATCH 13/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index 35a42d4..5a215d0 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -19,8 +19,8 @@ # AI Prompt prompt = ( - f"recommend the top {category} in {city} " - "and explain why it's better." + f"recommend the top {category} " + f"in {city} and explain why it's better." ) # Specify the model to use and the messages to send @@ -32,4 +32,4 @@ contents=prompt, ) -print(response.text) \ No newline at end of file +print(response.text) From 475e481844cbb384d98f9f9a00141cc542644a61 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:52:13 +0000 Subject: [PATCH 14/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index 5a215d0..9df1ee1 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -14,13 +14,13 @@ ) # User Inputs -city = input("Enter the city that youre looking suggestions for: ") -category = input("What are you looking for — a hotel, restaurant, or attraction? ") +cy = input("Enter the city that youre looking suggestions for: ") +cate = input("What are you looking for — a hotel, restaurant, or attraction? ") # AI Prompt prompt = ( - f"recommend the top {category} " - f"in {city} and explain why it's better." + f"recommend the top {cate} " + f"in {cy} and explain why it's better." ) # Specify the model to use and the messages to send From 0514a00af4c8c825b69a0a9e1138bd73f519ce50 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 02:55:41 +0000 Subject: [PATCH 15/17] Fix: Style issues for GenAI --- Project1-PairProgramming.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Project1-PairProgramming.py b/Project1-PairProgramming.py index 9df1ee1..10d4d97 100644 --- a/Project1-PairProgramming.py +++ b/Project1-PairProgramming.py @@ -27,7 +27,9 @@ response = client.models.generate_content( model="gemini-2.5-flash", config=types.GenerateContentConfig( - system_instruction="You are a friendly travel assistant who gives helpful suggestions." + system_instruction=( + "You are a nice travel assistant who gives helpful suggestions." + ) ), contents=prompt, ) From c59cdb3dd911b628f7eaf30e2cde8dd55d4185a8 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 06:02:56 +0000 Subject: [PATCH 16/17] Add: TripAdvisor API test script --- tripadvisor_test.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tripadvisor_test.py diff --git a/tripadvisor_test.py b/tripadvisor_test.py new file mode 100644 index 0000000..36c0149 --- /dev/null +++ b/tripadvisor_test.py @@ -0,0 +1,23 @@ +import os +import requests + + +TRIPADVISOR_API_KEY = os.getenv('TRIPADVISOR_API_KEY') +#print("API KEY:", TRIPADVISOR_API_KEY) + +#TRIPADVISOR_API_KEY = '6587D61217FA4ED8A4113B9511202EE7' + +url = "https://api.content.tripadvisor.com/api/v1/location/search?language=en" + +cy = input("Enter the city that youre looking suggestions for: ") +cate = input("What are you looking for — a hotel, restaurant, or attraction? ") + +data = { + 'key': TRIPADVISOR_API_KEY, + 'searchQuery': cy, + 'category': cate +} + +response = requests.get(url, params=data) +print(response.status_code) +print(response.json()) \ No newline at end of file From 3bef2deba253c9267479084f2512bf4a5e3c5025 Mon Sep 17 00:00:00 2001 From: Eshaal Syeda Date: Tue, 1 Jul 2025 06:04:49 +0000 Subject: [PATCH 17/17] Add: TripAdvisor API test script --- tripadvisor_test.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tripadvisor_test.py b/tripadvisor_test.py index 36c0149..44948c4 100644 --- a/tripadvisor_test.py +++ b/tripadvisor_test.py @@ -3,9 +3,8 @@ TRIPADVISOR_API_KEY = os.getenv('TRIPADVISOR_API_KEY') -#print("API KEY:", TRIPADVISOR_API_KEY) - -#TRIPADVISOR_API_KEY = '6587D61217FA4ED8A4113B9511202EE7' +'''print("API KEY:", TRIPADVISOR_API_KEY)''' +'''TRIPADVISOR_API_KEY = '6587D61217FA4ED8A4113B9511202EE7''' url = "https://api.content.tripadvisor.com/api/v1/location/search?language=en" @@ -20,4 +19,4 @@ response = requests.get(url, params=data) print(response.status_code) -print(response.json()) \ No newline at end of file +print(response.json())