dsmueller commited on
Commit
9c24033
1 Parent(s): 9f788bf

Final updates to get working, tested locally

Browse files
Files changed (2) hide show
  1. Dockerfile +4 -1
  2. scripts/queries.py +12 -3
Dockerfile CHANGED
@@ -34,8 +34,11 @@ EXPOSE 8501
34
  # The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working. Your container needs to listen to Streamlit’s (default) port 8501:
35
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
36
 
 
 
 
37
  # An ENTRYPOINT allows you to configure a container that will run as an executable. Here, it also contains the entire streamlit run command for your app, so you don’t have to call it from the command line
38
- ENTRYPOINT ["streamlit", "run", "./scripts/Start.py", "--server.port=8501", "--server.address=0.0.0.0"]
39
 
40
  # Execute with:
41
  # docker build -t <image_name> .
 
34
  # The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working. Your container needs to listen to Streamlit’s (default) port 8501:
35
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
36
 
37
+ # Update working directory to be consistent with where Start.py is
38
+ WORKDIR /usr/src/app/scripts
39
+
40
  # An ENTRYPOINT allows you to configure a container that will run as an executable. Here, it also contains the entire streamlit run command for your app, so you don’t have to call it from the command line
41
+ ENTRYPOINT ["streamlit", "run", "Start.py", "--server.port=8501", "--server.address=0.0.0.0"]
42
 
43
  # Execute with:
44
  # docker build -t <image_name> .
scripts/queries.py CHANGED
@@ -74,7 +74,10 @@ class QA_Model:
74
  logging.info('Chat vectorstore: '+str(self.vectorstore))
75
 
76
  # Test query
77
- test_query = self.vectorstore.similarity_search(TEST_QUERY_PROMPT)
 
 
 
78
  logging.info('Test query: '+str(test_query))
79
  if not test_query:
80
  raise ValueError("Pinecone vector database is not configured properly. Test query failed.")
@@ -94,7 +97,10 @@ class QA_Model:
94
  logging.info('Chat vectorstore: '+str(self.vectorstore))
95
 
96
  # Test query
97
- test_query = self.vectorstore.similarity_search(TEST_QUERY_PROMPT)
 
 
 
98
  logging.info('Test query: '+str(test_query))
99
  if not test_query:
100
  raise ValueError("Chroma vector database is not configured properly. Test query failed.")
@@ -110,7 +116,10 @@ class QA_Model:
110
  logging.info('Chat query model:'+str(query_model))
111
 
112
  # Test query
113
- test_query = self.vectorstore.search(TEST_QUERY_PROMPT)
 
 
 
114
  logging.info('Test query: '+str(test_query))
115
  if not test_query:
116
  raise ValueError("Chroma vector database is not configured properly. Test query failed.")
 
74
  logging.info('Chat vectorstore: '+str(self.vectorstore))
75
 
76
  # Test query
77
+ try:
78
+ test_query = self.vectorstore.similarity_search(TEST_QUERY_PROMPT)
79
+ except:
80
+ raise Exception("Pinecone vector database is not configured properly. Test query failed. Likely the index does not exist.")
81
  logging.info('Test query: '+str(test_query))
82
  if not test_query:
83
  raise ValueError("Pinecone vector database is not configured properly. Test query failed.")
 
97
  logging.info('Chat vectorstore: '+str(self.vectorstore))
98
 
99
  # Test query
100
+ try:
101
+ test_query = self.vectorstore.similarity_search(TEST_QUERY_PROMPT)
102
+ except:
103
+ raise Exception("Chroma vector database is not configured properly. Test query failed. Likely the index does not exist.")
104
  logging.info('Test query: '+str(test_query))
105
  if not test_query:
106
  raise ValueError("Chroma vector database is not configured properly. Test query failed.")
 
116
  logging.info('Chat query model:'+str(query_model))
117
 
118
  # Test query
119
+ try:
120
+ test_query = self.vectorstore.search(TEST_QUERY_PROMPT)
121
+ except:
122
+ raise Exception("RAGatouille vector database is not configured properly.")
123
  logging.info('Test query: '+str(test_query))
124
  if not test_query:
125
  raise ValueError("Chroma vector database is not configured properly. Test query failed.")