Spaces:
Runtime error
Runtime error
Update rag.py
Browse files- 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=
|
49 |
-
|
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")
|