Update question.py
Browse files- question.py +3 -1
question.py
CHANGED
@@ -66,6 +66,8 @@ def chat_with_doc(model, vector_store: SupabaseVectorStore, stats_db):
|
|
66 |
# print(st.session_state['max_tokens'])
|
67 |
endpoint_url = ("https://api-inference.huggingface.co/models/"+ model)
|
68 |
model_kwargs = {"temperature" : st.session_state['temperature'],
|
|
|
|
|
69 |
"max_new_tokens" : st.session_state['max_tokens'],
|
70 |
"return_full_text" : False}
|
71 |
hf = HuggingFaceEndpoint(
|
@@ -74,7 +76,7 @@ def chat_with_doc(model, vector_store: SupabaseVectorStore, stats_db):
|
|
74 |
huggingfacehub_api_token=hf_api_key,
|
75 |
model_kwargs=model_kwargs
|
76 |
)
|
77 |
-
qa = ConversationalRetrievalChain.from_llm(hf, retriever=vector_store.as_retriever(search_kwargs={"score_threshold": 0.
|
78 |
|
79 |
st.session_state['chat_history'].append(("You", question))
|
80 |
|
|
|
66 |
# print(st.session_state['max_tokens'])
|
67 |
endpoint_url = ("https://api-inference.huggingface.co/models/"+ model)
|
68 |
model_kwargs = {"temperature" : st.session_state['temperature'],
|
69 |
+
"min_p" : 0.1,
|
70 |
+
"top_p" : 0.9,
|
71 |
"max_new_tokens" : st.session_state['max_tokens'],
|
72 |
"return_full_text" : False}
|
73 |
hf = HuggingFaceEndpoint(
|
|
|
76 |
huggingfacehub_api_token=hf_api_key,
|
77 |
model_kwargs=model_kwargs
|
78 |
)
|
79 |
+
qa = ConversationalRetrievalChain.from_llm(hf, retriever=vector_store.as_retriever(search_kwargs={"score_threshold": 0.5, "k": 5,"filter": {"user": st.session_state["username"]}}), memory=memory, verbose=True, return_source_documents=True)
|
80 |
|
81 |
st.session_state['chat_history'].append(("You", question))
|
82 |
|