Update main.py
Browse files
main.py
CHANGED
@@ -53,29 +53,6 @@ async def Retriever(categorie):
|
|
53 |
retriever = vectorstore.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": .7, "k": 250,"filter": {"title": {"$eq": "videos-table-rondeia"}, "time": {"$gte": 1320}}})
|
54 |
return retriever
|
55 |
|
56 |
-
@cl.step(type="tool")
|
57 |
-
async def OtherRequest(answer):
|
58 |
-
schema = {
|
59 |
-
"properties": {
|
60 |
-
"Questions en relation avec le contexte": {"type": "string"},
|
61 |
-
},
|
62 |
-
"required": ["Questions en relation avec le contexte"],
|
63 |
-
}
|
64 |
-
llm = await LLMistral()
|
65 |
-
chainExtraction = create_extraction_chain(schema, llm)
|
66 |
-
dataframe = chainExtraction.invoke(GoogleTranslator(source='auto', target='fr').translate(answer))
|
67 |
-
actRequest = dataframe['text']
|
68 |
-
df_actRequest = pd.DataFrame(actRequest)
|
69 |
-
allRequest = pd.DataFrame(df_actRequest['Questions en relation avec le contexte'])
|
70 |
-
allRequest.drop_duplicates(keep = 'first', inplace=True)
|
71 |
-
allRequestArray = allRequest.values.tolist()
|
72 |
-
RequestArray = []
|
73 |
-
for act in allRequestArray:
|
74 |
-
RequestArray.append(cl.Starter(label=act[0], message=act[0], icon="/public/request-theme.svg",),)
|
75 |
-
print(RequestArray)
|
76 |
-
await cl.Message(content=RequestArray).send()
|
77 |
-
|
78 |
-
|
79 |
@cl.step(type="embedding")
|
80 |
async def Search(input, categorie):
|
81 |
vectorstore = await VectorDatabase(categorie)
|
@@ -191,8 +168,6 @@ async def on_message(message: cl.Message):
|
|
191 |
|
192 |
await cl.Message(content=GoogleTranslator(source='auto', target='fr').translate(answer)).send()
|
193 |
|
194 |
-
await OtherRequest(answer)
|
195 |
-
|
196 |
search = await Search(message.content, "videosTC")
|
197 |
|
198 |
sources = [
|
|
|
53 |
retriever = vectorstore.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": .7, "k": 250,"filter": {"title": {"$eq": "videos-table-rondeia"}, "time": {"$gte": 1320}}})
|
54 |
return retriever
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
@cl.step(type="embedding")
|
57 |
async def Search(input, categorie):
|
58 |
vectorstore = await VectorDatabase(categorie)
|
|
|
168 |
|
169 |
await cl.Message(content=GoogleTranslator(source='auto', target='fr').translate(answer)).send()
|
170 |
|
|
|
|
|
171 |
search = await Search(message.content, "videosTC")
|
172 |
|
173 |
sources = [
|