Skip to content

Commit

Permalink
use black to reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
一帆 committed Nov 28, 2023
1 parent 059d8fe commit 7498613
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pilot/model/proxy/llms/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def chatgpt_generate_stream(
# logger.info(str(r))
# Azure Openai reponse may have empty choices body in the first chunk
# to avoid index out of range error
if not r.get('choices'):
if not r.get("choices"):
continue
if r.choices[0].delta.content is not None:
content = r.choices[0].delta.content
Expand All @@ -191,7 +191,7 @@ def chatgpt_generate_stream(

text = ""
for r in res:
if not r.get('choices'):
if not r.get("choices"):
continue
if r["choices"][0]["delta"].get("content") is not None:
content = r["choices"][0]["delta"]["content"]
Expand Down Expand Up @@ -227,7 +227,7 @@ async def async_chatgpt_generate_stream(
res = await client.chat.completions.create(messages=history, **payloads)
text = ""
for r in res:
if not r.get('choices'):
if not r.get("choices"):
continue
if r.choices[0].delta.content is not None:
content = r.choices[0].delta.content
Expand All @@ -242,7 +242,7 @@ async def async_chatgpt_generate_stream(

text = ""
async for r in res:
if not r.get('choices'):
if not r.get("choices"):
continue
if r["choices"][0]["delta"].get("content") is not None:
content = r["choices"][0]["delta"]["content"]
Expand Down

0 comments on commit 7498613

Please sign in to comment.