Update main.py
Browse files
main.py
CHANGED
|
@@ -41,7 +41,7 @@ os.environ['HUGGINGFACEHUB_API_TOKEN'] = os.environ['HUGGINGFACEHUB_API_TOKEN']
|
|
| 41 |
repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
| 42 |
|
| 43 |
model = HuggingFaceEndpoint(
|
| 44 |
-
repo_id=repo_id, max_new_tokens=
|
| 45 |
)
|
| 46 |
os.environ['PINECONE_API_KEY'] = os.environ['PINECONE_API_KEY']
|
| 47 |
embeddings = HuggingFaceEmbeddings()
|
|
@@ -183,11 +183,10 @@ async def on_message(message: cl.Message):
|
|
| 183 |
|
| 184 |
await cl.Message(content=answer).send()
|
| 185 |
search = vectorstore.similarity_search(message.content,k=50, filter={"categorie": {"$eq": "bibliographie-OPP-DGDIN"}})
|
| 186 |
-
if search:
|
| 187 |
test = []
|
| 188 |
sources_text = ""
|
| 189 |
count = 0
|
| 190 |
-
search = cl.user_session.get("search")
|
| 191 |
for i in range(0,len(search)):
|
| 192 |
if search[i].metadata['Lien'] not in test:
|
| 193 |
if count <= 15:
|
|
|
|
| 41 |
repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
| 42 |
|
| 43 |
model = HuggingFaceEndpoint(
|
| 44 |
+
repo_id=repo_id, max_new_tokens=5500, temperature=1.0, task="text2text-generation", streaming=True
|
| 45 |
)
|
| 46 |
os.environ['PINECONE_API_KEY'] = os.environ['PINECONE_API_KEY']
|
| 47 |
embeddings = HuggingFaceEmbeddings()
|
|
|
|
| 183 |
|
| 184 |
await cl.Message(content=answer).send()
|
| 185 |
search = vectorstore.similarity_search(message.content,k=50, filter={"categorie": {"$eq": "bibliographie-OPP-DGDIN"}})
|
| 186 |
+
if len(search) > 0:
|
| 187 |
test = []
|
| 188 |
sources_text = ""
|
| 189 |
count = 0
|
|
|
|
| 190 |
for i in range(0,len(search)):
|
| 191 |
if search[i].metadata['Lien'] not in test:
|
| 192 |
if count <= 15:
|