Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Travel.AI is a Python-based tool that integrates the TripAdvisor API with Google Gemini API to
recommend the best hotels, restaurants, or attractions based on user input and location.


## General Info

This project was developed as part of the SEO Tech Developer program. It demonstrates how to:
Expand All @@ -12,7 +11,9 @@ This project was developed as part of the SEO Tech Developer program. It demonst
- Store and manage results in a local database
- Integrate AI reasoning via Google Gemini

## Technologies Used
## Technologies

This project uses:

- Python 3.11+
- Pandas
Expand All @@ -28,4 +29,4 @@ This project was developed as part of the SEO Tech Developer program. It demonst
## Contact

- **William Du** – [wiiidu315@gmail.com](mailto:wiiidu315@gmail.com)
- **Eshaal Syeda** – [eshaal.syeda@richmond.edu](mailto:eshaal.syeda@richmond.edu)
- **Eshaal Syeda** – [eshaal.syeda@richmond.edu](mailto:eshaal.syeda@richmond.edu)
57 changes: 35 additions & 22 deletions combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,48 @@

response = requests.get(url, params=data)
data_of_trip = response.json()
results = data_of_trip.get('data', [])

top_five = []
#results = data_of_trip.get('data', [])

'''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}: {combined}."
"based on these, recommend the better one and why"
"two to three sentences"
)

# Specify the model to use and the messages to send
ai_response = client.models.generate_content(
model="gemini-2.5-flash",
config=types.GenerateContentConfig(
system_instruction=(
"You are a helpful travel assistant."
)
),
contents=prompt,
)
combined = ','.join(top_five)'''

print(ai_response.text)

parser = Parser(data_of_trip)
parser.write_to_database('locations')
parser.write_to_database(cate)

# Pull stored results
db_results = parser.pull_list(cate, cy)
for row in db_results:
name = row._mapping.get('name')

prompt = (
f"{name} is a {cate} "
f"in {cy}."
"respond in two to three sentences why its good"
)

# Specify the model to use and the messages to send
ai_response = client.models.generate_content(
model="gemini-2.5-flash",
config=types.GenerateContentConfig(
system_instruction=(
"You are a helpful travel assistant."
)
),
contents=prompt,
)

print(ai_response.text)

another_sugg = input("Do you want another suggestion? (Yes/No): ").lower().strip()
if another_sugg != "yes":
print("Enjoy!")
break
5 changes: 3 additions & 2 deletions json_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class Parser:

def __init__(self, json):
load_dotenv()
if 'data' in json:
Expand Down Expand Up @@ -37,7 +37,8 @@ def pull_list(self, table_name, city):
f"WHERE \"address_obj.city\" = '{city}' LIMIT 10;")
with self.engine.connect() as connection:
result = connection.execute(db.text(query)).fetchall()
print(pd.DataFrame(result))
return result


def drop(self, table_name):
command = f"DROP TABLE IF EXISTS {table_name}"
Expand Down
Loading