-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (26 loc) · 835 Bytes
/
app.py
File metadata and controls
33 lines (26 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
Application streamlit pour rechercher dans la base de données vectorielle.
"""
import rag_core as core
import inference
from langchain_core.messages import HumanMessage
def main():
while True:
inp = input("Requête (q pour quitter) : ")
if inp.lower() == "q":
break
docs = core.query(inp, 3)
print(docs, "\n\n")
for chunk in inference.chat(
[HumanMessage(content="Je cherche des infos sur la linguistique")]
):
if isinstance(chunk, str):
print(
f'\nAfficher un spinner, recherche avec la query "{chunk}"',
end="\n",
flush=True,
)
else:
print(chunk.content, end="", flush=True)
if __name__ == "__main__":
main()