mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
fix(main.py): register both model name and model name with provider
This commit is contained in:
parent
c53ad878b3
commit
aa0de83083
1 changed files with 15 additions and 3 deletions
|
@ -591,26 +591,37 @@ def completion(
|
||||||
|
|
||||||
### REGISTER CUSTOM MODEL PRICING -- IF GIVEN ###
|
### REGISTER CUSTOM MODEL PRICING -- IF GIVEN ###
|
||||||
if input_cost_per_token is not None and output_cost_per_token is not None:
|
if input_cost_per_token is not None and output_cost_per_token is not None:
|
||||||
|
print_verbose(f"Registering model={model} in model cost map")
|
||||||
litellm.register_model(
|
litellm.register_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,
|
||||||
|
},
|
||||||
model: {
|
model: {
|
||||||
"input_cost_per_token": input_cost_per_token,
|
"input_cost_per_token": input_cost_per_token,
|
||||||
"output_cost_per_token": output_cost_per_token,
|
"output_cost_per_token": output_cost_per_token,
|
||||||
"litellm_provider": custom_llm_provider,
|
"litellm_provider": custom_llm_provider,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
if (
|
elif (
|
||||||
input_cost_per_second is not None
|
input_cost_per_second is not None
|
||||||
): # time based pricing just needs cost in place
|
): # time based pricing just needs cost in place
|
||||||
output_cost_per_second = output_cost_per_second or 0.0
|
output_cost_per_second = output_cost_per_second or 0.0
|
||||||
litellm.register_model(
|
litellm.register_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,
|
||||||
|
},
|
||||||
model: {
|
model: {
|
||||||
"input_cost_per_second": input_cost_per_second,
|
"input_cost_per_second": input_cost_per_second,
|
||||||
"output_cost_per_second": output_cost_per_second,
|
"output_cost_per_second": output_cost_per_second,
|
||||||
"litellm_provider": custom_llm_provider,
|
"litellm_provider": custom_llm_provider,
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
### BUILD CUSTOM PROMPT TEMPLATE -- IF GIVEN ###
|
### BUILD CUSTOM PROMPT TEMPLATE -- IF GIVEN ###
|
||||||
|
@ -3265,6 +3276,7 @@ async def ahealth_check(
|
||||||
## Set verbose to true -> ```litellm.set_verbose = True```
|
## Set verbose to true -> ```litellm.set_verbose = True```
|
||||||
def print_verbose(print_statement):
|
def print_verbose(print_statement):
|
||||||
try:
|
try:
|
||||||
|
verbose_logger.debug(print_statement)
|
||||||
if litellm.set_verbose:
|
if litellm.set_verbose:
|
||||||
print(print_statement) # noqa
|
print(print_statement) # noqa
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue