Pavan178 commited on
Commit
d290cdf
·
verified ·
1 Parent(s): 5099842

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -19,15 +19,17 @@ class AdvancedPdfChatbot:
19
  os.environ["OPENAI_API_KEY"] = openai_api_key
20
  self.embeddings = OpenAIEmbeddings()
21
  self.text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
22
- self.llm = ChatOpenAI(temperature=0,model_name='gpt-4o-mini')
23
 
24
  self.memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
25
  self.qa_chain = None
26
  self.pdf_path = None
27
  self.template = """
28
- Imagine you are a chat assistant for knowledge retrieval, specializing in providing detailed information with a deep understanding of context.
29
- Your goal is to generate responses in a structured format that is both informative and engaging.
30
-
 
 
31
  """
32
  self.prompt = PromptTemplate(template=self.template, input_variables=["context", "question"])
33
 
 
19
  os.environ["OPENAI_API_KEY"] = openai_api_key
20
  self.embeddings = OpenAIEmbeddings()
21
  self.text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
22
+ self.llm = ChatOpenAI(temperature=0.1,model_name='gpt-4o-mini',max_tokens=3000, top_p = 0.1)
23
 
24
  self.memory = ConversationBufferMemory(memory_key="chat_history", return_messages=True)
25
  self.qa_chain = None
26
  self.pdf_path = None
27
  self.template = """
28
+ I want you to act as a chat assistant for research more similar to ChatGPT itself, specifically focusing on knowledge retrieval. Provide detailed responses with great attention to context understanding and structured format. Be specific and detail-oriented in your responses, ensuring accuracy and depth in information provided.
29
+ Note: If you dont know the answer from the given knowledge base say you dont know it, **dont hallucinate**.
30
+ Context: {context}
31
+ Question: {question}
32
+ Answer:
33
  """
34
  self.prompt = PromptTemplate(template=self.template, input_variables=["context", "question"])
35