Skip to content

Commit

Permalink
chore(examples): lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gradenr committed Mar 8, 2024
1 parent 7dec9b7 commit fdcb94e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/chat_completion_async_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ async def main() -> None:
# Print the incremental deltas returned by the LLM.
async for chunk in stream:
print(chunk.choices[0].delta.content, end="")

# Usage information is available on the final chunk
if chunk.choices[0].finish_reason:
assert chunk.x_groq is not None
assert chunk.x_groq.usage is not None
print(f"\n\nUsage stats: {chunk.x_groq.usage}")


Expand Down
4 changes: 4 additions & 0 deletions examples/chat_completion_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,9 @@
# Print the incremental deltas returned by the LLM.
for chunk in stream:
print(chunk.choices[0].delta.content, end="")

if chunk.choices[0].finish_reason:
# Usage information is available on the final chunk
assert chunk.x_groq is not None
assert chunk.x_groq.usage is not None
print(f"\n\nUsage stats: {chunk.x_groq.usage}")

0 comments on commit fdcb94e

Please sign in to comment.