A curated collection of practical AI projects implementing OCR systems, RAG, AI agents, and other AI use cases.
fix(ai_travel_planning_agent): remove unresolved merge conflict markers
Rudy Celekli581065a70cf3
diff --git a/ai_agents/ai_travel_planning_agent/.env.example b/ai_agents/ai_travel_planning_agent/.env.exampleindex f437276..8e67145 100644--- a/ai_agents/ai_travel_planning_agent/.env.example+++ b/ai_agents/ai_travel_planning_agent/.env.example@@ -1,11 +1,7 @@-<<<<<<< HEAD-GOOGLE_API_KEY=your_google_api_key_here-=======# Google AI Studio API key used to authenticate Gemini requests for all agents.# Get one at https://aistudio.google.com/app/apikeyGOOGLE_API_KEY=your_google_api_key_here# Tavily API key used for real-time web search by the flight, hotel, and itinerary agents.# Get one at https://app.tavily.com->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4aTAVILY_API_KEY=your_tavily_api_key_herediff --git a/ai_agents/ai_travel_planning_agent/agents.py b/ai_agents/ai_travel_planning_agent/agents.pyindex ca857d3..a1d6ca3 100644--- a/ai_agents/ai_travel_planning_agent/agents.py+++ b/ai_agents/ai_travel_planning_agent/agents.py@@ -2,11 +2,7 @@ from google.adk.agents import LlmAgentfrom google.adk.tools.agent_tool import AgentToolfrom tools import tavily_search, find_nearby_places-<<<<<<< HEAD-MODEL = "gemini-3-flash-preview"-=======MODEL = "gemini-3.5-flash"->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4a# ---------------------------------------------------------------------------# Specialist sub-agentsdiff --git a/ai_agents/ai_travel_planning_agent/app.py b/ai_agents/ai_travel_planning_agent/app.pyindex 85b6fbc..f858565 100644--- a/ai_agents/ai_travel_planning_agent/app.py+++ b/ai_agents/ai_travel_planning_agent/app.py@@ -1,20 +1,13 @@-<<<<<<< HEAD-import os-import asyncio-======="""Streamlit chat app that coordinates flight, hotel, and itinerary agents into one travel plan."""import osimport asyncioimport logging->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4aimport uuid# Load .env before any ADK/Google imports so API keys are availablefrom dotenv import load_dotenvload_dotenv()-<<<<<<< HEAD-=======# ADK logs the full traceback for every transient model error (even ones it# or our own retry logic recovers from). We surface failures via the UI# instead, so quiet this logger to keep the terminal readable.@@ -24,7 +17,6 @@ _TRANSIENT_ERROR_MARKERS = ("503", "UNAVAILABLE", "high demand")_QUOTA_ERROR_MARKERS = ("429", "RESOURCE_EXHAUSTED")_QUOTA_RETRY_DELAY_SECONDS = 8->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4aimport nest_asyncionest_asyncio.apply() # Allow asyncio.run() inside Streamlit's existing event loop@@ -32,10 +24,7 @@ import streamlit as stfrom google.adk.runners import Runnerfrom google.adk.sessions import InMemorySessionServicefrom google.genai import types-<<<<<<< HEAD-=======from google.genai.errors import ServerError->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4afrom agents import root_agent@@ -119,25 +108,6 @@ if "adk_runner" not in st.session_state:# Agent runner helper# ----------------------------------------------------------------------------<<<<<<< HEAD-async def _stream_response(runner: Runner, session_id: str, user_id: str, content: types.Content) -> str:- """Collect the final response text from a single runner.run_async() call."""- final_text = ""- async for event in runner.run_async(- session_id=session_id,- user_id=user_id,- new_message=content,- ):- if event.is_final_response():- if event.content and event.content.parts:- final_text = "\n".join(- part.text for part in event.content.parts if hasattr(part, "text")- )- break- return final_text---=======def _is_transient_error(message: str) -> bool:"""Check whether an error message looks like a temporary model-overload error."""return any(marker in message for marker in _TRANSIENT_ERROR_MARKERS)@@ -208,7 +178,6 @@ async def _stream_response_with_retry(raise->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4aasync def _run_agent_async(runner: Runner, session_id: str, user_id: str, message: str) -> str:"""Run the ADK agent and collect the final response text."""content = types.Content(@@ -234,11 +203,7 @@ async def _run_agent_async(runner: Runner, session_id: str, user_id: str, messag)try:-<<<<<<< HEAD- final_text = await _stream_response(runner, session_id, user_id, content)-=======final_text = await _stream_response_with_retry(runner, session_id, user_id, content)->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4aexcept Exception as e:if "Session not found" in str(e):new_session_id = str(uuid.uuid4())@@ -248,15 +213,11 @@ async def _run_agent_async(runner: Runner, session_id: str, user_id: str, messagsession_id=new_session_id,)st.session_state.session_id = new_session_id-<<<<<<< HEAD- final_text = await _stream_response(runner, new_session_id, user_id, content)-=======final_text = await _stream_response_with_retry(runner, new_session_id, user_id, content)elif isinstance(e, (ServerError, RuntimeError)) and _is_quota_error(str(e)):return "The AI model's quota is temporarily exhausted. Please wait a bit before trying again."elif isinstance(e, (ServerError, RuntimeError)) and _is_transient_error(str(e)):return "The AI model is temporarily overloaded. Please try again in a moment."->>>>>>> 1d1e9f137cfd1123edbae5d8e955ce0b9c7fcf4aelse:raise