@@ -36,3 +36,42 @@ def test_with_incorrect_api_key() -> None:
3636 ef = OpenAIEmbeddingFunction (api_key = "incorrect_api_key" , dimensions = 64 )
3737 with pytest .raises (Exception , match = "Incorrect API key provided" ):
3838 ef (["hello world" ])
39+
40+
41+ def test_azure_requires_deployment_id () -> None :
42+ """Azure OpenAI should require deployment_id parameter."""
43+ pytest .importorskip ("openai" , reason = "openai not installed" )
44+ with pytest .raises (ValueError , match = "deployment_id must be specified" ):
45+ OpenAIEmbeddingFunction (
46+ api_key = "test_key" ,
47+ api_type = "azure" ,
48+ api_base = "https://example.openai.azure.com" ,
49+ api_version = "2023-05-15" ,
50+ # Missing deployment_id should raise
51+ )
52+
53+
54+ def test_azure_requires_api_version () -> None :
55+ """Azure OpenAI should require api_version parameter."""
56+ pytest .importorskip ("openai" , reason = "openai not installed" )
57+ with pytest .raises (ValueError , match = "api_version must be specified" ):
58+ OpenAIEmbeddingFunction (
59+ api_key = "test_key" ,
60+ api_type = "azure" ,
61+ api_base = "https://example.openai.azure.com" ,
62+ deployment_id = "my-deployment" ,
63+ # Missing api_version should raise
64+ )
65+
66+
67+ def test_azure_requires_api_base () -> None :
68+ """Azure OpenAI should require api_base parameter."""
69+ pytest .importorskip ("openai" , reason = "openai not installed" )
70+ with pytest .raises (ValueError , match = "api_base must be specified" ):
71+ OpenAIEmbeddingFunction (
72+ api_key = "test_key" ,
73+ api_type = "azure" ,
74+ api_version = "2023-05-15" ,
75+ deployment_id = "my-deployment" ,
76+ # Missing api_base should raise
77+ )
0 commit comments