Update main.py
Browse files
main.py
CHANGED
|
@@ -42,8 +42,8 @@ model = HuggingFaceEndpoint(
|
|
| 42 |
repo_id=repo_id, max_new_tokens=5000, temperature=1.0, task="text2text-generation", streaming=True
|
| 43 |
)
|
| 44 |
os.environ['PINECONE_API_KEY'] = os.environ['PINECONE_API_KEY']
|
| 45 |
-
|
| 46 |
-
|
| 47 |
#pc = Pinecone(
|
| 48 |
# api_key=os.environ['PINECONE_API_KEY']
|
| 49 |
#)
|
|
@@ -53,10 +53,10 @@ os.environ['PINECONE_API_KEY'] = os.environ['PINECONE_API_KEY']
|
|
| 53 |
#context = ""
|
| 54 |
#for result in xc['matches']:
|
| 55 |
# context = context + result['metadata']['text']
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
|
| 61 |
@cl.on_chat_start
|
| 62 |
async def on_chat_start():
|
|
|
|
| 42 |
repo_id=repo_id, max_new_tokens=5000, temperature=1.0, task="text2text-generation", streaming=True
|
| 43 |
)
|
| 44 |
os.environ['PINECONE_API_KEY'] = os.environ['PINECONE_API_KEY']
|
| 45 |
+
embeddings = HuggingFaceEmbeddings()
|
| 46 |
+
index_name = "all-venus"
|
| 47 |
#pc = Pinecone(
|
| 48 |
# api_key=os.environ['PINECONE_API_KEY']
|
| 49 |
#)
|
|
|
|
| 53 |
#context = ""
|
| 54 |
#for result in xc['matches']:
|
| 55 |
# context = context + result['metadata']['text']
|
| 56 |
+
vectorstore = PineconeVectorStore(
|
| 57 |
+
index_name=index_name, embedding=embeddings
|
| 58 |
+
)
|
| 59 |
+
retriever = vectorstore.as_retriever(search_type="similarity_score_threshold", search_kwargs={"score_threshold": .7, "k": 150,"filter": {'categorie': {'$eq': 'bibliographie-OPP-DGDIN'}}})
|
| 60 |
|
| 61 |
@cl.on_chat_start
|
| 62 |
async def on_chat_start():
|