feat: + uml fork style role demo

This commit is contained in:
莘权 马 2023-08-07 21:12:27 +08:00
parent 80a189ad4a
commit 5702aaa5ad
11 changed files with 543 additions and 128 deletions

View file

@ -0,0 +1,40 @@
# Pattern Configuration Template
# Created By: mashenquan, 2023-8-7
# File Name: template.yaml
# This template defines a set of structural standards for generating roles and action flows based on configurations.
# For more about UML 2.0 activity diagrams, see: `https://www.uml-diagrams.org/activity-diagrams.html`
# project settings
startup:
requirement: "TeachingPlanRequirement" # Defines project initial requirement action
role: "Teacher" # Defines project role
investment: 3.0 # Defines the max project investment
n_round: 1 # Defines the max project round count
# roles settings
roles: # A project can involve multiple roles.
- role_type: "fork" # `fork` type role corresponds to the functional positioning of the `fork` node in UML 2.0 activity diagrams.
name: "Lily"
profile: "{teaching_language} Teacher"
goal: "writing a {language} teaching plan part by part"
constraints: "writing in {language}"
role: "You are a {teaching_language} Teacher, named Lily, your goal is ..."
desc: ""
output_filename: "teaching_plan_demo.md"
requirement: ["TeachingPlanRequirement"]
templates: # The template provides a convenient way to generate prompts. After each action selects its respective template, you only need to provide the corresponding variable values. Variable replacement is automatically handled by the framework.
- "Do ..."
- "Do ..."
# role's action settings
actions: # A role can have multiple actions.
- name: ""
topic: "Title"
language: "Chinese"
statements: # When replacing template variables, multiple statements will be joined into a single string using line breaks.
- "Statement: Find and return ..."
template_ix: 0
rsp_begin_tag: "[..._BEGIN]" # When asking, request the LLM to include the tag in the response. It's optional.
rsp_end_tag: "[..._END]" # When asking, request the LLM to include the tag in the response. It's optional.

View file

@ -1,51 +1,124 @@
# `fork` role demo
- role_type: "fork"
# The `fork` role demo implements the flow of the code in `examples/write_teaching_plan.py`.
# project settings
startup:
requirement: "TeachingPlanRequirement" # Defines project initial requirement action
role: "Teacher"
investment: 3.0
n_round: 1
# roles settings
roles: # A project can involve multiple roles.
- role_type: "fork" # `fork` type role corresponds to the functional positioning of the `fork` node in UML 2.0 activity diagrams.
name: "Lily"
profile: "{teaching_language} Teacher"
goal: "writing a {language} teaching plan part by part"
constraints: "writing in {language}"
role: "You are a {teaching_language} Teacher, named Lily, your goal is writing a {teaching_language} teaching plan part by part, and the constraint is writing in {language}."
desc: ""
actions:
output_filename: "teaching_plan_demo.md"
requirement: ["TeachingPlanRequirement"]
templates: # The template provides a convenient way to generate prompts. After each action selects its respective template, you only need to provide the corresponding variable values. Variable replacement is automatically handled by the framework.
- "Do not refer to the context of the previous conversation records, start the conversation anew.\n\nFormation: \"Capacity and role\" defines the role you are currently playing;\n\t\"[LESSON_BEGIN]\" and \"[LESSON_END]\" tags enclose the content of textbook;\n\t\"Statement\" defines the work detail you need to complete at this stage;\n\t\"Answer options\" defines the format requirements for your responses;\n\t\"Constraint\" defines the conditions that your responses must comply with.\n\n{statements}\nConstraint: Writing in {language}.\nAnswer options: Encloses the lesson title with \"[TEACHING_PLAN_BEGIN]\" and \"[TEACHING_PLAN_END]\" tags.\n[LESSON_BEGIN]\n{lesson}\n[LESSON_END]"
- "Do not refer to the context of the previous conversation records, start the conversation anew.\n\nFormation: \"Capacity and role\" defines the role you are currently playing;\n\t\"[LESSON_BEGIN]\" and \"[LESSON_END]\" tags enclose the content of textbook;\n\t\"Statement\" defines the work detail you need to complete at this stage;\n\t\"Answer options\" defines the format requirements for your responses;\n\t\"Constraint\" defines the conditions that your responses must comply with.\n\nCapacity and role: {role}\nStatement: Write the \"{topic}\" part of teaching plan, WITHOUT ANY content unrelated to \"{topic}\"!!\n{statements}\nAnswer options: Enclose the teaching plan content with \"[TEACHING_PLAN_BEGIN]\" and \"[TEACHING_PLAN_END]\" tags.\nAnswer options: Using proper markdown format from second-level header format.\nConstraint: Writing in {language}.\n[LESSON_BEGIN]\n{lesson}\n[LESSON_END]"
actions: # 一个role可以有多个action
- name: ""
topic: "Title"
language: "Chinese"
statements:
- "Statement: Find and return the title of the lesson only in markdown first-level header format, without anything else."
statements: # When replacing template variables, multiple statements will be joined into a single string using line breaks.
- "Statement: Find and return the title of the lesson only with \"# \" prefixed, without anything else."
template_ix: 0
- name: ""
topic: "Teaching Hours"
language: "Chinese"
statements: []
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]" # When asking, request the LLM to include the tag in the response. It's optional.
rsp_end_tag: "[TEACHING_PLAN_END]" # When asking, request the LLM to include the tag in the response. It's optional.
- name: ""
topic: "Teaching Objectives"
language: "Chinese"
statements: []
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]"
rsp_end_tag: "[TEACHING_PLAN_END]"
- name: ""
topic: "Teaching Content"
language: "Chinese"
statements:
- "Statement: \"Teaching Content\" must include vocabulary, analysis, and examples of various grammar structures that appear in the textbook, as well as the listening materials and key points."
- "Statement: \"Teaching Content\" must include more examples."
- name: ""
topic: "Teaching Time Allocation"
language: "Chinese"
statements:
- "Statement: \"Teaching Time Allocation\" must include how much time is allocated to each part of the textbook content."
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]"
rsp_end_tag: "[TEACHING_PLAN_END]"
- name: ""
topic: "Teaching Methods and Strategies"
language: "Chinese"
statements:
- "Statement: \"Teaching Methods and Strategies\" must include teaching focus, difficulties, materials, procedures, in detail."
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]"
rsp_end_tag: "[TEACHING_PLAN_END]"
- name: ""
topic: "Learning Activities"
language: "Chinese"
statements: []
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]"
rsp_end_tag: "[TEACHING_PLAN_END]"
- name: ""
topic: "Teaching Time Allocation"
language: "Chinese"
statements:
- "Statement: \"Teaching Time Allocation\" must include how much time is allocated to each part of the textbook content."
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]"
rsp_end_tag: "[TEACHING_PLAN_END]"
- name: ""
topic: "Assessment and Feedback"
language: "Chinese"
statements: []
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]"
rsp_end_tag: "[TEACHING_PLAN_END]"
- name: ""
topic: "Teaching Summary and Improvement"
language: "Chinese"
statements: []
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]"
rsp_end_tag: "[TEACHING_PLAN_END]"
- name: ""
topic: "Vocabulary Cloze"
language: "Chinese"
statements:
- "Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", create vocabulary cloze. The cloze should include 10 {language} questions with {teaching_language} answers, and it should also include 10 {teaching_language} questions with {language} answers. The key-related vocabulary and phrases in the textbook content must all be included in the exercises."
- name: ""
topic: "Grammar Questions"
language: "Chinese"
statements:
- "Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", create grammar questions. 10 questions."
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]"
rsp_end_tag: "[TEACHING_PLAN_END]"
- name: ""
topic: "Choice Questions"
language: "Chinese"
statements:
- "Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", create choice questions. 10 questions."
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]"
rsp_end_tag: "[TEACHING_PLAN_END]"
- name: ""
topic: "Grammar Questions"
language: "Chinese"
statements:
- "Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", create grammar questions. 10 questions."
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]"
rsp_end_tag: "[TEACHING_PLAN_END]"
- name: ""
topic: "Translation Questions"
language: "Chinese"
statements:
- "Statement: Based on the content of the textbook enclosed by \"[LESSON_BEGIN]\" and \"[LESSON_END]\", create translation questions. The translation should include 10 {language} questions with {teaching_language} answers, and it should also include 10 {teaching_language} questions with {language} answers."
template_ix: 1
rsp_begin_tag: "[TEACHING_PLAN_BEGIN]"
rsp_end_tag: "[TEACHING_PLAN_END]"