Skip to content

Commit 7729f55

Browse files
author
Jicheng Lu
committed
refine rule trigger code prompt
1 parent 1733e4f commit 7729f55

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102

103103
<None Remove="data\agents\c2a2faf6-b8b5-47fe-807b-f4714cf25dd4\agent.json" />
104104
<None Remove="data\agents\c2a2faf6-b8b5-47fe-807b-f4714cf25dd4\instructions\instruction.liquid" />
105-
<None Remove="data\agents\c2a2faf6-b8b5-47fe-807b-f4714cf25dd4\templates\rule-code-generate_instruction.liquid" />
105+
<None Remove="data\agents\c2a2faf6-b8b5-47fe-807b-f4714cf25dd4\templates\rule-trigger-code-generate_instruction.liquid" />
106106

107107
<None Remove="data\agents\dfd9b46d-d00c-40af-8a75-3fbdc2b89869\agent.json" />
108108
<None Remove="data\agents\dfd9b46d-d00c-40af-8a75-3fbdc2b89869\instructions\instruction.liquid" />
@@ -225,7 +225,7 @@
225225
<Content Include="data\agents\c2a2faf6-b8b5-47fe-807b-f4714cf25dd4\instructions\instruction.liquid">
226226
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
227227
</Content>
228-
<Content Include="data\agents\c2a2faf6-b8b5-47fe-807b-f4714cf25dd4\templates\rule-code-generate_instruction.liquid">
228+
<Content Include="data\agents\c2a2faf6-b8b5-47fe-807b-f4714cf25dd4\templates\rule-trigger-code-generate_instruction.liquid">
229229
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
230230
</Content>
231231

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ Based on user's request, help generate a refined python code of function definit
33
User's request is {{user_request}}
44

55
Couple of notes to address:
6-
1. You need to generate a function named check_trigger_criterion(args), where input is a json object. The example of this json object is {{states_example}}.
7-
2. The input to this function comes from the arguments. You must use "ArgumentParser" to take "states" as an argument, and then use "parse_known_args" to get the raw args.
6+
1. You need to generate a function named check_trigger_criterion(args), where input is a json object. The example of this json object is {{args_example}}.
7+
2. The input to this function comes from the arguments. You must use "ArgumentParser" to take an argument named "states", and then use "parse_known_args" to get the raw args.
88
3. After getting the raw args, you need to use 'clean_args = bytes(raw_args, "utf-8").decode("unicode_escape")' to clean the raw argument, and then use 'args = json.loads(clean_args)' to get the json args.
9-
4. Based on the user's request and input args, the output of this function must be True or False.
9+
4. Based on the user's request and input args, generate the function logic and ONLY return a boolean value.
1010
5. You must only call check_trigger_criterion with the parsed json args in "if __name__ == '__main__'" block, and print only the function output. If any error occurs, print "Error".
11-
6. Refine the code so it will return for certain errors if detected, for example, when input is not a valid json, return "Error: Input is not a valid JSON string."; If "states" not in data: return "Error: Missing 'states' key in JSON."; or when certain states are missing from input, so I can better track of this.
11+
6. Refine the code so it will return for certain errors if detected, for example, when input is not a valid json, return "Error: Input is not a valid JSON string."; or when certain attributes are missing from json args, so I can better track of this.
12+
7. You can use try-except blocks to catch any errors, and return "Error" if any error occurs. Do not use sys.exit(0) to exit the program.
13+
8. Use as fewer comments and try-except blocks as possible.
1214

13-
Output the code directly in order to directly save it to a py file. Avoid using comments for format issues, use code snip block for the output.
15+
Output the executable code directly in order to directly save it to a py file.

0 commit comments

Comments
 (0)