Kaung Myat Htet commited on
Commit
e53dab7
·
1 Parent(s): 7ba9a7d
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -14,6 +14,16 @@ def format_docs(docs):
14
  return "\n\n".join(doc.page_content for doc in docs)
15
 
16
 
 
 
 
 
 
 
 
 
 
 
17
  prompt = ChatPromptTemplate.from_messages([
18
  ('system',
19
  "You are a KCE chatbot, and you are assisting customers with the inquires about the company."
@@ -31,12 +41,6 @@ rag_chain = (
31
  | StrOutputParser()
32
  )
33
 
34
-
35
- embeddings = OpenAIEmbeddings()
36
- db = FAISS.load_local("faiss_index", embeddings, allow_dangerous_deserialization=True)
37
-
38
- llm = ChatOpenAI(model="gpt-3.5-turbo-0125")
39
-
40
  def chat_gen(message, history):
41
  history_openai_format = []
42
  for human, assistant in history:
 
14
  return "\n\n".join(doc.page_content for doc in docs)
15
 
16
 
17
+
18
+
19
+
20
+ embeddings = OpenAIEmbeddings()
21
+ db = FAISS.load_local("faiss_index", embeddings, allow_dangerous_deserialization=True)
22
+ retriever = db.as_retriever(k=3)
23
+
24
+
25
+ llm = ChatOpenAI(model="gpt-3.5-turbo-0125")
26
+
27
  prompt = ChatPromptTemplate.from_messages([
28
  ('system',
29
  "You are a KCE chatbot, and you are assisting customers with the inquires about the company."
 
41
  | StrOutputParser()
42
  )
43
 
 
 
 
 
 
 
44
  def chat_gen(message, history):
45
  history_openai_format = []
46
  for human, assistant in history: