mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
(feat) track cost for responses easily
This commit is contained in:
parent
59e47fac78
commit
d2ff7a17df
1 changed files with 4 additions and 0 deletions
|
@ -201,6 +201,10 @@ class ModelResponse(OpenAIObject):
|
||||||
d["choices"] = [choice.to_dict_recursive() for choice in self.choices]
|
d["choices"] = [choice.to_dict_recursive() for choice in self.choices]
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
def cost(self):
|
||||||
|
# for non streaming responses
|
||||||
|
return completion_cost(completion_response=self)
|
||||||
|
|
||||||
class EmbeddingResponse(OpenAIObject):
|
class EmbeddingResponse(OpenAIObject):
|
||||||
def __init__(self, id=None, choices=None, created=None, model=None, usage=None, stream=False, response_ms=None, **params):
|
def __init__(self, id=None, choices=None, created=None, model=None, usage=None, stream=False, response_ms=None, **params):
|
||||||
self.object = "list"
|
self.object = "list"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue