Spaces:
Sleeping
Sleeping
fix token bug by refreshing bdd when getting sources
Browse files
app.py
CHANGED
|
@@ -58,8 +58,6 @@ qdrants = {
|
|
| 58 |
if tab != "Presse"
|
| 59 |
}
|
| 60 |
|
| 61 |
-
bdd_presse = get_vectorstore("presse")
|
| 62 |
-
|
| 63 |
## Load Prompts
|
| 64 |
print("Loading Prompts")
|
| 65 |
chat_qa_prompts, chat_reformulation_prompts, chat_summarize_memory_prompts = {}, {}, {}
|
|
@@ -206,7 +204,7 @@ def answer_questions(*questions_sources, config=config):
|
|
| 206 |
]
|
| 207 |
|
| 208 |
|
| 209 |
-
def get_sources(questions, qdrants=qdrants,
|
| 210 |
k = config["num_document_retrieved"]
|
| 211 |
min_similarity = config["min_similarity"]
|
| 212 |
formated = []
|
|
@@ -260,8 +258,9 @@ def get_sources(questions, qdrants=qdrants, bdd_presse=bdd_presse, config=config
|
|
| 260 |
return formated, text
|
| 261 |
|
| 262 |
|
| 263 |
-
def retrieve_sources(*questions, qdrants=qdrants,
|
| 264 |
-
|
|
|
|
| 265 |
|
| 266 |
return (formated_sources, *text_sources)
|
| 267 |
|
|
|
|
| 58 |
if tab != "Presse"
|
| 59 |
}
|
| 60 |
|
|
|
|
|
|
|
| 61 |
## Load Prompts
|
| 62 |
print("Loading Prompts")
|
| 63 |
chat_qa_prompts, chat_reformulation_prompts, chat_summarize_memory_prompts = {}, {}, {}
|
|
|
|
| 204 |
]
|
| 205 |
|
| 206 |
|
| 207 |
+
def get_sources(questions, bdd_presse, qdrants=qdrants, config=config):
|
| 208 |
k = config["num_document_retrieved"]
|
| 209 |
min_similarity = config["min_similarity"]
|
| 210 |
formated = []
|
|
|
|
| 258 |
return formated, text
|
| 259 |
|
| 260 |
|
| 261 |
+
def retrieve_sources(*questions, qdrants=qdrants, config=config):
|
| 262 |
+
bdd_presse = get_vectorstore("presse")
|
| 263 |
+
formated_sources, text_sources = get_sources(questions, bdd_presse, qdrants, config)
|
| 264 |
|
| 265 |
return (formated_sources, *text_sources)
|
| 266 |
|