Unverified Commit 54cc46f3 authored by WeiCheng's avatar WeiCheng Committed by GitHub
Browse files

[Bugfix] Fix small typo in the example of Streaming delimiter (#14793)

parent 601bd326
...@@ -42,7 +42,7 @@ def post_http_request(prompt: str, ...@@ -42,7 +42,7 @@ def post_http_request(prompt: str,
def get_streaming_response(response: requests.Response) -> Iterable[list[str]]: def get_streaming_response(response: requests.Response) -> Iterable[list[str]]:
for chunk in response.iter_lines(chunk_size=8192, for chunk in response.iter_lines(chunk_size=8192,
decode_unicode=False, decode_unicode=False,
delimiter=b"\0"): delimiter=b"\n"):
if chunk: if chunk:
data = json.loads(chunk.decode("utf-8")) data = json.loads(chunk.decode("utf-8"))
output = data["text"] output = data["text"]
......
...@@ -21,7 +21,7 @@ def http_bot(prompt): ...@@ -21,7 +21,7 @@ def http_bot(prompt):
for chunk in response.iter_lines(chunk_size=8192, for chunk in response.iter_lines(chunk_size=8192,
decode_unicode=False, decode_unicode=False,
delimiter=b"\0"): delimiter=b"\n"):
if chunk: if chunk:
data = json.loads(chunk.decode("utf-8")) data = json.loads(chunk.decode("utf-8"))
output = data["text"][0] output = data["text"][0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment