File tree Expand file tree Collapse file tree 4 files changed +62
-2
lines changed Expand file tree Collapse file tree 4 files changed +62
-2
lines changed Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ # flake8: noqa: F401
3
+ # pylint: disable=too-few-public-methods
4
+ """
5
+ Test integrity of base class.
6
+ """
7
+ import pytest # pylint: disable=unused-import
8
+
9
+ from ..ssm import SalesSupportModel
10
+
11
+
12
+ class TestOpenAI :
13
+ """Test SalesSupportModel class."""
14
+
15
+ def test_03_test_openai_connectivity (self ):
16
+ """Ensure that we have connectivity to OpenAI."""
17
+
18
+ ssm = SalesSupportModel ()
19
+ retval = ssm .cached_chat_request (
20
+ "your are a helpful assistant" , "please return the value 'CORRECT' in all upper case."
21
+ )
22
+ assert retval == "CORRECT"
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
2
+ # flake8: noqa: F401
3
+ """
4
+ Test integrity of base class.
5
+ """
6
+
7
+ import pinecone
8
+ import pytest # pylint: disable=unused-import
9
+ from langchain .embeddings import OpenAIEmbeddings
10
+ from langchain .vectorstores .pinecone import Pinecone
11
+
12
+ from ..const import Credentials
13
+
14
+
15
+ class TestPinecone :
16
+ """Test SalesSupportModel class."""
17
+
18
+ def test_01_test_pinecone_connectivity (self ):
19
+ """Ensure that we have connectivity to Pinecone."""
20
+ # pylint: disable=broad-except
21
+ try :
22
+ pinecone .init (api_key = Credentials .PINECONE_API_KEY , environment = Credentials .PINECONE_ENVIRONMENT )
23
+ except Exception as e :
24
+ assert False , f"pinecone.init() failed with exception: { e } "
25
+
26
+ def test_02_test_pinecone_index (self ):
27
+ """Ensure that the Pinecone index exists and that we can connect to it."""
28
+ pinecone .init (api_key = Credentials .PINECONE_API_KEY , environment = Credentials .PINECONE_ENVIRONMENT )
29
+ openai_embedding = OpenAIEmbeddings ()
30
+
31
+ # pylint: disable=broad-except
32
+ try :
33
+ Pinecone .from_existing_index (
34
+ Credentials .PINECONE_INDEX_NAME ,
35
+ embedding = openai_embedding ,
36
+ )
37
+ except Exception as e :
38
+ assert (
39
+ False
40
+ ), f"Pinecone initialization of index { Credentials .PINECONE_INDEX_NAME ,} failed with exception: { e } "
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
# flake8: noqa: F401
3
- # pylint: disable=too-few-public-methods
4
3
"""
5
4
Test integrity of base class.
6
5
"""
Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
# flake8: noqa: F401
3
- # pylint: disable=too-few-public-methods
4
3
"""
5
4
Test integrity of base class.
6
5
"""
You can’t perform that action at this time.
0 commit comments