mitulagr2 commited on
Commit
5529817
1 Parent(s): ce047d8

Update rag.py

Browse files
Files changed (1) hide show
  1. app/rag.py +5 -6
app/rag.py CHANGED
@@ -30,9 +30,9 @@ class ChatPDF:
30
 
31
  logger.info("initializing the vector store related objects")
32
  # client = QdrantClient(host="localhost", port=6333)
33
- client = QdrantClient(url=QDRANT_API_URL, api_key=QDRANT_API_KEY)
34
  self.vector_store = QdrantVectorStore(
35
- client=client,
36
  collection_name="rag_documents",
37
  # enable_hybrid=True
38
  )
@@ -45,10 +45,8 @@ 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=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,
54
  verbose=True,
@@ -113,3 +111,4 @@ class ChatPDF:
113
 
114
  def clear(self):
115
  self.pdf_count = 0
 
 
30
 
31
  logger.info("initializing the vector store related objects")
32
  # client = QdrantClient(host="localhost", port=6333)
33
+ self.client = QdrantClient(url=QDRANT_API_URL, api_key=QDRANT_API_KEY)
34
  self.vector_store = QdrantVectorStore(
35
+ client=self.client,
36
  collection_name="rag_documents",
37
  # enable_hybrid=True
38
  )
 
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
+ generate_kwargs={"max_tokens": 256, "temperature": 0.1, "top_k": 3},
 
 
50
  # messages_to_prompt=self.messages_to_prompt,
51
  # completion_to_prompt=self.completion_to_prompt,
52
  verbose=True,
 
111
 
112
  def clear(self):
113
  self.pdf_count = 0
114
+ self.client.delete(collection_name="rag_documents")