Fix Azure OpenAI authentication for models without azure/ prefix (fixes #2358)

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-03-13 08:41:04 +00:00
parent 41a670166a
commit 1145900b39
3 changed files with 63 additions and 2 deletions

View File

@@ -221,6 +221,20 @@ def test_get_custom_llm_provider_openai():
llm = LLM(model="gpt-4")
assert llm._get_custom_llm_provider() == None
def test_get_custom_llm_provider_azure_with_prefix():
llm = LLM(model="azure/gpt-4")
assert llm._get_custom_llm_provider() == "azure"
def test_get_custom_llm_provider_azure_without_prefix():
llm = LLM(
model="gpt-4",
api_key="test_key",
api_base="test_base",
api_version="test_version"
)
assert llm._get_custom_llm_provider() == "azure"
def test_validate_call_params_supported():
class DummyResponse(BaseModel):