Skip to content

Commit

Permalink
Handle responses not represented in json format (#103)
Browse files Browse the repository at this point in the history
* Handle request not represented in json format

* Add reasnable message in case non json response
  • Loading branch information
elvin-n authored Jan 8, 2024
1 parent 0d3b233 commit 111ddc9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion serve/benchmarks/benchmark_serving.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ async def send_request(
async for chunk, _ in response.content.iter_chunks():
chunks.append(chunk)
output = b"".join(chunks).decode("utf-8")
output = json.loads(output)
try:
output = json.loads(output)
except:
print(f"Cannot convert response to json. Returned response: '{output}', original prompt: {prompt}")
return

# Re-send the request if it failed.
if "error" not in output:
Expand Down

0 comments on commit 111ddc9

Please sign in to comment.