Update tools.py
Browse files
tools.py
CHANGED
|
@@ -4,7 +4,7 @@ import sys
|
|
| 4 |
import json
|
| 5 |
import base64
|
| 6 |
import subprocess
|
| 7 |
-
from
|
| 8 |
from functools import lru_cache
|
| 9 |
# Force UTF-8 output on Windows to avoid charmap crashes with Unicode characters
|
| 10 |
if sys.platform == "win32":
|
|
@@ -23,8 +23,6 @@ from langchain_core.tools import tool
|
|
| 23 |
from langchain_openai import ChatOpenAI
|
| 24 |
from youtube_transcript_api import YouTubeTranscriptApi
|
| 25 |
|
| 26 |
-
from app import get_prompt
|
| 27 |
-
|
| 28 |
@tool
|
| 29 |
def wikipedia_search(query: str, max_pages: int = 2) -> str:
|
| 30 |
"""Search Wikipedia for a short query and return a truncated summary.
|
|
@@ -50,7 +48,7 @@ def ddg_search(query: str, k: int = 6) -> list[dict[str, str]]:
|
|
| 50 |
]
|
| 51 |
|
| 52 |
@tool
|
| 53 |
-
def web_search(query: str) -> str:
|
| 54 |
"""Search the web using DuckDuckGo and Tavily
|
| 55 |
"""
|
| 56 |
try:
|
|
|
|
| 4 |
import json
|
| 5 |
import base64
|
| 6 |
import subprocess
|
| 7 |
+
from config import GROQ_API_KEY, OPENROUTER_API_KEY
|
| 8 |
from functools import lru_cache
|
| 9 |
# Force UTF-8 output on Windows to avoid charmap crashes with Unicode characters
|
| 10 |
if sys.platform == "win32":
|
|
|
|
| 23 |
from langchain_openai import ChatOpenAI
|
| 24 |
from youtube_transcript_api import YouTubeTranscriptApi
|
| 25 |
|
|
|
|
|
|
|
| 26 |
@tool
|
| 27 |
def wikipedia_search(query: str, max_pages: int = 2) -> str:
|
| 28 |
"""Search Wikipedia for a short query and return a truncated summary.
|
|
|
|
| 48 |
]
|
| 49 |
|
| 50 |
@tool
|
| 51 |
+
def web_search(query: str, k: int = 6) -> str:
|
| 52 |
"""Search the web using DuckDuckGo and Tavily
|
| 53 |
"""
|
| 54 |
try:
|