From d61cd1ab6419af40b4a54571ee88a6ce96dea3f3 Mon Sep 17 00:00:00 2001 From: Guillaume David Date: Tue, 8 Oct 2024 09:33:51 +0200 Subject: [PATCH] First variation --- .DS_Store | Bin 0 -> 8196 bytes .gitignore | 4 + README.md | 9 ++ rasa/.DS_Store | Bin 0 -> 6148 bytes rasa/actions/__init__.py | 0 .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 177 bytes .../__pycache__/actions.cpython-38.pyc | Bin 0 -> 1231 bytes rasa/actions/actions.py | 25 ++++ rasa/config.yml | 50 ++++++++ rasa/credentials.yml | 33 ++++++ rasa/data/nlu.yml | 110 ++++++++++++++++++ rasa/data/rules.yml | 13 +++ rasa/data/stories.yml | 43 +++++++ rasa/domain.yml | 41 +++++++ rasa/endpoints.yml | 45 +++++++ rasa/tests/test_stories.yml | 91 +++++++++++++++ requirements.txt | 5 + 17 files changed, 469 insertions(+) create mode 100644 .DS_Store create mode 100644 .gitignore create mode 100644 rasa/.DS_Store create mode 100644 rasa/actions/__init__.py create mode 100644 rasa/actions/__pycache__/__init__.cpython-38.pyc create mode 100644 rasa/actions/__pycache__/actions.cpython-38.pyc create mode 100644 rasa/actions/actions.py create mode 100644 rasa/config.yml create mode 100644 rasa/credentials.yml create mode 100644 rasa/data/nlu.yml create mode 100644 rasa/data/rules.yml create mode 100644 rasa/data/stories.yml create mode 100644 rasa/domain.yml create mode 100644 rasa/endpoints.yml create mode 100644 rasa/tests/test_stories.yml create mode 100644 requirements.txt diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..b6d401b64ef3020df96b196dafcc132eb08ae92b GIT binary patch literal 8196 zcmeHMU2GIp6uxI#=$$D)w^*Q4T)J98CeSr`YHJYfzpeDYE0e=!nG?ExYH1c2?BPRMF#ut6?!T8_{o;!E8*%s=94~D?p zWbV1=@6McazcY95EFlCsa(W{nRfG_V7pJToyE`83;2FW+2Q!n1L_@cS8nn&*qIzv+oOS*oPSiGjLyKfWIH2cyS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ec?tI`M}gj-zPGePRI}6BH%b Y{`U_7;r`E8=gvP>!~I{oU-tih0F|FxeE&gAqt2Be@_Aac9&?AE~rI)^1k2je*N8#W_hF0PV+XrrI+eq`}*KV*7{d9L^DNYQLO{_1uX#Bx!C=T@;l&z&TpzvnP#w2R4!jD#$fZ{8jvl5{@2WOC z!=+``Ic6pX1^5GlmC6RC7X?HCQDCG1&kqqAV{EZ7sHYBedJ6yy;MRs?-b-*zWHGi_ z7(@i7OexTmD!au{rX2pr=EW8ZgQlF69vRoMBP+W@QF?UvBb`nvHYmL)APV>jESl2_ zum8LA_y2y8oQVRWz`s&J1&wB-j$5*8>(tHhS{tDqqp@*bVNjQ#v&*qQ;H8-VSI~x7 X#0S9GVqp*-nEVjXGDs&1{Hg+9alX62 literal 0 HcmV?d00001 diff --git a/rasa/actions/__init__.py b/rasa/actions/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rasa/actions/__pycache__/__init__.cpython-38.pyc b/rasa/actions/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..79821860c5ec89e4a134052ca18639b83151294d GIT binary patch literal 177 zcmWIL<>g`kf*;l2(m?cM5P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;x_mettoTenx(7 zYEn^ZxqeP&l72yDNk)F2v7Uu~ab`)XZb4#lc4B&Jv3^lvaiV^5PNsflUS>&VVorQP sQGQlxa*2Loa!F=>Ua@|BJV+)!Uaz3?7Kcr4eoARhsvXF_&p^xo07qLcrvLx| literal 0 HcmV?d00001 diff --git a/rasa/actions/__pycache__/actions.cpython-38.pyc b/rasa/actions/__pycache__/actions.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6b5a89e1468dbf5bd061bfa59a47aaf440f2c768 GIT binary patch literal 1231 zcmb_bJ#P~+7`E>tcTH3EgLXh-=)ltD4h9y45EVjIB@{tJRdkDG&L*7dOH$iuAi&h_ z`~?{Elkm#KU#J*(UtdE*#ef8s?0a7O{dnGwJ6u_56IegKM*a5zA>U9~ToDM5V4J6K z2qLH=H7zJb9H^iUi_qgxMMVU6p^A%mkBCUb=S0Mko`ppV%@8FT_ zP}kZmZ8aPKN_uK&d(w7Gd|F&Ut)X!XfFuPKqzD8R!8s{H5sC=D5E9(B+-l>mCkNt5 z%_~*X1y6`^KZb2EIYGfF=oahTvtS0ym_)l7nNb%Rsb1?C6#a2=KR+~5o4h}+l;Y!B z3VvFNobBzu$b0wL?!leAx#ouFjXN{{W}|m58t_^!VPH&$(COwirWq=f$ZEbYFj{!J zw*gonEP}J()7r=AL-d)7@C!8Kh}lO7Q2)&%!@JCW~?5Hu|nKo>}1SU^P(|Fy@|)KQa1==X{-nWA1kG4=x_dM zNY)y%d(s|BZXxHto05&Dt*kFCn>2C18HBjd+U14|JQGgf3aSMW4d`X z;Sw|2-hH;eU2>(QXlrbhUd7|8z@8))eGB$gA1|l!sx%okQlrv>v3KJ=+=Peqxd-1J zyxB=zia!D~;#gw=-0ED+" +# secret: "" +# page-access-token: "" + +#slack: +# slack_token: "" +# slack_channel: "" +# slack_signing_secret: "" + +#socketio: +# user_message_evt: +# bot_message_evt: +# session_persistence: + +#mattermost: +# url: "https:///api/v4" +# token: "" +# webhook_url: "" + +# This entry is needed if you are using Rasa Enterprise. The entry represents credentials +# for the Rasa Enterprise "channel", i.e. Talk to your bot and Share with guest testers. +rasa: + url: "http://localhost:5002/api" diff --git a/rasa/data/nlu.yml b/rasa/data/nlu.yml new file mode 100644 index 0000000..53a5262 --- /dev/null +++ b/rasa/data/nlu.yml @@ -0,0 +1,110 @@ +version: "3.1" + +nlu: +- intent: greet + examples: | + - hey + - hello + - hi + - hello there + - good morning + - good evening + - moin + - hey there + - let's go + - hey dude + - goodmorning + - goodevening + - good afternoon + +- intent: goodbye + examples: | + - cu + - good by + - cee you later + - good night + - bye + - goodbye + - have a nice day + - see you around + - bye bye + - see you later + +- intent: affirm + examples: | + - yes + - y + - indeed + - of course + - that sounds good + - correct + +- intent: deny + examples: | + - no + - n + - never + - I don't think so + - don't like that + - no way + - not really + +- intent: mood_great + examples: | + - perfect + - great + - amazing + - feeling like a king + - wonderful + - I am feeling very good + - I am great + - I am amazing + - I am going to save the world + - super stoked + - extremely good + - so so perfect + - so good + - so perfect + +- intent: mood_unhappy + examples: | + - my day was horrible + - I am sad + - I don't feel very well + - I am disappointed + - super sad + - I'm so sad + - sad + - very sad + - unhappy + - not good + - not very good + - extremly sad + - so saad + - so sad + +- intent: bot_challenge + examples: | + - are you a bot? + - are you a human? + - am I talking to a bot? + - am I talking to a human? + + +- intent: send_email + examples: | + - Envoie-moi un email + - Je veux envoyer un mail + - Peux-tu envoyer un email ? + - Envoie un mail à mon ami + - Pourrais-tu m'envoyer un email ? + - Fais un mail + +- intent: get_weather + examples: | + - Quelle est la météo ? + - Récupère la météo + - Donne-moi la météo + - Quel temps fait-il ? + - Quelle est la météo pour aujourd'hui ? + - Quel temps fait-il à Paris ? \ No newline at end of file diff --git a/rasa/data/rules.yml b/rasa/data/rules.yml new file mode 100644 index 0000000..a9987ee --- /dev/null +++ b/rasa/data/rules.yml @@ -0,0 +1,13 @@ +version: "3.1" + +rules: + +- rule: Say goodbye anytime the user says goodbye + steps: + - intent: goodbye + - action: utter_goodbye + +- rule: Say 'I am a bot' anytime the user challenges + steps: + - intent: bot_challenge + - action: utter_iamabot diff --git a/rasa/data/stories.yml b/rasa/data/stories.yml new file mode 100644 index 0000000..45b72db --- /dev/null +++ b/rasa/data/stories.yml @@ -0,0 +1,43 @@ +version: "3.1" + +stories: + +- story: happy path + steps: + - intent: greet + - action: utter_greet + - intent: mood_great + - action: utter_happy + +- story: sad path 1 + steps: + - intent: greet + - action: utter_greet + - intent: mood_unhappy + - action: utter_cheer_up + - action: utter_did_that_help + - intent: affirm + - action: utter_happy + +- story: sad path 2 + steps: + - intent: greet + - action: utter_greet + - intent: mood_unhappy + - action: utter_cheer_up + - action: utter_did_that_help + - intent: deny + - action: utter_goodbye + + +- story: Envoie un email + steps: + - intent: send_email + - action: action_send_email + +- story: Récupère la météo + steps: + - intent: get_weather + - action: action_get_weather + + diff --git a/rasa/domain.yml b/rasa/domain.yml new file mode 100644 index 0000000..636af27 --- /dev/null +++ b/rasa/domain.yml @@ -0,0 +1,41 @@ +version: "3.1" + +intents: + - greet + - goodbye + - affirm + - deny + - mood_great + - mood_unhappy + - bot_challenge + - send_email + - get_weather + +actions: + - action_send_email + - action_get_weather + +responses: + utter_greet: + - text: "Salut ! Comment puis-je t'aider aujourd'hui ?" + + utter_cheer_up: + - text: "Here is something to cheer you up:" + image: "https://i.imgur.com/nGF1K8f.jpg" + + utter_did_that_help: + - text: "Did that help you?" + + utter_happy: + - text: "Great, carry on!" + + utter_goodbye: + - text: "Bye" + + utter_iamabot: + - text: "I am a bot, powered by Rasa." + +session_config: + session_expiration_time: 60 + carry_over_slots_to_new_session: true + diff --git a/rasa/endpoints.yml b/rasa/endpoints.yml new file mode 100644 index 0000000..5827834 --- /dev/null +++ b/rasa/endpoints.yml @@ -0,0 +1,45 @@ +action_endpoint: + url: "http://localhost:5055/webhook" + +# This file contains the different endpoints your bot can use. + +# Server where the models are pulled from. +# https://rasa.com/docs/rasa/model-storage#fetching-models-from-a-server + +#models: +# url: http://my-server.com/models/default_core@latest +# wait_time_between_pulls: 10 # [optional](default: 100) + +# Server which runs your custom actions. +# https://rasa.com/docs/rasa/custom-actions + +#action_endpoint: +# url: "http://localhost:5055/webhook" + +# Tracker store which is used to store the conversations. +# By default the conversations are stored in memory. +# https://rasa.com/docs/rasa/tracker-stores + +#tracker_store: +# type: redis +# url: +# port: +# db: +# password: +# use_ssl: + +#tracker_store: +# type: mongod +# url: +# db: +# username: +# password: + +# Event broker which all conversation events should be streamed to. +# https://rasa.com/docs/rasa/event-brokers + +#event_broker: +# url: localhost +# username: username +# password: password +# queue: queue diff --git a/rasa/tests/test_stories.yml b/rasa/tests/test_stories.yml new file mode 100644 index 0000000..d46e39b --- /dev/null +++ b/rasa/tests/test_stories.yml @@ -0,0 +1,91 @@ +#### This file contains tests to evaluate that your bot behaves as expected. +#### If you want to learn more, please see the docs: https://rasa.com/docs/rasa/testing-your-assistant + +stories: +- story: happy path 1 + steps: + - user: | + hello there! + intent: greet + - action: utter_greet + - user: | + amazing + intent: mood_great + - action: utter_happy + +- story: happy path 2 + steps: + - user: | + hello there! + intent: greet + - action: utter_greet + - user: | + amazing + intent: mood_great + - action: utter_happy + - user: | + bye-bye! + intent: goodbye + - action: utter_goodbye + +- story: sad path 1 + steps: + - user: | + hello + intent: greet + - action: utter_greet + - user: | + not good + intent: mood_unhappy + - action: utter_cheer_up + - action: utter_did_that_help + - user: | + yes + intent: affirm + - action: utter_happy + +- story: sad path 2 + steps: + - user: | + hello + intent: greet + - action: utter_greet + - user: | + not good + intent: mood_unhappy + - action: utter_cheer_up + - action: utter_did_that_help + - user: | + not really + intent: deny + - action: utter_goodbye + +- story: sad path 3 + steps: + - user: | + hi + intent: greet + - action: utter_greet + - user: | + very terrible + intent: mood_unhappy + - action: utter_cheer_up + - action: utter_did_that_help + - user: | + no + intent: deny + - action: utter_goodbye + +- story: say goodbye + steps: + - user: | + bye-bye! + intent: goodbye + - action: utter_goodbye + +- story: bot challenge + steps: + - user: | + are you a bot? + intent: bot_challenge + - action: utter_iamabot diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..bd5f046 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +rasa +fastapi +uvicorn +smtplib +pymilvus \ No newline at end of file