Spaces:
Runtime error
Runtime error
this
Browse files
app.py
CHANGED
|
@@ -9,29 +9,36 @@ palm.configure(api_key=os.environ["PALM_KEY"])
|
|
| 9 |
# Select the PaLM 2 model
|
| 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 |
def responsenew(data):
|
| 33 |
print(data)
|
| 34 |
-
contxxt = f"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
You help users manage their daily tasks by providing them with a variety of features.
|
| 36 |
Below are the list of features you have: \n
|
| 37 |
- You can create goals\n
|
|
@@ -61,13 +68,8 @@ def responsenew(data):
|
|
| 61 |
- You can start a timer or a stopwatch\n\n
|
| 62 |
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
"""
|
| 67 |
-
|
| 68 |
-
response = palm.chat( messages=data)
|
| 69 |
-
intent = palm.chat(context = contxxt, messages="""Identify the user's intent from text_data below:\n
|
| 70 |
-
text_data = {data}\n\n
|
| 71 |
Return the intent as one-word string representing the user's intent, one of:
|
| 72 |
* if intent = purchasing coins return = "purchase_coins"
|
| 73 |
* if intent = viewing friends return = "view_friends"
|
|
@@ -78,13 +80,10 @@ def responsenew(data):
|
|
| 78 |
* if intent = viewing all the groups existing on CosmoAI return = "view_all_groups"
|
| 79 |
* if intent = viewing all the communities existing on CosmoAI return = "view_all_communities"
|
| 80 |
|
| 81 |
-
"""
|
|
|
|
| 82 |
print(intent)
|
| 83 |
-
respo = {
|
| 84 |
-
"message": intent.last,
|
| 85 |
-
"action": "nothing",
|
| 86 |
-
"function": "nothing"
|
| 87 |
-
}
|
| 88 |
# if intent.last is not None:
|
| 89 |
# if "purchase_coins" in intent.last:
|
| 90 |
# respo = {
|
|
|
|
| 9 |
# Select the PaLM 2 model
|
| 10 |
# model = 'models/text-bison-001'
|
| 11 |
|
| 12 |
+
# * if intent = viewing user's notes return = "view_notes"
|
| 13 |
+
# * if intent = viewing user's posts return = "view_posts"
|
| 14 |
+
# * if intent = viewing user's shared notes return = "view_shared_notes"
|
| 15 |
+
# * if intent = viewing user's todo lists return = "view_todo_lists"
|
| 16 |
+
# * if intent = viewing user's shared todo lists return = "view_shared_todo_lists"
|
| 17 |
+
# * if intent = viewing user's shared routines return = "view_shared_routines"
|
| 18 |
+
# * if intent = creating a goal return = "create_goal"
|
| 19 |
+
# * if intent = creating a reminder return = "create_reminder"
|
| 20 |
+
# * if intent = creating a routine return = "create_routine"
|
| 21 |
+
# * if intent = creating a group return = "create_group"
|
| 22 |
+
# * if intent = creating a community return = "create_community"
|
| 23 |
+
# * if intent = creating a note return = "create_note"
|
| 24 |
+
# * if intent = creating a post return = "create_post"
|
| 25 |
+
# * if intent = creating a todo list return = "create_todo_list"
|
| 26 |
+
# * if intent = sharing a reminder return = "share_reminder"
|
| 27 |
+
# * if intent = sharing a routine return = "share_routine"
|
| 28 |
+
# * if intent = sharing a group return = "share_group"
|
| 29 |
+
# * if intent = sharing a todo list return = "share_todo_list"
|
| 30 |
+
# * if intent = sharing a note return = "share_note"
|
| 31 |
+
|
| 32 |
|
| 33 |
def responsenew(data):
|
| 34 |
print(data)
|
| 35 |
+
# contxxt = f"""
|
| 36 |
+
|
| 37 |
+
# """
|
| 38 |
+
|
| 39 |
+
# response = palm.chat( messages=data)
|
| 40 |
+
intent = palm.chat(
|
| 41 |
+
messages="""Act as a friendly personal assistant. ".
|
| 42 |
You help users manage their daily tasks by providing them with a variety of features.
|
| 43 |
Below are the list of features you have: \n
|
| 44 |
- You can create goals\n
|
|
|
|
| 68 |
- You can start a timer or a stopwatch\n\n
|
| 69 |
|
| 70 |
|
| 71 |
+
Identify the user's intent from text_data below:\n
|
| 72 |
+
Arguments: text_data = {data}\n\n
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
Return the intent as one-word string representing the user's intent, one of:
|
| 74 |
* if intent = purchasing coins return = "purchase_coins"
|
| 75 |
* if intent = viewing friends return = "view_friends"
|
|
|
|
| 80 |
* if intent = viewing all the groups existing on CosmoAI return = "view_all_groups"
|
| 81 |
* if intent = viewing all the communities existing on CosmoAI return = "view_all_communities"
|
| 82 |
|
| 83 |
+
""",
|
| 84 |
+
)
|
| 85 |
print(intent)
|
| 86 |
+
respo = {"message": intent.last, "action": "nothing", "function": "nothing"}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
# if intent.last is not None:
|
| 88 |
# if "purchase_coins" in intent.last:
|
| 89 |
# respo = {
|