11import sys
2-
3- import pytest
4-
52from databricks .sdk .core import Config
63
74
@@ -17,14 +14,19 @@ def test_open_ai_client(monkeypatch):
1714 assert client .api_key == "test_token"
1815
1916
20- @pytest .mark .skipif (sys .version_info <= (3 , 7 ), reason = "Requires Python > 3.7" )
2117def test_langchain_open_ai_client (monkeypatch ):
2218 from databricks .sdk import WorkspaceClient
23-
24- monkeypatch .setenv ('DATABRICKS_HOST' , 'test_host' )
25- monkeypatch .setenv ('DATABRICKS_TOKEN' , 'test_token' )
26- w = WorkspaceClient (config = Config ())
27- client = w .serving_endpoints .get_langchain_chat_open_ai_client ("databricks-meta-llama-3-1-70b-instruct" )
28-
29- assert client .openai_api_base == "https://test_host/serving-endpoints"
30- assert client .model_name == "databricks-meta-llama-3-1-70b-instruct"
19+ print (sys .version_info )
20+ print (sys .version_info <= (3 ,7 ))
21+ if sys .version_info <= (3 , 7 ):
22+ with pytest .raises (ImportError ):
23+ w = WorkspaceClient (config = Config ())
24+ client = w .serving_endpoints .get_langchain_chat_open_ai_client ("databricks-meta-llama-3-1-70b-instruct" )
25+ else :
26+ monkeypatch .setenv ('DATABRICKS_HOST' , 'test_host' )
27+ monkeypatch .setenv ('DATABRICKS_TOKEN' , 'test_token' )
28+ w = WorkspaceClient (config = Config ())
29+ client = w .serving_endpoints .get_langchain_chat_open_ai_client ("databricks-meta-llama-3-1-70b-instruct" )
30+
31+ assert client .openai_api_base == "https://test_host/serving-endpoints"
32+ assert client .model_name == "databricks-meta-llama-3-1-70b-instruct"
0 commit comments