mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-12 04:44:52 +00:00
Fix parsing
This commit is contained in:
parent
785c6e4893
commit
69c168d1e0
@ -102,6 +102,7 @@ class ResponseComparator(JSONSnapshotExtension):
|
||||
|
||||
def _convert_data(data):
|
||||
if isinstance(data, Dict):
|
||||
if "choices" in data:
|
||||
choices = data["choices"]
|
||||
if isinstance(choices, List) and len(choices) >= 1:
|
||||
if "delta" in choices[0]:
|
||||
@ -109,7 +110,7 @@ class ResponseComparator(JSONSnapshotExtension):
|
||||
if "text" in choices[0]:
|
||||
return Completion(**data)
|
||||
return ChatComplete(**data)
|
||||
if isinstance(data, Dict):
|
||||
else:
|
||||
return Response(**data)
|
||||
if isinstance(data, List):
|
||||
return [_convert_data(d) for d in data]
|
||||
|
Loading…
Reference in New Issue
Block a user