The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
oci: drop params automatically and add DEDICATED Support
João Speglichaeae6cffe48d
diff --git a/litellm/llms/oci/chat/transformation.py b/litellm/llms/oci/chat/transformation.pyindex 6755cab22e0..72a044e014a 100644--- a/litellm/llms/oci/chat/transformation.py+++ b/litellm/llms/oci/chat/transformation.py@@ -207,9 +207,9 @@ class OCIChatConfig(BaseConfig):alias = open_ai_to_oci_param_map.get(key)if alias is False:- if drop_params:- continue-+ # Workaround for mypy issue+ #if drop_params:+ continueraise Exception(f"param `{key}` is not supported on OCI")if alias is None:@@ -450,12 +450,26 @@ class OCIChatConfig(BaseConfig):"Cohere models are not yet supported in the litellm OCI chat completion endpoint. Use the Cohere API directly.")else:- data = OCICompletionPayload(- compartmentId=oci_compartment_id,- servingMode=OCIServingMode(+ oci_serving_mode = optional_params.get("oci_serving_mode", "ON_DEMAND")+ if oci_serving_mode not in ["ON_DEMAND", "DEDICATED"]:+ raise Exception(+ "kwarg `oci_serving_mode` must be either 'ON_DEMAND' or 'DEDICATED'"+ )++ if oci_serving_mode == "DEDICATED":+ servingMode = OCIServingMode(+ servingType="DEDICATED",+ endpointId=model,+ )+ else:+ servingMode = OCIServingMode(servingType="ON_DEMAND",modelId=model,- ),+ )++ data = OCICompletionPayload(+ compartmentId=oci_compartment_id,+ servingMode=servingMode,chatRequest=OCIChatRequestPayload(apiFormat=vendor.value,messages=adapt_messages_to_generic_oci_standard(messages),@@ -601,6 +615,11 @@ class OCIChatConfig(BaseConfig):if "stream" in data:del data["stream"]+ stops = data.get("chatRequest", {}).get("stop")+ if stops and len(stops) > 8:+ # mantém apenas os 8 primeiros+ data["chatRequest"]["stop"] = stops[:8]+if client is None or isinstance(client, HTTPHandler):client = get_async_httpx_client(llm_provider=LlmProviders.BYTEZ, params={})diff --git a/litellm/types/llms/oci.py b/litellm/types/llms/oci.pyindex 75d13192c50..56fd61ad7e6 100644--- a/litellm/types/llms/oci.py+++ b/litellm/types/llms/oci.py@@ -100,8 +100,8 @@ class OCIServingMode(BaseModel):"""Defines the serving mode and the model to be used."""servingType: str- modelId: str-+ endpointId: Optional[str] = None+ modelId: Optional[str] = Noneclass OCICompletionPayload(BaseModel):"""Pydantic model for the complete OCI chat request body."""@@ -129,7 +129,7 @@ class OCIPromptTokensDetails(BaseModel):class OCIResponseUsage(BaseModel):"""Token usage in the OCI response."""-+promptTokens: intcompletionTokens: inttotalTokens: int