Skip to content

Commit

Permalink
Add token usage to response
Browse files Browse the repository at this point in the history
  • Loading branch information
mcjustin committed Nov 12, 2024
1 parent dc1c506 commit af9b3c5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def chat():
messages=data['messages']
)
message_dict = response.choices[0].message.to_dict()
message_dict['prompt_tokens'] = response.usage.prompt_tokens
message_dict['completion_tokens'] = response.usage.completion_tokens
return jsonify(message_dict)

@app.route('/api/go', methods=['GET'])
Expand Down

0 comments on commit af9b3c5

Please sign in to comment.