Ludovicollin commited on
Commit
0b7237e
·
verified ·
1 Parent(s): b3dfacf

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +8 -12
main.py CHANGED
@@ -54,7 +54,7 @@ os.environ['OPENAI_API_KEY'] = os.environ['OPENAI_API_KEY']
54
 
55
  @cl.author_rename
56
  def rename(orig_author: str):
57
- rename_dict = {"ConversationalRetrievalChain": "💬 Assistant conversationnel", "Retriever": "Agent conversationnel", "StuffDocumentsChain": "Chaîne de documents", "LLMChain": "Agent", "ChatOpenAI": "IA🤖"}
58
  return rename_dict.get(orig_author, orig_author)
59
 
60
  @cl.action_callback("download")
@@ -73,7 +73,7 @@ async def on_action(action):
73
  ),
74
  ]
75
  await cl.Message(
76
- author="🌐🌐🌐", content="[Lien] 🔗", elements=elements
77
  ).send()
78
  await action.remove()
79
 
@@ -99,13 +99,9 @@ async def on_action(action):
99
  others = [
100
  cl.Action(name="close_button", value="closed", label="Fermer", description="Fermer le volet d'information!")
101
  ]
102
- await cl.Message(author="🌐🌐🌐",content="Fermer le panneau d'information", actions=others).send()
103
-
104
- @cl.cache
105
- def to_cache(file):
106
- return "https://cipen.univ-gustave-eiffel.fr/fileadmin/CIPEN/datas/assets/docs/" + file + ".csv"
107
 
108
- @cl.cache
109
  def retriever_to_cache():
110
  os.environ['PINECONE_API_KEY'] = os.environ['PINECONE_API_KEY']
111
  os.environ['PINECONE_ENVIRONMENT'] = "us-west4-gcp-free"
@@ -137,7 +133,7 @@ async def start():
137
  welcomeUserStr = welcomeUserArray[0].replace('.',' ')
138
  await cl.Message(f"> Bonjour {welcomeUserStr}").send()
139
  await cl.Message(
140
- author="🌐🌐🌐",content=f"Commencez à poser vos questions sur les données \"{chat_profile}\"\n\n💡Voici des exemples de question \n\t1️⃣ Basée sur les formations : Quelles sont toutes les formations licences générales?\n\t2️⃣ Basée sur les compétences : Quelles sont les compétences de la licence Economie et gestion?\n\t3️⃣ Basée sur les métiers : Quels sont les métiers possibles de la licence Economie et gestion?\n\t4️⃣ Basée sur un souhait : Quelles formations si je veux travailler dans la vente?\n\t5️⃣ Basée sur un savoir-être : Quelles formations si j'aime travailler en équipe?\n\t6️⃣ Basée sur un état : Quelles formations si je suis créatif?\n\t7️⃣ Question multi-critère : Quelles sont les activités, les compétences et les métiers possibles de la licence Economie et gestion?"
141
  ).send()
142
 
143
  from langchain_core.prompts.prompt import PromptTemplate
@@ -203,8 +199,8 @@ async def main(message: cl.Message):
203
  cl.Action(name="download", value="Question : " + message.content + "\n\nRéponse : " + answer, description="download_offre_formation")
204
  ]
205
 
206
- await cl.Message(author="🌐🌐🌐",content=answer).send()
207
- await cl.Message(author="🌐🌐🌐",content="Download", actions=actions).send()
208
 
209
  if metadatas:
210
- await cl.Message(author="🌐🌐🌐",content="Sources : " + metadatas, elements=text_elements).send()
 
54
 
55
  @cl.author_rename
56
  def rename(orig_author: str):
57
+ rename_dict = {"Datapccskillstream": "Datapcc", "ConversationalRetrievalChain": "Assistant conversationnel 💬", "Retriever": "Agent conversationnel", "StuffDocumentsChain": "Chaîne de documents", "LLMChain": "Agent", "ChatOpenAI": "IA🤖"}
58
  return rename_dict.get(orig_author, orig_author)
59
 
60
  @cl.action_callback("download")
 
73
  ),
74
  ]
75
  await cl.Message(
76
+ author="Datapcc 🌐🌐🌐", content="[Lien] 🔗", elements=elements
77
  ).send()
78
  await action.remove()
79
 
 
99
  others = [
100
  cl.Action(name="close_button", value="closed", label="Fermer", description="Fermer le volet d'information!")
101
  ]
102
+ await cl.Message(author="Datapcc 🌐🌐🌐",content="Fermer le panneau d'information", actions=others).send()
 
 
 
 
103
 
104
+ @cl.step(type="retrieval")
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"
 
133
  welcomeUserStr = welcomeUserArray[0].replace('.',' ')
134
  await cl.Message(f"> Bonjour {welcomeUserStr}").send()
135
  await cl.Message(
136
+ author="Datapcc 🌐🌐🌐",content=f"Commencez à poser vos questions sur les données \"{chat_profile}\"\n- Création de BCC à partir d'une liste de savoirs ou d'objectifs pédagogiques\n- Création du tableau de la version n°1 de la maquette de formation"
137
  ).send()
138
 
139
  from langchain_core.prompts.prompt import PromptTemplate
 
199
  cl.Action(name="download", value="Question : " + message.content + "\n\nRéponse : " + answer, description="download_offre_formation")
200
  ]
201
 
202
+ await cl.Message(author="Datapcc 🌐🌐🌐",content=answer).send()
203
+ await cl.Message(author="Datapcc 🌐🌐🌐",content="Download", actions=actions).send()
204
 
205
  if metadatas:
206
+ await cl.Message(author="Datapcc 🌐🌐🌐",content="Sources : " + metadatas, elements=text_elements).send()