44"""
55Test integrity of base class.
66"""
7+ import pinecone
78import pytest # pylint: disable=unused-import
89from langchain .chat_models import ChatOpenAI
910from langchain .embeddings import OpenAIEmbeddings
1011from langchain .text_splitter import RecursiveCharacterTextSplitter
1112from langchain .vectorstores .pinecone import Pinecone
1213
14+ from ..const import Credentials
1315from ..ssm import SalesSupportModel
1416
1517
@@ -29,3 +31,20 @@ def test_02_class_aatribute_types(self):
2931 assert isinstance (ssm .pinecone_index , Pinecone )
3032 assert isinstance (ssm .text_splitter , RecursiveCharacterTextSplitter )
3133 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