mirror of
https://github.com/ZhuLinsen/daily_stock_analysis
synced 2026-09-20 10:53:33 +08:00
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:
committed by
GitHub
parent
77cc9ec30f
commit
d55e4c310d
@@ -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,
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user