(chore) util: remove_model_id

This commit is contained in:
ishaan-jaff 2023-11-29 17:30:33 -08:00
parent 7a38a45d62
commit 2c74dbed17

View file

@ -5846,4 +5846,13 @@ def transform_logprobs(hf_response):
# Add the 'token_info' list to the 'transformed_logprobs' list
transformed_logprobs = token_info
return transformed_logprobs
return transformed_logprobs
# used in LiteLLM Router
def remove_model_id(original_model_string):
# Find the index of "ModelID" in the string
index_of_model_id = original_model_string.find("-ModelID")
# Remove everything after "-ModelID" if it exists
if index_of_model_id != -1:
return original_model_string[:index_of_model_id]
return original_model_string