Spaces:
Runtime error
Runtime error
this
Browse files
app.py
CHANGED
|
@@ -10,35 +10,35 @@ palm.configure(api_key=os.environ["PALM_KEY"])
|
|
| 10 |
# model = 'models/text-bison-001'
|
| 11 |
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
# * if intent = viewing user's notes return = "view_notes"
|
| 44 |
# * if intent = viewing user's posts return = "view_posts"
|
|
@@ -74,24 +74,36 @@ palm.configure(api_key=os.environ["PALM_KEY"])
|
|
| 74 |
def responsenew(data):
|
| 75 |
print(data)
|
| 76 |
# contxxt = f"""
|
| 77 |
-
|
| 78 |
# """
|
| 79 |
|
| 80 |
# response = palm.chat( messages=data)
|
| 81 |
-
intent = palm.chat(
|
| 82 |
messages=f"""
|
| 83 |
|
| 84 |
Identify the user's intent from text_data below:\n
|
| 85 |
Arguments: text_data = {data}\n\n
|
| 86 |
Return the intent as one-word string representing the user's intent, as mentioned below:
|
| 87 |
-
*
|
| 88 |
-
*
|
| 89 |
-
*
|
| 90 |
-
*
|
| 91 |
-
*
|
| 92 |
-
*
|
| 93 |
-
*
|
| 94 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
| 96 |
""",
|
| 97 |
)
|
|
|
|
| 10 |
# model = 'models/text-bison-001'
|
| 11 |
|
| 12 |
|
| 13 |
+
contx = """Act as a friendly personal assistant.
|
| 14 |
+
You help users manage their daily tasks by providing them with a variety of features.
|
| 15 |
+
Below are the list of features you have: \n
|
| 16 |
+
- You can create goals\n
|
| 17 |
+
- You can share goals with friends\n
|
| 18 |
+
- You can create reminders\n
|
| 19 |
+
- You can create routines\n
|
| 20 |
+
- You can share reminders with users friends\n
|
| 21 |
+
- You can share routines with users friends\n
|
| 22 |
+
- You can create todo lists\n
|
| 23 |
+
- You can share todo lists with users friends\n
|
| 24 |
+
- You can create groups\n
|
| 25 |
+
- You can share groups with users friends\n
|
| 26 |
+
- You can create communities\n
|
| 27 |
+
- You can create notes for user\n
|
| 28 |
+
- You can share notes with users friends\n
|
| 29 |
+
- You can publish posts on timeline\n
|
| 30 |
+
- You can invite friends to this(CosmoAI) app\n
|
| 31 |
+
- You can help users purchase coins\n
|
| 32 |
+
- You can view your friends\n
|
| 33 |
+
- You can view your groups\n
|
| 34 |
+
- You can view your communities\n
|
| 35 |
+
- You can view your shared reminders\n
|
| 36 |
+
- You can view your shared routines\n
|
| 37 |
+
- You can view your todo lists\n
|
| 38 |
+
- You can view your shared todo lists\n
|
| 39 |
+
- You can view your shared notes\n
|
| 40 |
+
- You can start a timer or a stopwatch\n\n"""
|
| 41 |
+
|
| 42 |
|
| 43 |
# * if intent = viewing user's notes return = "view_notes"
|
| 44 |
# * if intent = viewing user's posts return = "view_posts"
|
|
|
|
| 74 |
def responsenew(data):
|
| 75 |
print(data)
|
| 76 |
# contxxt = f"""
|
| 77 |
+
|
| 78 |
# """
|
| 79 |
|
| 80 |
# response = palm.chat( messages=data)
|
| 81 |
+
intent = palm.chat(context = contx,
|
| 82 |
messages=f"""
|
| 83 |
|
| 84 |
Identify the user's intent from text_data below:\n
|
| 85 |
Arguments: text_data = {data}\n\n
|
| 86 |
Return the intent as one-word string representing the user's intent, as mentioned below:
|
| 87 |
+
* if intent = viewing user's notes return = "view_notes"
|
| 88 |
+
* if intent = viewing user's posts return = "view_posts"
|
| 89 |
+
* if intent = viewing user's shared notes return = "view_shared_notes"
|
| 90 |
+
* if intent = viewing user's todo lists return = "view_todo_lists"
|
| 91 |
+
* if intent = viewing user's shared todo lists return = "view_shared_todo_lists"
|
| 92 |
+
* if intent = viewing user's shared routines return = "view_shared_routines"
|
| 93 |
+
* if intent = creating a goal return = "create_goal"
|
| 94 |
+
* if intent = creating a reminder return = "create_reminder"
|
| 95 |
+
* if intent = creating a routine return = "create_routine"
|
| 96 |
+
* if intent = creating a group return = "create_group"
|
| 97 |
+
* if intent = creating a community return = "create_community"
|
| 98 |
+
* if intent = creating a note return = "create_note"
|
| 99 |
+
* if intent = creating a post return = "create_post"
|
| 100 |
+
* if intent = creating a todo list return = "create_todo_list"
|
| 101 |
+
* if intent = sharing a reminder return = "share_reminder"
|
| 102 |
+
* if intent = sharing a routine return = "share_routine"
|
| 103 |
+
* if intent = sharing a group return = "share_group"
|
| 104 |
+
* if intent = sharing a todo list return = "share_todo_list"
|
| 105 |
+
* if intent = sharing a note return = "share_note"
|
| 106 |
+
* if intent = what is your name or who are you return = "cosmo_name"
|
| 107 |
|
| 108 |
""",
|
| 109 |
)
|