Add Tavily tool.
This commit is contained in:
parent
ffff89d8e7
commit
48f4fbc41d
|
|
@ -1,4 +1,5 @@
|
||||||
from .shell import run_shell_command
|
from .shell import run_shell_command
|
||||||
|
from .web_search_tavily import web_search_tavily
|
||||||
from .research import monorepo_detected, existing_project_detected, ui_detected
|
from .research import monorepo_detected, existing_project_detected, ui_detected
|
||||||
from .human import ask_human
|
from .human import ask_human
|
||||||
from .programmer import run_programming_task
|
from .programmer import run_programming_task
|
||||||
|
|
@ -20,6 +21,7 @@ __all__ = [
|
||||||
'ask_expert',
|
'ask_expert',
|
||||||
'delete_key_facts',
|
'delete_key_facts',
|
||||||
'delete_key_snippets',
|
'delete_key_snippets',
|
||||||
|
'web_search_tavily',
|
||||||
'deregister_related_files',
|
'deregister_related_files',
|
||||||
'emit_expert_context',
|
'emit_expert_context',
|
||||||
'emit_key_facts',
|
'emit_key_facts',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
import os
|
||||||
|
from typing import Dict
|
||||||
|
from tavily import TavilyClient
|
||||||
|
from langchain_core.tools import tool
|
||||||
|
|
||||||
|
@tool
|
||||||
|
def web_search_tavily(query: str) -> Dict:
|
||||||
|
"""
|
||||||
|
Perform a web search using Tavily API.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
query: The search query string
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Dict containing search results from Tavily
|
||||||
|
"""
|
||||||
|
client = TavilyClient(api_key=os.environ["TAVILY_API_KEY"])
|
||||||
|
search_result = client.search(query=query)
|
||||||
|
return search_result
|
||||||
Loading…
Reference in New Issue