You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Many providers are starting to add usage to streaming. This makes it much easier for Mirascope to calculate cost.
Describe the solution you'd like
Add a total_cost property to CohereCallResponseChunk. Read the "event_type": "stream-end" sent by Cohere API and calculate cost using
Is your feature request related to a problem? Please describe. Many providers are starting to add usage to streaming. This makes it much easier for Mirascope to calculate cost.
Describe the solution you'd like Add a total_cost property to CohereCallResponseChunk. Read the "event_type": "stream-end" sent by Cohere API and calculate cost using
I am working on this but the problem I am facing is that event returned by co.chat_stream() is of type StreamedChatResponse and it's response property is of type NonStreamedChatResponse which does not have token_count property in it. I am not sure how do I access the token_count here.
Doesn't the NonStreamedChatResponse type have response.meta.billed_units, which return ApiMetaBilledUnits from which we should be able to grab the same usage statistics that we do for the normal response? We can likely massage that data into the form we need to calculate cost, right?
Is your feature request related to a problem? Please describe.
Many providers are starting to add usage to streaming. This makes it much easier for Mirascope to calculate cost.
Describe the solution you'd like
Add a
total_cost
property toCohereCallResponseChunk
. Read the"event_type": "stream-end"
sent by Cohere API and calculate cost usingUpdate https://github.com/Mirascope/mirascope/blob/dev/mirascope/cohere/utils.py as necessary.
The text was updated successfully, but these errors were encountered: