MilanM commited on
Commit
5aecae9
·
verified ·
1 Parent(s): b11bb36

Update fallback_template.py

Browse files
Files changed (1) hide show
  1. fallback_template.py +63 -52
fallback_template.py CHANGED
@@ -1,54 +1,65 @@
1
  fallback_template = {
2
- "function_name": "deployable_function",
3
- "function_code": """def your_function_name():
4
- def score(input_data):
5
- original_string = input_data.get("input_data")[0].get("values")[0][0]
6
- append_string = input_data.get("input_data")[0].get("values")[0][1]
7
-
8
- hello_world_message = "Hello World + {0}".format(original_string)
9
- concatenated_string = original_string + append_string
10
-
11
- score_response = {
12
- 'predictions': [{'fields': ['Response_message_field', 'Random_appended_string'],
13
- 'values': [[hello_world_message, concatenated_string]]
14
- }]
15
- }
16
- return score_response
17
- return score""",
18
- "use_cases": ["add_tags"],
19
- "input_schema": [
20
- {
21
- "id": "1",
22
- "type": "struct",
23
- "fields": [
24
- {
25
- "name": "<variable name 1>",
26
- "type": "string",
27
- "nullable": False,
28
- "metadata": {},
29
- },
30
- {
31
- "name": "<variable name 2>",
32
- "type": "string",
33
- "nullable": False,
34
- "metadata": {},
35
- },
36
- ],
37
- }
38
- ],
39
- "output_schema": [
40
- {
41
- "id": "1",
42
- "type": "struct",
43
- "fields": [
44
- {
45
- "name": "<output return name>",
46
- "type": "string",
47
- "nullable": False,
48
- "metadata": {},
49
- }
50
- ],
51
- }
52
- ],
53
- "dependencies": ["<library_to_add>"],
 
 
 
 
 
 
 
 
 
 
 
54
  }
 
1
  fallback_template = {
2
+ "id": "7bcc0723c4dca96f0a25a8babdb13a05",
3
+ "key": "7bcc0723c4dca96f0a25a8babdb13a05",
4
+ "value": {
5
+ "rev": "2-6b19a5f38c311dfe11977294434d5cdf"
6
+ },
7
+ "doc": {
8
+ "_id": "7bcc0723c4dca96f0a25a8babdb13a05",
9
+ "_rev": "2-6b19a5f38c311dfe11977294434d5cdf",
10
+ "filename": "deployable_function_your_function_name.py",
11
+ "text": "def your_function_name():\n def score(input_data):\n original_string = input_data.get(\"input_data\")[0].get(\"values\")[0][0]\n append_string = input_data.get(\"input_data\")[0].get(\"values\")[0][1]\n \n hello_world_message = \"Hello World + {0}\".format(original_string)\n concatenated_string = original_string + append_string\n \n score_response = {\n 'predictions': [{'fields': ['response_message_field', 'random_appended_string'],\n 'values': [[hello_world_message, concatenated_string]]\n }]\n }\n return score_response\n return score\n score = your_function_name()",
12
+ "score_assignment": "score = your_function_name()",
13
+ "input_schema": [
14
+ {
15
+ "id": "1",
16
+ "type": "struct",
17
+ "fields": [
18
+ {
19
+ "name": "response_message_field",
20
+ "type": "string",
21
+ "nullable": False,
22
+ "metadata": {}
23
+ },
24
+ {
25
+ "name": "random_appended_string",
26
+ "type": "string",
27
+ "nullable": False,
28
+ "metadata": {}
29
+ }
30
+ ]
31
+ }
32
+ ],
33
+ "output_schema": [
34
+ {
35
+ "id": "1",
36
+ "type": "struct",
37
+ "fields": [
38
+ {
39
+ "name": "hello_world_message",
40
+ "type": "string",
41
+ "nullable": False,
42
+ "metadata": {}
43
+ },
44
+ {
45
+ "name": "concatenated_string",
46
+ "type": "string",
47
+ "nullable": False,
48
+ "metadata": {}
49
+ }
50
+ ]
51
+ }
52
+ ],
53
+ "dependencies": [
54
+ "<library_to_add>",
55
+ "<library_to_add>"
56
+ ],
57
+ "function_name": "your_function_name",
58
+ "category": "base_template",
59
+ "prompt_template": "{text}",
60
+ "use_cases": [
61
+ "add_tags"
62
+ ],
63
+ "type": "wx.ai Deployable Python Function"
64
+ }
65
  }