mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 02:05:22 -04:00
fix: SearchService.search() calls comprehensive_web_search incorrectly (broken public API) (#1720)
SearchService.search() did:
raw_results = await comprehensive_web_search(
query, max_results=10 * depth, fetch_content=fetch_content)
comprehensive_web_search is a synchronous function whose count knob is
`max_pages` (not `max_results`) and which has no `fetch_content` parameter, so
the call raised TypeError on argument binding; `await` on its non-coroutine
return would also fail. It returns a context string, or a (context, sources)
tuple with return_sources=True — not the list of dicts the wrapper iterates.
The method is exported in services/search/__init__.py and services/__init__.py
with a usage example in its docstring, so any caller of the documented public
API hit an immediate crash. Call it correctly via asyncio.to_thread with
max_pages + return_sources=True and use the returned source list as the rows.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -62,13 +62,18 @@ class SearchService:
|
||||
SearchResponse with results
|
||||
"""
|
||||
depth = depth or self.default_depth
|
||||
fetch_content = fetch_content if fetch_content is not None else self.fetch_content
|
||||
|
||||
# Use existing search implementation
|
||||
raw_results = await comprehensive_web_search(
|
||||
# comprehensive_web_search is synchronous and, with return_sources=True,
|
||||
# returns (context_str, [{"url", "title"}, ...]). Run it off the event
|
||||
# loop so we don't block it, and use the source list as the result rows.
|
||||
# `fetch_content` is accepted for API compatibility; the comprehensive
|
||||
# search always fetches page content.
|
||||
import asyncio
|
||||
_context, raw_results = await asyncio.to_thread(
|
||||
comprehensive_web_search,
|
||||
query,
|
||||
max_results=10 * depth,
|
||||
fetch_content=fetch_content,
|
||||
max_pages=10 * depth,
|
||||
return_sources=True,
|
||||
)
|
||||
|
||||
results = []
|
||||
|
||||
Reference in New Issue
Block a user