@@ -399,10 +399,15 @@ async def aget_data_sources_and_output_format(
399
399
400
400
agent_chat_model = agent .chat_model if agent else None
401
401
402
+ class PickTools (BaseModel ):
403
+ source : List [str ]
404
+ output : str
405
+
402
406
with timer ("Chat actor: Infer information sources to refer" , logger ):
403
407
response = await send_message_to_model_wrapper (
404
408
relevant_tools_prompt ,
405
409
response_type = "json_object" ,
410
+ response_schema = PickTools ,
406
411
user = user ,
407
412
query_files = query_files ,
408
413
agent_chat_model = agent_chat_model ,
@@ -483,11 +488,15 @@ async def infer_webpage_urls(
483
488
484
489
agent_chat_model = agent .chat_model if agent else None
485
490
491
+ class WebpageUrls (BaseModel ):
492
+ links : List [str ]
493
+
486
494
with timer ("Chat actor: Infer webpage urls to read" , logger ):
487
495
response = await send_message_to_model_wrapper (
488
496
online_queries_prompt ,
489
497
query_images = query_images ,
490
498
response_type = "json_object" ,
499
+ response_schema = WebpageUrls ,
491
500
user = user ,
492
501
query_files = query_files ,
493
502
agent_chat_model = agent_chat_model ,
@@ -563,11 +572,13 @@ class OnlineQueries(BaseModel):
563
572
response = pyjson5 .loads (response )
564
573
response = {q .strip () for q in response ["queries" ] if q .strip ()}
565
574
if not isinstance (response , set ) or not response or len (response ) == 0 :
566
- logger .error (f"Invalid response for constructing subqueries: { response } . Returning original query: { q } " )
575
+ logger .error (
576
+ f"Invalid response for constructing online subqueries: { response } . Returning original query: { q } "
577
+ )
567
578
return {q }
568
579
return response
569
580
except Exception as e :
570
- logger .error (f"Invalid response for constructing subqueries: { response } . Returning original query: { q } " )
581
+ logger .error (f"Invalid response for constructing online subqueries: { response } . Returning original query: { q } " )
571
582
return {q }
572
583
573
584
@@ -2054,7 +2065,7 @@ def schedule_automation(
2054
2065
try :
2055
2066
user_timezone = pytz .timezone (timezone )
2056
2067
except pytz .UnknownTimeZoneError :
2057
- logger .error (f"Invalid timezone: { timezone } . Fallback to use UTC to schedule automation." )
2068
+ logger .warning (f"Invalid timezone: { timezone } . Fallback to use UTC to schedule automation." )
2058
2069
user_timezone = pytz .utc
2059
2070
2060
2071
trigger = CronTrigger .from_crontab (crontime , user_timezone )
0 commit comments