Skip to content
3 changes: 3 additions & 0 deletions lib/crewai/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ azure-ai-inference = [
anthropic = [
"anthropic~=0.73.0",
]
oci = [
"oci>=2.168.0",
]
a2a = [
"a2a-sdk~=0.3.10",
"httpx-auth~=0.23.1",
Expand Down
12 changes: 11 additions & 1 deletion lib/crewai/src/crewai/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
"hosted_vllm",
"cerebras",
"dashscope",
"oci",
]


Expand Down Expand Up @@ -338,6 +339,7 @@ def __new__(cls, model: str, is_litellm: bool = False, **kwargs: Any) -> LLM:
"hosted_vllm": "hosted_vllm",
"cerebras": "cerebras",
"dashscope": "dashscope",
"oci": "oci",
}

canonical_provider = provider_mapping.get(prefix.lower())
Expand Down Expand Up @@ -457,6 +459,9 @@ def _matches_provider_pattern(cls, model: str, provider: str) -> bool:
# OpenRouter uses org/model format but accepts anything
return True

if provider == "oci":
return model_lower.startswith("ocid1.generativeaiendpoint") or "." in model_lower

return False

@classmethod
Expand Down Expand Up @@ -492,7 +497,7 @@ def _validate_model_in_constants(cls, model: str, provider: str) -> bool:
# azure does not provide a list of available models, determine a better way to handle this
return True

# Fallback to pattern matching for models not in constants
# Fallback to pattern matching for models not in constants (includes OCI)
return cls._matches_provider_pattern(model, provider)

@classmethod
Expand Down Expand Up @@ -573,6 +578,11 @@ def _get_native_provider(cls, provider: str) -> type | None:

return OpenAICompatibleCompletion

if provider == "oci":
from crewai.llms.providers.oci.completion import OCICompletion

return OCICompletion

return None

@model_validator(mode="before")
Expand Down
5 changes: 5 additions & 0 deletions lib/crewai/src/crewai/llms/providers/oci/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from crewai.llms.providers.oci.completion import OCICompletion

__all__ = [
"OCICompletion",
]
Loading