Update app.py
Browse files
app.py
CHANGED
@@ -71,6 +71,8 @@ from qdrant_client.models import (
|
|
71 |
MultiVectorConfig
|
72 |
)
|
73 |
|
|
|
|
|
74 |
class Question(BaseModel):
|
75 |
answer: str
|
76 |
schema = pyjson.dumps(Question.model_json_schema())
|
@@ -252,7 +254,8 @@ def main(query: str, client: QdrantClient, collection_name: str, llm, dense_mode
|
|
252 |
prompt = open_query_prompt(past_messages, query)
|
253 |
answer = gen_text(prompt, max_tokens=300, sampling_params=SamplingParams(temperature=0.6, top_p=0.9, top_k=10))
|
254 |
else:
|
255 |
-
|
|
|
256 |
prompt = idk(query)
|
257 |
answer = gen_text(prompt, max_tokens=128, sampling_params=SamplingParams(temperature=0.6, top_p=0.9, top_k=10))
|
258 |
print(f'TYPE: {type(answer)}')
|
@@ -552,11 +555,13 @@ def load_models_and_documents():
|
|
552 |
|
553 |
def on_change_documents_only():
|
554 |
if st.session_state.documents_only:
|
|
|
555 |
st.session_state.toggle_docs = {
|
556 |
'tooltip': 'The AI answer your questions only considering the documents provided',
|
557 |
'display': True
|
558 |
}
|
559 |
else:
|
|
|
560 |
st.session_state.toggle_docs = {
|
561 |
'tooltip': """The AI answer your questions considering the documents provided, and if it doesn't found the answer in them, try to find in its own internal knowledge""",
|
562 |
'display': False
|
|
|
71 |
MultiVectorConfig
|
72 |
)
|
73 |
|
74 |
+
global_state_documents_only = None
|
75 |
+
|
76 |
class Question(BaseModel):
|
77 |
answer: str
|
78 |
schema = pyjson.dumps(Question.model_json_schema())
|
|
|
254 |
prompt = open_query_prompt(past_messages, query)
|
255 |
answer = gen_text(prompt, max_tokens=300, sampling_params=SamplingParams(temperature=0.6, top_p=0.9, top_k=10))
|
256 |
else:
|
257 |
+
print(f'GLOBAL STATE : {global_state_documents_only}')
|
258 |
+
if global_state_documents_only:
|
259 |
prompt = idk(query)
|
260 |
answer = gen_text(prompt, max_tokens=128, sampling_params=SamplingParams(temperature=0.6, top_p=0.9, top_k=10))
|
261 |
print(f'TYPE: {type(answer)}')
|
|
|
555 |
|
556 |
def on_change_documents_only():
|
557 |
if st.session_state.documents_only:
|
558 |
+
global_state_documents_only = True
|
559 |
st.session_state.toggle_docs = {
|
560 |
'tooltip': 'The AI answer your questions only considering the documents provided',
|
561 |
'display': True
|
562 |
}
|
563 |
else:
|
564 |
+
global_state_documents_only = False
|
565 |
st.session_state.toggle_docs = {
|
566 |
'tooltip': """The AI answer your questions considering the documents provided, and if it doesn't found the answer in them, try to find in its own internal knowledge""",
|
567 |
'display': False
|