feat: fallback to error reporting
This commit is contained in:
parent
a249b7178a
commit
d075e7a234
|
|
@ -21,6 +21,7 @@ def web_search_tool(query: str) -> str:
|
|||
Args:
|
||||
query: The query to search for.
|
||||
"""
|
||||
try:
|
||||
config = get_app_config().get_tool_config("web_search")
|
||||
max_results = 5
|
||||
if config is not None:
|
||||
|
|
@ -41,6 +42,8 @@ def web_search_tool(query: str) -> str:
|
|||
]
|
||||
json_results = json.dumps(normalized_results, indent=2, ensure_ascii=False)
|
||||
return json_results
|
||||
except Exception as e:
|
||||
return f"Error: {str(e)}"
|
||||
|
||||
|
||||
@tool("web_fetch", parse_docstring=True)
|
||||
|
|
@ -54,6 +57,7 @@ def web_fetch_tool(url: str) -> str:
|
|||
Args:
|
||||
url: The URL to fetch the contents of.
|
||||
"""
|
||||
try:
|
||||
client = _get_firecrawl_client()
|
||||
result = client.scrape(url, formats=["markdown"])
|
||||
|
||||
|
|
@ -63,5 +67,7 @@ def web_fetch_tool(url: str) -> str:
|
|||
|
||||
if not markdown_content:
|
||||
return "Error: No content found"
|
||||
except Exception as e:
|
||||
return f"Error: {str(e)}"
|
||||
|
||||
return f"# {title}\n\n{markdown_content}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue