Skip to content

Commit 6f8be0e

Browse files
Hotfix bad responses transformation (#373)
Co-authored-by: Siddharth Narayanan <[email protected]>
1 parent 35f266a commit 6f8be0e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

packages/lmi/src/lmi/llms.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,19 @@ def maybe_set_config_attribute(cls, input_data: dict[str, Any]) -> dict[str, Any
730730
else:
731731
# pylint: disable-next=possibly-used-before-assignment
732732
_DeploymentTypedDictValidator.validate_python(model_list)
733+
734+
# HOT FIX for https://github.com/BerriAI/litellm/issues/16808
735+
model_names = [m.get("model_name", "") for m in model_list] + [data["name"]]
736+
for m in model_names:
737+
if (
738+
m
739+
and (model_cost_key := m.split("/")[-1]) in litellm.model_cost
740+
and litellm.model_cost[model_cost_key]["mode"] != "completions"
741+
):
742+
logger.warning(
743+
f"We are applying hotfix to force completion mode from litellm for {model_cost_key}"
744+
)
745+
litellm.model_cost[model_cost_key]["mode"] = "completions"
733746
return data
734747

735748
# SEE: https://platform.openai.com/docs/api-reference/chat/create#chat-create-tool_choice

0 commit comments

Comments
 (0)