Spaces:
Runtime error
Runtime error
Set restrictions
Browse files- app/rag.py +9 -2
app/rag.py
CHANGED
@@ -15,7 +15,14 @@ class ChatPDF:
|
|
15 |
chain = None
|
16 |
|
17 |
def __init__(self):
|
18 |
-
self.model = ChatOllama(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
self.text_splitter = RecursiveCharacterTextSplitter(chunk_size=2048, chunk_overlap=128)
|
20 |
self.prompt = PromptTemplate.from_template(
|
21 |
"""
|
@@ -37,7 +44,7 @@ class ChatPDF:
|
|
37 |
self.retriever = vector_store.as_retriever(
|
38 |
search_type="similarity_score_threshold",
|
39 |
search_kwargs={
|
40 |
-
"k":
|
41 |
"score_threshold": 0.5,
|
42 |
},
|
43 |
)
|
|
|
15 |
chain = None
|
16 |
|
17 |
def __init__(self):
|
18 |
+
self.model = ChatOllama(
|
19 |
+
model="qwen:1.8b",
|
20 |
+
keep_alive=-1,
|
21 |
+
temperature=0,
|
22 |
+
num_predict=512,
|
23 |
+
repeat_penalty=1.3,
|
24 |
+
)
|
25 |
+
|
26 |
self.text_splitter = RecursiveCharacterTextSplitter(chunk_size=2048, chunk_overlap=128)
|
27 |
self.prompt = PromptTemplate.from_template(
|
28 |
"""
|
|
|
44 |
self.retriever = vector_store.as_retriever(
|
45 |
search_type="similarity_score_threshold",
|
46 |
search_kwargs={
|
47 |
+
"k": 4,
|
48 |
"score_threshold": 0.5,
|
49 |
},
|
50 |
)
|