AashitaK commited on
Commit
3f14ec0
·
1 Parent(s): a5a8279

Updated vector store

Browse files
app.py CHANGED
@@ -6,9 +6,10 @@ from utils.response_manager import ResponseManager # Import the ResponseManager
6
  This script sets up a Gradio interface to host an AI chatbot using RAG (Retrieval-Augmented Generation)
7
  to provide responses to user queries. Response API from OpenAI is used for both retrieval and generation of responses.
8
  """
 
9
  # Vector store ID for the retrieval of knowledge base documents
10
  # Load the vector store ID from the environment variable
11
- vector_store_id = os.getenv('VECTOR_STORE_ID')
12
 
13
  # Check if the VECTOR_STORE_ID environment variable is set
14
  if not vector_store_id:
@@ -40,7 +41,7 @@ chatbot_submit_button = config["chatbot_submit_button"]
40
  chatbot_reset_button = config["chatbot_reset_button"]
41
 
42
  # Check if the configuration parameters are set correctly
43
- if not all([header_message, title, description,
44
  chatbot_input_label, chatbot_input_placeholder,
45
  chatbot_output_label, chatbot_output_placeholder,
46
  chatbot_submit_button, chatbot_reset_button]):
@@ -76,5 +77,7 @@ iface = gr.Interface(fn=chatbot,
76
  theme="default",
77
  live=True)
78
 
 
79
  if __name__ == "__main__":
80
- iface.launch()
 
 
6
  This script sets up a Gradio interface to host an AI chatbot using RAG (Retrieval-Augmented Generation)
7
  to provide responses to user queries. Response API from OpenAI is used for both retrieval and generation of responses.
8
  """
9
+
10
  # Vector store ID for the retrieval of knowledge base documents
11
  # Load the vector store ID from the environment variable
12
+ vector_store_id = "vs_67d49daee8e881918b6abd6f28bfffea" #os.getenv('VECTOR_STORE_ID')
13
 
14
  # Check if the VECTOR_STORE_ID environment variable is set
15
  if not vector_store_id:
 
41
  chatbot_reset_button = config["chatbot_reset_button"]
42
 
43
  # Check if the configuration parameters are set correctly
44
+ if not all([title, description,
45
  chatbot_input_label, chatbot_input_placeholder,
46
  chatbot_output_label, chatbot_output_placeholder,
47
  chatbot_submit_button, chatbot_reset_button]):
 
77
  theme="default",
78
  live=True)
79
 
80
+
81
  if __name__ == "__main__":
82
+ iface.launch(share=True,
83
+ server_name="HMC CIS IT Helpdesk")
config/gradio_config.json CHANGED
@@ -8,7 +8,4 @@
8
  "chatbot_output_placeholder": "The AI assistant will respond here",
9
  "chatbot_submit_button": "Ask",
10
  "chatbot_reset_button": "Reset"
11
- }
12
- // This JSON file contains configuration settings for a Gradio chatbot interface.
13
- // It includes settings for the header message, title, description, input and output labels,
14
- // placeholders, and button labels.
 
8
  "chatbot_output_placeholder": "The AI assistant will respond here",
9
  "chatbot_submit_button": "Ask",
10
  "chatbot_reset_button": "Reset"
11
+ }
 
 
 
utils/__pycache__/response_manager.cpython-310.pyc ADDED
Binary file (2.58 kB). View file
 
utils/response_manager.py CHANGED
@@ -38,10 +38,10 @@ class ResponseManager:
38
  # Load the meta prompt from the text file
39
  # This message is used to provide context for the AI model
40
  meta_prompt_file = 'config/meta_prompt.txt'
41
- if not os.path.exists(developer_message_file):
42
  raise FileNotFoundError(f"Meta prompt file '{meta_prompt_file}' not found.")
43
  with open(meta_prompt_file, 'r') as file:
44
- self.meta_prompt_file = file.read().strip()
45
 
46
  def create_response(self, query, model: str= "gpt-4o-mini",
47
  temperature=0, max_output_tokens=800,
@@ -57,7 +57,7 @@ class ResponseManager:
57
  :return: The response text from the OpenAI API.
58
  """
59
  if self.previous_response_id is None:
60
- input=[{"role": "developer", "content": self.developer_message},
61
  {"role": "user", "content": query}]
62
  else:
63
  input=[{"role": "user", "content": query}]
 
38
  # Load the meta prompt from the text file
39
  # This message is used to provide context for the AI model
40
  meta_prompt_file = 'config/meta_prompt.txt'
41
+ if not os.path.exists(meta_prompt_file):
42
  raise FileNotFoundError(f"Meta prompt file '{meta_prompt_file}' not found.")
43
  with open(meta_prompt_file, 'r') as file:
44
+ self.meta_prompt = file.read().strip()
45
 
46
  def create_response(self, query, model: str= "gpt-4o-mini",
47
  temperature=0, max_output_tokens=800,
 
57
  :return: The response text from the OpenAI API.
58
  """
59
  if self.previous_response_id is None:
60
+ input=[{"role": "developer", "content": self.meta_prompt},
61
  {"role": "user", "content": query}]
62
  else:
63
  input=[{"role": "user", "content": query}]