Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -21,7 +21,7 @@ os.environ['HUGGINGFACEHUB_API_TOKEN'] = os.environ['HUGGINGFACEHUB_API_TOKEN']
|
|
21 |
repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
22 |
|
23 |
llm = HuggingFaceEndpoint(
|
24 |
-
repo_id=repo_id, max_new_tokens=
|
25 |
)
|
26 |
os.environ['PINECONE_API_KEY'] = os.environ['PINECONE_API_KEY']
|
27 |
embeddings = HuggingFaceEmbeddings()
|
@@ -107,7 +107,7 @@ async def main(message: cl.Message):
|
|
107 |
runnable = cl.user_session.get("runnable")
|
108 |
|
109 |
xq = embeddings.embed_query(message.content)
|
110 |
-
xc = index.query(vector=xq, filter={"categorie": {"$eq": "bibliographie-OPP-DGDIN"}},top_k=
|
111 |
context_p = ""
|
112 |
for result in xc['matches']:
|
113 |
context_p = context_p + result['metadata']['text']
|
|
|
21 |
repo_id = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
22 |
|
23 |
llm = HuggingFaceEndpoint(
|
24 |
+
repo_id=repo_id, max_new_tokens=8000, temperature=1.0, task="text2text-generation", streaming=True
|
25 |
)
|
26 |
os.environ['PINECONE_API_KEY'] = os.environ['PINECONE_API_KEY']
|
27 |
embeddings = HuggingFaceEmbeddings()
|
|
|
107 |
runnable = cl.user_session.get("runnable")
|
108 |
|
109 |
xq = embeddings.embed_query(message.content)
|
110 |
+
xc = index.query(vector=xq, filter={"categorie": {"$eq": "bibliographie-OPP-DGDIN"}},top_k=150, include_metadata=True)
|
111 |
context_p = ""
|
112 |
for result in xc['matches']:
|
113 |
context_p = context_p + result['metadata']['text']
|