mitulagr2 commited on
Commit
ce047d8
·
1 Parent(s): 889a629

Update rag.py

Browse files
Files changed (1) hide show
  1. app/rag.py +4 -4
app/rag.py CHANGED
@@ -26,7 +26,7 @@ class ChatPDF:
26
  pdf_count = 0
27
 
28
  def __init__(self):
29
- self.text_parser = SentenceSplitter(chunk_size=128, chunk_overlap=8)
30
 
31
  logger.info("initializing the vector store related objects")
32
  # client = QdrantClient(host="localhost", port=6333)
@@ -45,9 +45,9 @@ class ChatPDF:
45
  llm = LlamaCPP(
46
  model_url="https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF/resolve/main/qwen2-0_5b-instruct-fp16.gguf",
47
  temperature=0.1,
48
- max_new_tokens=256,
49
  # context_window=3900, #32k
50
- generate_kwargs={"max_tokens": 256, "temperature": 0.1, "top_k": 12},
51
  # model_kwargs={"n_gpu_layers": -1},
52
  # messages_to_prompt=self.messages_to_prompt,
53
  # completion_to_prompt=self.completion_to_prompt,
@@ -103,7 +103,7 @@ class ChatPDF:
103
 
104
  self.query_engine = index.as_query_engine(
105
  streaming=True,
106
- similarity_top_k=12,
107
  )
108
 
109
  def ask(self, query: str):
 
26
  pdf_count = 0
27
 
28
  def __init__(self):
29
+ self.text_parser = SentenceSplitter(chunk_size=1024, chunk_overlap=24)
30
 
31
  logger.info("initializing the vector store related objects")
32
  # client = QdrantClient(host="localhost", port=6333)
 
45
  llm = LlamaCPP(
46
  model_url="https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF/resolve/main/qwen2-0_5b-instruct-fp16.gguf",
47
  temperature=0.1,
48
+ max_new_tokens=128,
49
  # context_window=3900, #32k
50
+ generate_kwargs={"max_tokens": 128, "temperature": 0.1, "top_k": 3},
51
  # model_kwargs={"n_gpu_layers": -1},
52
  # messages_to_prompt=self.messages_to_prompt,
53
  # completion_to_prompt=self.completion_to_prompt,
 
103
 
104
  self.query_engine = index.as_query_engine(
105
  streaming=True,
106
+ similarity_top_k=3,
107
  )
108
 
109
  def ask(self, query: str):