refactor(fireworks): name the Foundry deployment id prefix instead of commenting it

This commit is contained in:
mateo-berri 2026-08-18 13:17:44 -07:00
parent dc54b16d3c
commit 8dc8cae0ec

View file

@ -29,14 +29,12 @@ def get_fireworks_session_id(litellm_params: dict) -> str | None:
return None
AZURE_FOUNDRY_FIREWORKS_MODEL_ID_PREFIX: Final = "FW-"
def resolve_fireworks_resource_name(model: str) -> str:
stripped: Final = model.removeprefix("fireworks_ai/")
if stripped.startswith("accounts/") or "#" in stripped:
return stripped
# Azure AI Foundry (and similar OpenAI-compat hosts) expose Fireworks
# deployments as ids like ``FW-Kimi-K3``. Rewriting those to
# ``accounts/fireworks/models/FW-…`` yields DeploymentNotFound.
if stripped.startswith("FW-"):
if stripped.startswith(("accounts/", AZURE_FOUNDRY_FIREWORKS_MODEL_ID_PREFIX)) or "#" in stripped:
return stripped
if stripped.startswith(("routers/", "models/")):
return f"accounts/fireworks/{stripped}"