File tree Expand file tree Collapse file tree 3 files changed +19
-51
lines changed Expand file tree Collapse file tree 3 files changed +19
-51
lines changed Original file line number Diff line number Diff line change 7
7
from dotenv import find_dotenv , load_dotenv
8
8
9
9
10
+ class ConfigurationError (Exception ):
11
+ """Exception raised for errors in the configuration."""
12
+
13
+ def __init__ (self , message ):
14
+ self .message = message
15
+ super ().__init__ (self .message )
16
+
17
+
10
18
# pylint: disable=duplicate-code
11
19
dotenv_path = find_dotenv ()
12
20
if os .path .exists (dotenv_path ):
25
33
OPENAI_CHAT_MAX_RETRIES = int (os .environ .get ("OPENAI_CHAT_MAX_RETRIES" , 3 ))
26
34
OPENAI_CHAT_CACHE = bool (os .environ .get ("OPENAI_CHAT_CACHE" , True ))
27
35
DEBUG_MODE = os .environ .get ("DEBUG_MODE" , "False" ) == "True"
36
+
37
+ if OPENAI_API_KEY == "PLEASE-ADD-ME" :
38
+ raise ConfigurationError ("OPENAI_API_KEY is not set. Please add your OpenAI API key to the .env file." )
39
+ if OPENAI_API_ORGANIZATION == "PLEASE-ADD-ME" :
40
+ raise ConfigurationError (
41
+ "OPENAI_API_ORGANIZATION is not set. Please add your OpenAI API organization to the .env file."
42
+ )
43
+ if PINECONE_API_KEY == "PLEASE-ADD-ME" :
44
+ raise ConfigurationError ("PINECONE_API_KEY is not set. Please add your Pinecone API key to the .env file." )
45
+
28
46
else :
29
47
raise FileNotFoundError ("No .env file found in root directory of repository" )
30
48
Original file line number Diff line number Diff line change 5
5
"""
6
6
import pytest # pylint: disable=unused-import
7
7
from langchain .chat_models import ChatOpenAI
8
- from langchain .embeddings import OpenAIEmbeddings
9
8
10
- from models .hybrid_search_retreiver import HybridSearchRetriever , TextSplitter
9
+ from models .hybrid_search_retreiver import HybridSearchRetriever
11
10
from models .pinecone import PineConeIndex
12
11
13
12
@@ -29,5 +28,3 @@ def test_02_class_aatribute_types(self):
29
28
hsr = HybridSearchRetriever ()
30
29
assert isinstance (hsr .chat , ChatOpenAI )
31
30
assert isinstance (hsr .pinecone , PineConeIndex )
32
- assert isinstance (hsr .text_splitter , TextSplitter )
33
- assert isinstance (hsr .openai_embeddings , OpenAIEmbeddings )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments