Skip to content

Commit 5fcd36c

Browse files
committed
fix: add OpenRouter to CLI, fix ddgs deprecation, add sample reports
1 parent fbbf4c0 commit 5fcd36c

5 files changed

Lines changed: 253 additions & 17 deletions

File tree

deepworm/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def build_parser() -> argparse.ArgumentParser:
6868
parser.add_argument(
6969
"--provider", "-p",
7070
type=str,
71-
choices=["openai", "anthropic", "google", "ollama"],
71+
choices=["openai", "anthropic", "google", "openrouter", "ollama"],
7272
default=None,
7373
help="LLM provider (default: auto-detect from env)",
7474
)

deepworm/search.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,27 @@ def _search_ddgs(query: str, max_results: int) -> list[SearchResult]:
9393
"""Try the ddgs/duckduckgo_search library."""
9494
results = []
9595
try:
96-
from duckduckgo_search import DDGS
97-
with DDGS() as ddgs:
98-
for r in ddgs.text(query, max_results=max_results):
99-
results.append(SearchResult(
100-
title=r.get("title", ""),
101-
url=r.get("href", ""),
102-
snippet=r.get("body", ""),
103-
))
96+
from ddgs import DDGS
97+
ddgs = DDGS()
98+
for r in ddgs.text(query, max_results=max_results):
99+
results.append(SearchResult(
100+
title=r.get("title", ""),
101+
url=r.get("href", ""),
102+
snippet=r.get("body", ""),
103+
))
104104
except ImportError:
105105
try:
106-
from ddgs import DDGS
107-
ddgs = DDGS()
108-
for r in ddgs.text(query, max_results=max_results):
109-
results.append(SearchResult(
110-
title=r.get("title", ""),
111-
url=r.get("href", ""),
112-
snippet=r.get("body", ""),
113-
))
106+
import warnings
107+
with warnings.catch_warnings():
108+
warnings.simplefilter("ignore", RuntimeWarning)
109+
from duckduckgo_search import DDGS
110+
with DDGS() as ddgs:
111+
for r in ddgs.text(query, max_results=max_results):
112+
results.append(SearchResult(
113+
title=r.get("title", ""),
114+
url=r.get("href", ""),
115+
snippet=r.get("body", ""),
116+
))
114117
except (ImportError, Exception):
115118
raise
116119
return results

0 commit comments

Comments
 (0)