csabakecskemeti commited on
Commit
0ff5cef
·
verified ·
1 Parent(s): 0c0af1b

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -51,6 +51,12 @@ llm_model = os.environ.get('model')
51
 
52
  # Tavily API configuration
53
  tavily_key = os.environ.get('tavily_key', '')
 
 
 
 
 
 
54
 
55
  # Tavily search tool integration
56
 
@@ -106,16 +112,19 @@ class ReactAgentChat:
106
  error_str = str(e).lower()
107
  if ENABLE_DETAILED_LOGGING:
108
  logger.error(f"Tavily search failed for query '{query}': {e}")
 
 
 
109
 
110
  # Check for rate limit or quota issues
111
  if any(keyword in error_str for keyword in ['rate limit', 'quota', 'limit exceeded', 'usage limit', 'billing']):
112
  if ENABLE_DETAILED_LOGGING:
113
  logger.warning(f"Tavily rate limit/quota exceeded: {e}")
114
- return "I can't search the web right now."
115
  else:
116
  if ENABLE_DETAILED_LOGGING:
117
  logger.error(f"Tavily API error: {e}")
118
- return "I can't search the web right now."
119
 
120
  search_tool = web_search
121
  if ENABLE_DETAILED_LOGGING:
 
51
 
52
  # Tavily API configuration
53
  tavily_key = os.environ.get('tavily_key', '')
54
+ if ENABLE_DETAILED_LOGGING:
55
+ logger.info(f"Tavily API key present: {bool(tavily_key)}")
56
+ if tavily_key:
57
+ logger.info(f"Tavily API key length: {len(tavily_key)}")
58
+ else:
59
+ logger.warning("No Tavily API key found in environment variables")
60
 
61
  # Tavily search tool integration
62
 
 
112
  error_str = str(e).lower()
113
  if ENABLE_DETAILED_LOGGING:
114
  logger.error(f"Tavily search failed for query '{query}': {e}")
115
+ logger.error(f"Exception type: {type(e).__name__}")
116
+ import traceback
117
+ logger.error(f"Full traceback: {traceback.format_exc()}")
118
 
119
  # Check for rate limit or quota issues
120
  if any(keyword in error_str for keyword in ['rate limit', 'quota', 'limit exceeded', 'usage limit', 'billing']):
121
  if ENABLE_DETAILED_LOGGING:
122
  logger.warning(f"Tavily rate limit/quota exceeded: {e}")
123
+ return "I can't search the web right now due to rate limits."
124
  else:
125
  if ENABLE_DETAILED_LOGGING:
126
  logger.error(f"Tavily API error: {e}")
127
+ return f"I can't search the web right now. Error: {str(e)[:100]}"
128
 
129
  search_tool = web_search
130
  if ENABLE_DETAILED_LOGGING: