11import sys
2+
3+ import pytest
4+
25from databricks .sdk .core import Config
36
47
@@ -14,19 +17,14 @@ def test_open_ai_client(monkeypatch):
1417 assert client .api_key == "test_token"
1518
1619
20+ @pytest .mark .skipif (sys .version_info < (3 , 8 ), reason = "Requires Python > 3.7" )
1721def test_langchain_open_ai_client (monkeypatch ):
1822 from databricks .sdk import WorkspaceClient
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"
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"
0 commit comments