Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
add finish_reason = event.choices[0].finish_reason
Browse files Browse the repository at this point in the history
  • Loading branch information
patcher9 committed Mar 14, 2024
1 parent d1db1eb commit 674a17f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/dokumetry/async_mistral.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ async def stream_generator():
prompt_tokens = event.usage.prompt_tokens
completion_tokens = event.usage.completion_tokens
total_tokens = event.usage.total_tokens
finish_reason = event.choices[0].finish_reason
yield event
end_time = time.time()
duration = end_time - start_time
Expand Down Expand Up @@ -142,7 +143,8 @@ async def stream_generator():
"response": accumulated_content,
"promptTokens": prompt_tokens,
"completionTokens": completion_tokens,
"totalTokens": total_tokens
"totalTokens": total_tokens,
"finishReason": finish_reason
}

send_data(data, doku_url, api_key)
Expand Down
4 changes: 3 additions & 1 deletion src/dokumetry/mistral.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def stream_generator():
prompt_tokens = event.usage.prompt_tokens
completion_tokens = event.usage.completion_tokens
total_tokens = event.usage.total_tokens
finish_reason = event.choices[0].finish_reason
yield event
end_time = time.time()
duration = end_time - start_time
Expand Down Expand Up @@ -142,7 +143,8 @@ def stream_generator():
"response": accumulated_content,
"promptTokens": prompt_tokens,
"completionTokens": completion_tokens,
"totalTokens": total_tokens
"totalTokens": total_tokens,
"finishReason": finish_reason
}

send_data(data, doku_url, api_key)
Expand Down

0 comments on commit 674a17f

Please sign in to comment.