Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -101,7 +101,7 @@ async def on_action(action):
|
|
101 |
]
|
102 |
await cl.Message(author="Datapcc 🌐🌐🌐",content="Fermer le panneau d'information", actions=others).send()
|
103 |
|
104 |
-
@cl.
|
105 |
def retriever_to_cache():
|
106 |
os.environ['PINECONE_API_KEY'] = os.environ['PINECONE_API_KEY']
|
107 |
os.environ['PINECONE_ENVIRONMENT'] = "us-west4-gcp-free"
|
@@ -176,7 +176,7 @@ async def main(message: cl.Message):
|
|
176 |
if chatProfile[0] == "OF":
|
177 |
chain = cl.user_session.get("conversation_chain")
|
178 |
cb = cl.AsyncLangchainCallbackHandler()
|
179 |
-
res = await chain.
|
180 |
answer = res["answer"]
|
181 |
source_documents = res["source_documents"]
|
182 |
|
|
|
101 |
]
|
102 |
await cl.Message(author="Datapcc 🌐🌐🌐",content="Fermer le panneau d'information", actions=others).send()
|
103 |
|
104 |
+
@cl.cache
|
105 |
def retriever_to_cache():
|
106 |
os.environ['PINECONE_API_KEY'] = os.environ['PINECONE_API_KEY']
|
107 |
os.environ['PINECONE_ENVIRONMENT'] = "us-west4-gcp-free"
|
|
|
176 |
if chatProfile[0] == "OF":
|
177 |
chain = cl.user_session.get("conversation_chain")
|
178 |
cb = cl.AsyncLangchainCallbackHandler()
|
179 |
+
res = await chain.ainvoke("Contexte : Réponds à la question suivante de la manière la plus pertinente, la plus exhaustive et la plus détaillée possible, avec au minimum 3000 tokens jusqu'à 4000 tokens, seulement et strictement dans le contexte et les informations fournies. Question : " + message.content, callbacks=[cb])
|
180 |
answer = res["answer"]
|
181 |
source_documents = res["source_documents"]
|
182 |
|