Fix/tavily credit usage (#2314)

* Reduce Tavily search credit usage

Use basic Tavily search by default to reduce excessive credit consumption.

* Limit intelligence searches per stock

* Update test_search_tavily_provider.py

* Update pipeline.py
This commit is contained in:
zhanghao56666-svg
2026-08-30 20:45:00 +09:00
committed by GitHub
parent 77cc9ec30f
commit d55e4c310d
2 changed files with 2 additions and 2 deletions

View File

@@ -450,7 +450,7 @@ class TavilySearchProvider(BaseSearchProvider):
# 执行搜索优化使用advanced深度、限制最近几天
search_kwargs: Dict[str, Any] = {
"query": query,
"search_depth": "advanced", # advanced 获取更多结果
"search_depth": "basic", # 为控制credit使用将advanced修改成basic
"max_results": max_results,
"include_answer": False,
"include_raw_content": False,

View File

@@ -76,7 +76,7 @@ class TestTavilySearchProvider(unittest.TestCase):
self.assertEqual(_FakeTavilyClient.search_calls[0]["topic"], "news")
self.assertEqual(_FakeTavilyClient.search_calls[0]["days"], 3)
self.assertEqual(_FakeTavilyClient.search_calls[0]["max_results"], 5)
self.assertEqual(_FakeTavilyClient.search_calls[0]["search_depth"], "advanced")
self.assertEqual(_FakeTavilyClient.search_calls[0]["search_depth"], "basic")
self.assertEqual(len(resp.results), 1)
self.assertEqual(resp.results[0].published_date, published_text)
self.assertEqual(resp.results[0].url, "https://example.com/alibaba-earnings")