4
4
"""
5
5
Test integrity of base class.
6
6
"""
7
+ import pinecone
7
8
import pytest # pylint: disable=unused-import
8
9
from langchain .chat_models import ChatOpenAI
9
10
from langchain .embeddings import OpenAIEmbeddings
10
11
from langchain .text_splitter import RecursiveCharacterTextSplitter
11
12
from langchain .vectorstores .pinecone import Pinecone
12
13
14
+ from ..const import Credentials
13
15
from ..ssm import SalesSupportModel
14
16
15
17
@@ -29,3 +31,20 @@ def test_02_class_aatribute_types(self):
29
31
assert isinstance (ssm .pinecone_index , Pinecone )
30
32
assert isinstance (ssm .text_splitter , RecursiveCharacterTextSplitter )
31
33
assert isinstance (ssm .openai_embedding , OpenAIEmbeddings )
34
+
35
+ def test_03_test_openai_connectivity (self ):
36
+ """Ensure that we have connectivity to OpenAI."""
37
+
38
+ ssm = SalesSupportModel ()
39
+ retval = ssm .cached_chat_request (
40
+ "your are a helpful assistant" , "please return the value 'CORRECT' in all upper case."
41
+ )
42
+ assert retval == "CORRECT"
43
+
44
+ def test_04_test_pinecone_connectivity (self ):
45
+ """Ensure that we have connectivity to Pinecone."""
46
+ # pylint: disable=broad-except
47
+ try :
48
+ pinecone .init (api_key = Credentials .PINECONE_API_KEY , environment = Credentials .PINECONE_ENVIRONMENT )
49
+ except Exception as e :
50
+ assert False , f"pinecone.init() failed with exception: { e } "
0 commit comments