Skip to content

Commit

Permalink
jsonl streaming (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketmaurya authored May 22, 2024
1 parent 58502cb commit 90425e2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/litserve/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def encode_response(self, output):

def format_encoded_response(self, data):
if isinstance(data, dict):
return json.dumps(data)
return json.dumps(data) + "\n"
if isinstance(data, BaseModel):
return data.model_dump_json()
return data.model_dump_json() + "\n"
return data

@property
Expand Down

0 comments on commit 90425e2

Please sign in to comment.