mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-21 05:14:45 +08:00
feat: 1. replace black with ruff for fomatting and sort import (#489)
2. use tavily from`langchain-tavily` rather than the older one from `langchain-community` Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from .tavily_search_api_wrapper import EnhancedTavilySearchAPIWrapper
|
||||
from .tavily_search_results_with_images import TavilySearchResultsWithImages
|
||||
from .tavily_search_results_with_images import TavilySearchWithImages
|
||||
|
||||
__all__ = ["EnhancedTavilySearchAPIWrapper", "TavilySearchResultsWithImages"]
|
||||
__all__ = ["EnhancedTavilySearchAPIWrapper", "TavilySearchWithImages"]
|
||||
|
||||
@@ -7,8 +7,8 @@ from typing import Dict, List, Optional
|
||||
|
||||
import aiohttp
|
||||
import requests
|
||||
from langchain_community.utilities.tavily_search import TAVILY_API_URL
|
||||
from langchain_community.utilities.tavily_search import (
|
||||
from langchain_tavily._utilities import TAVILY_API_URL
|
||||
from langchain_tavily.tavily_search import (
|
||||
TavilySearchAPIWrapper as OriginalTavilySearchAPIWrapper,
|
||||
)
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
import logging
|
||||
import json
|
||||
import logging
|
||||
from typing import Dict, List, Optional, Tuple, Union
|
||||
|
||||
from langchain.callbacks.manager import (
|
||||
AsyncCallbackManagerForToolRun,
|
||||
CallbackManagerForToolRun,
|
||||
)
|
||||
from langchain_community.tools.tavily_search.tool import TavilySearchResults
|
||||
from langchain_tavily.tavily_search import TavilySearch
|
||||
from pydantic import Field
|
||||
|
||||
from src.tools.tavily_search.tavily_search_api_wrapper import (
|
||||
@@ -19,7 +19,7 @@ from src.tools.tavily_search.tavily_search_api_wrapper import (
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TavilySearchResultsWithImages(TavilySearchResults): # type: ignore[override, override]
|
||||
class TavilySearchWithImages(TavilySearch): # type: ignore[override, override]
|
||||
"""Tool that queries the Tavily Search API and gets back json.
|
||||
|
||||
Setup:
|
||||
@@ -34,9 +34,9 @@ class TavilySearchResultsWithImages(TavilySearchResults): # type: ignore[overri
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from langchain_community.tools import TavilySearchResults
|
||||
from langchain_tavily.tavily_search import TavilySearch
|
||||
|
||||
tool = TavilySearchResults(
|
||||
tool = TavilySearch(
|
||||
max_results=5,
|
||||
include_answer=True,
|
||||
include_raw_content=True,
|
||||
@@ -102,7 +102,9 @@ class TavilySearchResultsWithImages(TavilySearchResults): # type: ignore[overri
|
||||
Default is False.
|
||||
"""
|
||||
|
||||
api_wrapper: EnhancedTavilySearchAPIWrapper = Field(default_factory=EnhancedTavilySearchAPIWrapper) # type: ignore[arg-type]
|
||||
api_wrapper: EnhancedTavilySearchAPIWrapper = Field(
|
||||
default_factory=EnhancedTavilySearchAPIWrapper
|
||||
) # type: ignore[arg-type]
|
||||
|
||||
def _run(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user