Litellm dev 10 26 2024 (#6472)

* docs(exception_mapping.md): add missing exception types

Fixes https://github.com/Aider-AI/aider/issues/2120#issuecomment-2438971183

* fix(main.py): register custom model pricing with specific key

Ensure custom model pricing is registered to the specific model+provider key combination

* test: make testing more robust for custom pricing

* fix(redis_cache.py): instrument otel logging for sync redis calls

ensures complete coverage for all redis cache calls
This commit is contained in:
Krish Dholakia 2024-10-28 15:05:43 -07:00 committed by GitHub
parent f44ab00de2
commit 70111a7abd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 310 additions and 72 deletions

View file

@ -933,12 +933,7 @@ def completion( # type: ignore # noqa: PLR0915
"input_cost_per_token": input_cost_per_token,
"output_cost_per_token": output_cost_per_token,
"litellm_provider": custom_llm_provider,
},
model: {
"input_cost_per_token": input_cost_per_token,
"output_cost_per_token": output_cost_per_token,
"litellm_provider": custom_llm_provider,
},
}
}
)
elif (
@ -951,12 +946,7 @@ def completion( # type: ignore # noqa: PLR0915
"input_cost_per_second": input_cost_per_second,
"output_cost_per_second": output_cost_per_second,
"litellm_provider": custom_llm_provider,
},
model: {
"input_cost_per_second": input_cost_per_second,
"output_cost_per_second": output_cost_per_second,
"litellm_provider": custom_llm_provider,
},
}
}
)
### BUILD CUSTOM PROMPT TEMPLATE -- IF GIVEN ###
@ -3331,7 +3321,7 @@ def embedding( # noqa: PLR0915
if input_cost_per_token is not None and output_cost_per_token is not None:
litellm.register_model(
{
model: {
f"{custom_llm_provider}/{model}": {
"input_cost_per_token": input_cost_per_token,
"output_cost_per_token": output_cost_per_token,
"litellm_provider": custom_llm_provider,
@ -3342,7 +3332,7 @@ def embedding( # noqa: PLR0915
output_cost_per_second = output_cost_per_second or 0.0
litellm.register_model(
{
model: {
f"{custom_llm_provider}/{model}": {
"input_cost_per_second": input_cost_per_second,
"output_cost_per_second": output_cost_per_second,
"litellm_provider": custom_llm_provider,