Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/fix staging #599

Merged
merged 8 commits into from
Feb 17, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert Web Retrieval Fix
  • Loading branch information
richwardle committed Feb 17, 2025
commit 1dec4a4534b1ec5b85896f487677f0672e8c239b
18 changes: 7 additions & 11 deletions validator_api/gpt_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,25 +157,21 @@ async def web_retrieval(search_query: str, n_miners: int = 10, n_results: int =
if isinstance(res, SynapseStreamResult) and res.accumulated_chunks
]

distinct_results = list(np.unique(results))
search_results = []
website = None
for result in results:
for result in distinct_results:
try:
parsed_result = json.loads(result)
for website in parsed_result:
search_results.append(SearchResult(**website))
logger.info(f"🔍 Parsed Result: {website}")
except Exception as e:
logger.error(f"{e}: {website}")


distinct_results = list(np.unique(search_results))
search_results.append(SearchResult(**parsed_result))
logger.info(f"🔍 Parsed Result: {parsed_result}")
except Exception:
logger.error(f"🔍 Failed to parse result: {result}")

if len(search_results) == 0:
raise HTTPException(status_code=500, detail="No miner responded successfully")

asyncio.create_task(scoring_queue.scoring_queue.append_response(uids=uids, body=body, chunks=[]))
return WebSearchResponse(results=distinct_results)
return WebSearchResponse(results=search_results)


@router.post(
Expand Down