Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -155,6 +155,9 @@ qa_prompt = ChatPromptTemplate.from_messages(messages)
|
|
155 |
# Define the temperature value in a variable
|
156 |
ai_temp = 0.1
|
157 |
|
|
|
|
|
|
|
158 |
|
159 |
chat_history = []
|
160 |
user_query = ""
|
@@ -271,6 +274,11 @@ def chat_page():
|
|
271 |
st.sidebar.header("Select AI Temperature:")
|
272 |
ai_temp = st.sidebar.slider(label="Temperature", min_value=0.0, max_value=1.0, value=0.0, step=0.1)
|
273 |
|
|
|
|
|
|
|
|
|
|
|
274 |
|
275 |
|
276 |
|
@@ -350,7 +358,7 @@ def chat_page():
|
|
350 |
|
351 |
pdf_qa = ConversationalRetrievalChain.from_llm(
|
352 |
ChatOpenAI(temperature=ai_temp, model_name=selected_model),
|
353 |
-
retriever=vectordb.as_retriever(search_kwargs={'k':
|
354 |
chain_type='stuff',
|
355 |
return_source_documents=True,
|
356 |
verbose=False,
|
@@ -582,7 +590,7 @@ def chat_page():
|
|
582 |
date_string_clean = date_string_clean[:max_length]
|
583 |
|
584 |
# Append the cleaned data to the worksheet
|
585 |
-
data_to_append = [message_clean, answer_clean, date_string, str(ai_temp), st.session_state['session_id'], st.session_state['selected_model']]
|
586 |
|
587 |
|
588 |
|
|
|
155 |
# Define the temperature value in a variable
|
156 |
ai_temp = 0.1
|
157 |
|
158 |
+
# Define the K Value
|
159 |
+
k_value = 14
|
160 |
+
|
161 |
|
162 |
chat_history = []
|
163 |
user_query = ""
|
|
|
274 |
st.sidebar.header("Select AI Temperature:")
|
275 |
ai_temp = st.sidebar.slider(label="Temperature", min_value=0.0, max_value=1.0, value=0.0, step=0.1)
|
276 |
|
277 |
+
|
278 |
+
# Streamlit slider for selecting the value of k
|
279 |
+
st.sidebar.header("Select a K Value for Retrieval:")
|
280 |
+
k_value = st.slider('K Value', min_value=0, max_value=16, value=14)
|
281 |
+
|
282 |
|
283 |
|
284 |
|
|
|
358 |
|
359 |
pdf_qa = ConversationalRetrievalChain.from_llm(
|
360 |
ChatOpenAI(temperature=ai_temp, model_name=selected_model),
|
361 |
+
retriever=vectordb.as_retriever(search_kwargs={'k': k_value}),
|
362 |
chain_type='stuff',
|
363 |
return_source_documents=True,
|
364 |
verbose=False,
|
|
|
590 |
date_string_clean = date_string_clean[:max_length]
|
591 |
|
592 |
# Append the cleaned data to the worksheet
|
593 |
+
data_to_append = [message_clean, answer_clean, date_string, str(ai_temp), st.session_state['session_id'], st.session_state['selected_model'], str(k_value)]
|
594 |
|
595 |
|
596 |
|