mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-12 21:11:43 +00:00
Harrison/ddg (#3206)
Co-authored-by: itai <itai.marks@gmail.com> Co-authored-by: Itai Marks <itaim@users.noreply.github.com> Co-authored-by: Tianyi Pan <60060750+tipani86@users.noreply.github.com> Co-authored-by: Tianyi Pan <tianyi.pan@clobotics.com> Co-authored-by: Adilzhan Ismailov <13088690+aismlv@users.noreply.github.com> Co-authored-by: Justin Flick <Justinjayflick@gmail.com> Co-authored-by: Justin Flick <jflick@homesite.com>
This commit is contained in:
22
tests/integration_tests/test_duckduckdgo_search_api.py
Normal file
22
tests/integration_tests/test_duckduckdgo_search_api.py
Normal file
@@ -0,0 +1,22 @@
|
||||
import pytest
|
||||
|
||||
from langchain.tools.ddg_search.tool import DuckDuckGoSearchTool
|
||||
|
||||
|
||||
def ddg_installed() -> bool:
|
||||
try:
|
||||
from duckduckgo_search import ddg # noqa: F401
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"duckduckgo not installed, skipping test {e}")
|
||||
return False
|
||||
|
||||
|
||||
@pytest.mark.skipif(not ddg_installed(), reason="requires duckduckgo-search package")
|
||||
def test_ddg_search_tool() -> None:
|
||||
keywords = "Bella Ciao"
|
||||
tool = DuckDuckGoSearchTool()
|
||||
result = tool(keywords)
|
||||
print(result)
|
||||
assert len(result.split()) > 20
|
Reference in New Issue
Block a user