mitulagr2 commited on
Commit
6ef431c
·
1 Parent(s): fd96c29

Update rag.py

Browse files
Files changed (1) hide show
  1. app/rag.py +6 -6
app/rag.py CHANGED
@@ -16,15 +16,15 @@ class ChatPDF:
16
 
17
  def __init__(self):
18
  self.model = ChatOllama(model="qwen:1.8b")
19
- self.text_splitter = RecursiveCharacterTextSplitter(chunk_size=128, chunk_overlap=16)
20
  self.prompt = PromptTemplate.from_template(
21
  """
22
- You are an assistant for question-answering tasks. Use the following pieces of retrieved context to
23
  answer the question. If you don't know the answer, just say that you don't know. Use three sentences
24
- maximum and keep the answer concise.
25
- Question: {question}
26
  Context: {context}
27
- Answer:
28
  """
29
  )
30
 
@@ -37,7 +37,7 @@ class ChatPDF:
37
  self.retriever = vector_store.as_retriever(
38
  search_type="similarity_score_threshold",
39
  search_kwargs={
40
- "k": 240,
41
  "score_threshold": 0.5,
42
  },
43
  )
 
16
 
17
  def __init__(self):
18
  self.model = ChatOllama(model="qwen:1.8b")
19
+ self.text_splitter = RecursiveCharacterTextSplitter(chunk_size=2048, chunk_overlap=128)
20
  self.prompt = PromptTemplate.from_template(
21
  """
22
+ <|im_start|> You are an assistant for question-answering tasks. Use the following pieces of retrieved context to
23
  answer the question. If you don't know the answer, just say that you don't know. Use three sentences
24
+ maximum and keep the answer concise. <|im_end|>
25
+ <|im_start|> Question: {question}
26
  Context: {context}
27
+ Answer: <|im_end|>
28
  """
29
  )
30
 
 
37
  self.retriever = vector_store.as_retriever(
38
  search_type="similarity_score_threshold",
39
  search_kwargs={
40
+ "k": 8,
41
  "score_threshold": 0.5,
42
  },
43
  )