mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 02:34:29 +00:00
(feat) allow messages to be passed in completion_cost
This commit is contained in:
parent
29b2fa7f75
commit
c94ee62bcf
1 changed files with 3 additions and 0 deletions
|
@ -869,6 +869,7 @@ def completion_cost(
|
|||
completion_response=None,
|
||||
model="gpt-3.5-turbo",
|
||||
prompt="",
|
||||
messages: List = [],
|
||||
completion="",
|
||||
total_time=0.0, # used for replicate
|
||||
):
|
||||
|
@ -898,6 +899,8 @@ def completion_cost(
|
|||
- If an error occurs during execution, the function returns 0.0 without blocking the user's execution path.
|
||||
"""
|
||||
try:
|
||||
if messages != []:
|
||||
prompt = " ".join([message["content"] for message in messages])
|
||||
# Handle Inputs to completion_cost
|
||||
prompt_tokens = 0
|
||||
completion_tokens = 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue