refine the research prompt (#460)

This commit is contained in:
DanielWalnut
2025-07-22 14:49:04 +08:00
committed by GitHub
parent c7edaf3e84
commit 6d8853b7c7
2 changed files with 12 additions and 67 deletions

View File

@@ -1,6 +1,7 @@
# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
# SPDX-License-Identifier: MIT
import logging
import json
from typing import Dict, List, Optional, Tuple, Union
@@ -15,6 +16,8 @@ from src.tools.tavily_search.tavily_search_api_wrapper import (
EnhancedTavilySearchAPIWrapper,
)
logger = logging.getLogger(__name__)
class TavilySearchResultsWithImages(TavilySearchResults): # type: ignore[override, override]
"""Tool that queries the Tavily Search API and gets back json.
@@ -123,7 +126,9 @@ class TavilySearchResultsWithImages(TavilySearchResults): # type: ignore[overri
except Exception as e:
return repr(e), {}
cleaned_results = self.api_wrapper.clean_results_with_images(raw_results)
print("sync", json.dumps(cleaned_results, indent=2, ensure_ascii=False))
logger.debug(
"sync: %s", json.dumps(cleaned_results, indent=2, ensure_ascii=False)
)
return cleaned_results, raw_results
async def _arun(
@@ -147,5 +152,7 @@ class TavilySearchResultsWithImages(TavilySearchResults): # type: ignore[overri
except Exception as e:
return repr(e), {}
cleaned_results = self.api_wrapper.clean_results_with_images(raw_results)
print("async", json.dumps(cleaned_results, indent=2, ensure_ascii=False))
logger.debug(
"async: %s", json.dumps(cleaned_results, indent=2, ensure_ascii=False)
)
return cleaned_results, raw_results