Skip to content

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]

fix: fix linting error

Krrish Dholakia55186dad4c98
diff --git a/litellm/llms/oci/chat/transformation.py b/litellm/llms/oci/chat/transformation.py
index 1004408b236..915d2029afe 100644
--- a/litellm/llms/oci/chat/transformation.py
+++ b/litellm/llms/oci/chat/transformation.py
@@ -255,7 +255,12 @@ class OCIChatConfig(BaseConfig):
oci_key = optional_params.get("oci_key")
oci_key_file = optional_params.get("oci_key_file")
- if not oci_user or not oci_fingerprint or not oci_tenancy or not (oci_key or oci_key_file):
+ if (
+ not oci_user
+ or not oci_fingerprint
+ or not oci_tenancy
+ or not (oci_key or oci_key_file)
+ ):
raise Exception(
"Missing required parameters: oci_user, oci_fingerprint, oci_tenancy, "
"and at least one of oci_key or oci_key_file."
@@ -304,11 +309,14 @@ class OCIChatConfig(BaseConfig):
private_key = (
load_private_key_from_str(oci_key)
if oci_key
- else load_private_key_from_file(oci_key_file)
- if oci_key_file
- else None
+ else load_private_key_from_file(oci_key_file) if oci_key_file else None
)
+ if private_key is None:
+ raise Exception(
+ "Private key is required for OCI authentication. Please provide either oci_key or oci_key_file."
+ )
+
signature = private_key.sign(
signing_string.encode("utf-8"),
padding.PKCS1v15(),