Sandaruth commited on
Commit
26e663a
1 Parent(s): 12d9740
Files changed (2) hide show
  1. app.py +3 -3
  2. model.py +18 -1
app.py CHANGED
@@ -28,7 +28,7 @@ def chatbot_response(user_input): # Open AI GPT-3 and Google T5
28
 
29
  def main():
30
  print_colorful_msg("Starting chatbot main function ...", color='blue')
31
- st.title("Simple Chatbot")
32
 
33
  user_input = st.text_input("Enter your message:")
34
  if st.button("Send"):
@@ -45,8 +45,8 @@ def main():
45
  st.markdown("### Source Documents:")
46
  if source_documents:
47
  for doc in source_documents:
48
- # pass
49
- st.write(doc)
50
  else:
51
  st.write("No source documents found.")
52
 
 
28
 
29
  def main():
30
  print_colorful_msg("Starting chatbot main function ...", color='blue')
31
+ st.title("ATrad Chatbot")
32
 
33
  user_input = st.text_input("Enter your message:")
34
  if st.button("Send"):
 
45
  st.markdown("### Source Documents:")
46
  if source_documents:
47
  for doc in source_documents:
48
+ pass
49
+ # st.write(doc)
50
  else:
51
  st.write("No source documents found.")
52
 
model.py CHANGED
@@ -4,6 +4,8 @@ from dotenv import load_dotenv
4
  # Load environment variables from .env file
5
  load_dotenv()
6
 
 
 
7
  # Access the value of OPENAI_API_KEY
8
  OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
9
 
@@ -12,11 +14,18 @@ os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
12
  from langchain_openai import ChatOpenAI
13
 
14
  llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0,)
 
 
 
15
  ## Create embeddings and splitter
16
 
17
  from langchain.embeddings import HuggingFaceBgeEmbeddings
18
  from langchain.text_splitter import RecursiveCharacterTextSplitter
19
 
 
 
 
 
20
  # Create Embeddings
21
  model_name = "BAAI/bge-large-en"
22
 
@@ -32,12 +41,18 @@ splitter = RecursiveCharacterTextSplitter(
32
  chunk_overlap=100,
33
  )
34
 
 
 
 
35
  from langchain_community.vectorstores import FAISS
36
 
37
  persits_directory="./faiss_Test02_500_C_BGE_large"
38
 
39
  vectorstore= FAISS.load_local(persits_directory, embedding)
40
 
 
 
 
41
  # Define a custom prompt for Unser manual
42
  from langchain.prompts import PromptTemplate
43
 
@@ -52,7 +67,7 @@ qa_template = ("""
52
  if context is not enough to answer the question, ask for more information.
53
  if context is not related to the question, say I dont know.
54
 
55
- each answer should start with code word ATrad Ai(QA):
56
 
57
  Question: {question}
58
 
@@ -69,6 +84,8 @@ qa_template2 = ("""
69
 
70
  Question: {question}
71
 
 
 
72
  ATrad Ai(QA): Let me think about it...""")
73
 
74
 
 
4
  # Load environment variables from .env file
5
  load_dotenv()
6
 
7
+
8
+
9
  # Access the value of OPENAI_API_KEY
10
  OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
11
 
 
14
  from langchain_openai import ChatOpenAI
15
 
16
  llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0,)
17
+
18
+
19
+
20
  ## Create embeddings and splitter
21
 
22
  from langchain.embeddings import HuggingFaceBgeEmbeddings
23
  from langchain.text_splitter import RecursiveCharacterTextSplitter
24
 
25
+
26
+
27
+
28
+
29
  # Create Embeddings
30
  model_name = "BAAI/bge-large-en"
31
 
 
41
  chunk_overlap=100,
42
  )
43
 
44
+
45
+
46
+
47
  from langchain_community.vectorstores import FAISS
48
 
49
  persits_directory="./faiss_Test02_500_C_BGE_large"
50
 
51
  vectorstore= FAISS.load_local(persits_directory, embedding)
52
 
53
+
54
+
55
+
56
  # Define a custom prompt for Unser manual
57
  from langchain.prompts import PromptTemplate
58
 
 
67
  if context is not enough to answer the question, ask for more information.
68
  if context is not related to the question, say I dont know.
69
 
70
+ each answer Must start with code word ATrad Ai(QA):
71
 
72
  Question: {question}
73
 
 
84
 
85
  Question: {question}
86
 
87
+ each answer Must start with code word ATrad Ai(QA):
88
+
89
  ATrad Ai(QA): Let me think about it...""")
90
 
91