Spaces:
Sleeping
Sleeping
add wikipedia tool
Browse files- requirements.txt +2 -1
- tools.py +6 -0
requirements.txt
CHANGED
|
@@ -4,4 +4,5 @@ langgraph
|
|
| 4 |
langchain
|
| 5 |
langchain-community
|
| 6 |
langchain-google-genai
|
| 7 |
-
duckduckgo-search
|
|
|
|
|
|
| 4 |
langchain
|
| 5 |
langchain-community
|
| 6 |
langchain-google-genai
|
| 7 |
+
duckduckgo-search
|
| 8 |
+
wikipedia
|
tools.py
CHANGED
|
@@ -2,6 +2,12 @@ from langchain_community.tools import DuckDuckGoSearchResults
|
|
| 2 |
|
| 3 |
web_search = DuckDuckGoSearchResults()
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
tools = [
|
|
|
|
| 6 |
web_search
|
| 7 |
]
|
|
|
|
| 2 |
|
| 3 |
web_search = DuckDuckGoSearchResults()
|
| 4 |
|
| 5 |
+
from langchain_community.tools import WikipediaQueryRun
|
| 6 |
+
from langchain_community.utilities import WikipediaAPIWrapper
|
| 7 |
+
|
| 8 |
+
wikipedia = WikipediaQueryRun(api_wrapper=WikipediaAPIWrapper(lang="en", doc_content_chars_max=10000))
|
| 9 |
+
|
| 10 |
tools = [
|
| 11 |
+
wikipedia,
|
| 12 |
web_search
|
| 13 |
]
|