forked from phoenix/litellm-mirror
(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,
|
completion_response=None,
|
||||||
model="gpt-3.5-turbo",
|
model="gpt-3.5-turbo",
|
||||||
prompt="",
|
prompt="",
|
||||||
|
messages: List = [],
|
||||||
completion="",
|
completion="",
|
||||||
total_time=0.0, # used for replicate
|
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.
|
- If an error occurs during execution, the function returns 0.0 without blocking the user's execution path.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
if messages != []:
|
||||||
|
prompt = " ".join([message["content"] for message in messages])
|
||||||
# Handle Inputs to completion_cost
|
# Handle Inputs to completion_cost
|
||||||
prompt_tokens = 0
|
prompt_tokens = 0
|
||||||
completion_tokens = 0
|
completion_tokens = 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue