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
Next Next commit
Unpack Miner Results
  • Loading branch information
bkb2135 committed Feb 17, 2025
commit 44913c4ab6b14a657fdf89ba02022e90ea5c9ea6
11 changes: 8 additions & 3 deletions validator_api/gpt_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,26 @@ 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 = []
for result in distinct_results:
for result in results:
try:
parsed_result = json.loads(result)
search_results.append(SearchResult(**parsed_result))
logger.info(f"🔍 Parsed Result: {parsed_result}")
except Exception:
logger.error(f"🔍 Failed to parse result: {result}")

flattened_results = []
for result in search_results:
flattened_results.extend(result)

distinct_results = list(np.unique(flattened_results))

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=search_results)
return WebSearchResponse(results=distinct_results)


@router.post(
Expand Down