mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
fix(utils.py): update completion_cost docstring
This commit is contained in:
parent
ce4dffb7cb
commit
bc23365acc
1 changed files with 5 additions and 3 deletions
|
@ -4422,15 +4422,17 @@ def completion_cost(
|
||||||
Returns:
|
Returns:
|
||||||
float: The cost in USD dollars for the completion based on the provided parameters.
|
float: The cost in USD dollars for the completion based on the provided parameters.
|
||||||
|
|
||||||
|
Exceptions:
|
||||||
|
Raises exception if model not in the litellm model cost map. Register model, via custom pricing or PR - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json
|
||||||
|
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
|
- For custom pricing, see this - https://docs.litellm.ai/docs/proxy/custom_pricing
|
||||||
- If completion_response is provided, the function extracts token information and the model name from it.
|
- If completion_response is provided, the function extracts token information and the model name from it.
|
||||||
- If completion_response is not provided, the function calculates token counts based on the model and input text.
|
- If completion_response is not provided, the function calculates token counts based on the model and input text.
|
||||||
- The cost is calculated based on the model, prompt tokens, and completion tokens.
|
- The cost is calculated based on the model, prompt tokens, and completion tokens.
|
||||||
- For certain models containing "togethercomputer" in the name, prices are based on the model size.
|
- For certain models containing "togethercomputer" in the name, prices are based on the model size.
|
||||||
- For un-mapped Replicate models, the cost is calculated based on the total time used for the request.
|
- For un-mapped Replicate models, the cost is calculated based on the total time used for the request.
|
||||||
|
|
||||||
Exceptions:
|
|
||||||
- If an error occurs during execution, the error is raised
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue