Yu Chen commited on
Commit
5934674
·
1 Parent(s): 687bbf8

update local prompt type to align with langfuse version

Browse files
src/prompts/grammatical-structure.ts CHANGED
@@ -1,18 +1,14 @@
1
- export const GRAMMATICAL_STRUCTURE_PROMPT = `As an English teacher, your task is to help foreign students better understand grammatical structure in English sentences. To achieve this, please follow these instructions carefully:
 
 
 
2
 
3
  Step 1:
4
  Select a sentence from the provided article.
5
- Ensure the sentence clearly demonstrates an English grammatical structure.
6
  Step 2:
7
  Provide four answer options clearly labeled A, B, C, and D.
8
- Clearly indicate the correct grammatical answer.
9
 
10
- {% if examples %}
11
  Here are some example questions to guide your work:
12
-
13
- {% for example in examples[:5] %}
14
- Example {{ loop.index }}:
15
- Question: {{ example.題幹 }}
16
- Options: {{ example.選項 }}
17
- {% endfor %}
18
- {% endif %}`;
 
1
+ export const GRAMMATICAL_STRUCTURE_PROMPT = `Below is an article:
2
+ {{article}}
3
+
4
+ As an English teacher, your task is to help foreign students better understand grammatical structure in English sentences. To achieve this, please follow these instructions carefully:
5
 
6
  Step 1:
7
  Select a sentence from the provided article.
8
+ - Ensure the sentence clearly demonstrates an English grammatical structure.
9
  Step 2:
10
  Provide four answer options clearly labeled A, B, C, and D.
11
+ - Clearly indicate the correct grammatical answer.
12
 
 
13
  Here are some example questions to guide your work:
14
+ {{examples}}`;
 
 
 
 
 
 
src/prompts/paragraph-details.ts CHANGED
@@ -1,27 +1,8 @@
1
- export const PARAGRAPH_DETAILS_PROMPT = `As an English teacher, your task is to help foreign students better develop their paragraph details in English. These questions should test a student's ability to:
2
- • Understand the main points of the paragraph,
3
- • Identify the key details,
4
- • Apply the details to solve problems or complete tasks.
5
 
6
- To achieve this, please follow the instructions below:
 
7
 
8
- Step 1: Use the current context.
9
- Select or write a sentence from the provided article.
10
-
11
- {% if article %}
12
- Provided article:
13
- {{ article }}
14
- {% endif %}
15
-
16
- Step 2: Provide multiple choices.
17
- Give four answer options clearly labeled A, B, C, and D, with one correct answer. The correct option should not be stated directly in the sentence but should be inferable.
18
-
19
- {% if examples %}
20
  Here are some example questions to guide your work:
21
-
22
- {% for example in examples[:5] %}
23
- Example {{ loop.index }}:
24
- Question: {{ example.題幹 }}
25
- Options: {{ example.選項 }}
26
- {% endfor %}
27
- {% endif %}`;
 
1
+ export const PARAGRAPH_DETAILS_PROMPT = `Below is an article:
2
+ {{article}}
 
 
3
 
4
+ As an English teacher, your task is to test non-native students the details of the paragraph.
5
+ The questions should test a student's ability to identify the key details of the paragraph,
6
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  Here are some example questions to guide your work:
8
+ {{examples}}`;
 
 
 
 
 
 
src/prompts/paragraph-structure.ts CHANGED
@@ -1,7 +1,10 @@
1
- export const PARAGRAPH_STRUCTURE_PROMPT = `As an English teacher, your task is to help foreign students better understand the structure of the paragraph. These questions should test a student's ability to:
2
- • Understand the structure of the paragraph,
3
- • Identify the key details,
4
- • Apply the details to solve problems or complete tasks.
 
 
 
5
 
6
  To achieve this, please follow the instructions below:
7
 
@@ -11,12 +14,6 @@ Select or write a sentence from the provided article.
11
  Step 2: Provide multiple choices.
12
  Give four answer options clearly labeled A, B, C, and D, with one correct answer. The correct option should not be stated directly in the sentence but should be inferable.
13
 
14
- {% if examples %}
15
- Here are some example questions to guide your work:
16
 
17
- {% for example in examples[:5] %}
18
- Example {{ loop.index }}:
19
- Question: {{ example.題幹 }}
20
- Options: {{ example.選項 }}
21
- {% endfor %}
22
- {% endif %}`;
 
1
+ export const PARAGRAPH_STRUCTURE_PROMPT = `Below is an article:
2
+ {{article}}
3
+
4
+ As an English teacher, your task is to help foreign students better understand the structure of the paragraph. These questions should test a student's ability to:
5
+ - Understand the structure of the paragraph
6
+ - Identify the key details
7
+ - Apply the details to solve problems or complete tasks.
8
 
9
  To achieve this, please follow the instructions below:
10
 
 
14
  Step 2: Provide multiple choices.
15
  Give four answer options clearly labeled A, B, C, and D, with one correct answer. The correct option should not be stated directly in the sentence but should be inferable.
16
 
 
 
17
 
18
+ Here are some example questions to guide your work:
19
+ {{examples}}`;
 
 
 
 
src/prompts/paragraph-summary.ts CHANGED
@@ -1,27 +1,8 @@
1
- export const PARAGRAPH_SUMMARY_PROMPT = `As an English teacher, your task is to help foreign students better understand the summary of the paragraph. These questions should test a student's ability to:
2
- • Understand the summary of the paragraph,
3
- • Identify the key details,
4
- • Apply the details to solve problems or complete tasks.
5
 
6
- To achieve this, please follow the instructions below:
 
7
 
8
- Step 1: Use the current context.
9
- Select or write a sentence from the provided article.
10
-
11
- {% if article %}
12
- Provided article:
13
- {{ article }}
14
- {% endif %}
15
-
16
- Step 2: Provide multiple choices.
17
- Give four answer options clearly labeled A, B, C, and D, with one correct answer. The correct option should not be stated directly in the sentence but should be inferable.
18
-
19
- {% if examples %}
20
  Here are some example questions to guide your work:
21
-
22
- {% for example in examples[:5] %}
23
- Example {{ loop.index }}:
24
- Question: {{ example.題幹 }}
25
- Options: {{ example.選項 }}
26
- {% endfor %}
27
- {% endif %}`;
 
1
+ export const PARAGRAPH_SUMMARY_PROMPT = `Below is an article:
2
+ {{article}}
 
 
3
 
4
+ As an English teacher, your task is to test non-native students the summary of the paragraph.
5
+ The questions should test a student's ability to understand the summary of the paragraph,
6
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  Here are some example questions to guide your work:
8
+ {{examples}}`;
 
 
 
 
 
 
src/prompts/prompt-management.ts CHANGED
@@ -11,6 +11,7 @@ import { PARAGRAPH_DETAILS_PROMPT } from './paragraph-details';
11
  import { QUESTION_FORMAT_PROMPT } from './question-format';
12
  import { ARTICLE_FORMAT_PROMPT } from './article-format';
13
  import { ARTICLE_REVISION_PROMPT } from './article-revision';
 
14
 
15
  // Simple interface for prompt parameters
16
  export interface QuizPromptParams extends Record<string, string | number | boolean | string[] | undefined> {
@@ -43,13 +44,14 @@ export const PROMPTS = {
43
  'paragraph-details': PARAGRAPH_DETAILS_PROMPT,
44
  'question-format': QUESTION_FORMAT_PROMPT,
45
  'article-format': ARTICLE_FORMAT_PROMPT,
46
- 'article-revision': ARTICLE_REVISION_PROMPT
 
47
  } as const;
48
 
49
  export type PromptType = keyof typeof PROMPTS;
50
 
51
  // Simple template rendering function
52
- export const renderTemplate = (template: string, params: Record<string, string | number | boolean | string[] | Array<{題幹: string; 選項: string}>>): string => {
53
  let result = template;
54
 
55
  console.log('Template rendering - Input params:', Object.keys(params));
 
11
  import { QUESTION_FORMAT_PROMPT } from './question-format';
12
  import { ARTICLE_FORMAT_PROMPT } from './article-format';
13
  import { ARTICLE_REVISION_PROMPT } from './article-revision';
14
+ import { COMPREHENSIVE_PROMPT } from './comprehensive';
15
 
16
  // Simple interface for prompt parameters
17
  export interface QuizPromptParams extends Record<string, string | number | boolean | string[] | undefined> {
 
44
  'paragraph-details': PARAGRAPH_DETAILS_PROMPT,
45
  'question-format': QUESTION_FORMAT_PROMPT,
46
  'article-format': ARTICLE_FORMAT_PROMPT,
47
+ 'article-revision': ARTICLE_REVISION_PROMPT,
48
+ 'comprehensive': COMPREHENSIVE_PROMPT
49
  } as const;
50
 
51
  export type PromptType = keyof typeof PROMPTS;
52
 
53
  // Simple template rendering function
54
+ export const renderTemplate = (template: string, params: Record<string, string | number | boolean | string[] | Record<string, string>[]>): string => {
55
  let result = template;
56
 
57
  console.log('Template rendering - Input params:', Object.keys(params));
src/prompts/textual-inference.ts CHANGED
@@ -1,7 +1,10 @@
1
- export const TEXTUAL_INFERENCE_PROMPT = `As an English teacher, your task is to help foreign students better develop their textual inference skills in English. These questions should test a student's ability to:
2
- • Understand implied meaning,
3
- • Make logical conclusions,
4
- • Or interpret unstated facts based on the given sentence or short passage.
 
 
 
5
 
6
  To achieve this, please follow the instructions below:
7
 
@@ -11,12 +14,5 @@ Select or write a sentence from the provided article.
11
  Step 2: Provide multiple choices.
12
  Give four answer options clearly labeled A, B, C, and D, with one correct answer. The correct option should not be stated directly in the sentence but should be inferable.
13
 
14
- {% if examples %}
15
  Here are some example questions to guide your work:
16
-
17
- {% for example in examples[:5] %}
18
- Example {{ loop.index }}:
19
- Question: {{ example.題幹 }}
20
- Options: {{ example.選項 }}
21
- {% endfor %}
22
- {% endif %}`;
 
1
+ export const TEXTUAL_INFERENCE_PROMPT = `Below is an article:
2
+ {{article}}
3
+
4
+ As an English teacher, your task is to help foreign students better develop their textual inference skills in English. These questions should test a student's ability to:
5
+ - Understand implied meaning,
6
+ - Make logical conclusions,
7
+ - Or interpret unstated facts based on the given sentence or short passage.
8
 
9
  To achieve this, please follow the instructions below:
10
 
 
14
  Step 2: Provide multiple choices.
15
  Give four answer options clearly labeled A, B, C, and D, with one correct answer. The correct option should not be stated directly in the sentence but should be inferable.
16
 
 
17
  Here are some example questions to guide your work:
18
+ {{examples}}`;
 
 
 
 
 
 
src/prompts/word-comprehension.ts CHANGED
@@ -1,7 +1,10 @@
1
- export const WORD_COMPREHENSION_PROMPT = `As an English teacher, your task is to help foreign students better understand words in English. These questions should test a student's ability to:
2
- • Understand the meaning of words in context,
3
- • Identify the correct meaning from multiple options,
4
- • Apply the meaning to solve problems or complete tasks.
 
 
 
5
 
6
  To achieve this, please follow the instructions below:
7
 
@@ -10,12 +13,7 @@ Select or write a sentence from the provided article.
10
 
11
  Step 2: Provide multiple choices.
12
  Give four answer options clearly labeled A, B, C, and D, with one correct answer. The correct option should not be stated directly in the sentence but should be inferable.
13
- {% if examples %}
14
- Here are some example questions to guide your work:
15
 
16
- {% for example in examples[:5] %}
17
- Example {{ loop.index }}:
18
- Question: {{ example.題幹 }}
19
- Options: {{ example.選項 }}
20
- {% endfor %}
21
- {% endif %}`;
 
1
+ export const WORD_COMPREHENSION_PROMPT = `Below is an article:
2
+ {{article}}
3
+
4
+ As an English teacher, your task is to help foreign students better understand words in English. These questions should test a student's ability to:
5
+ - Understand the meaning of words in context,
6
+ - Identify the correct meaning from multiple options,
7
+ - Apply the meaning to solve problems or complete tasks.
8
 
9
  To achieve this, please follow the instructions below:
10
 
 
13
 
14
  Step 2: Provide multiple choices.
15
  Give four answer options clearly labeled A, B, C, and D, with one correct answer. The correct option should not be stated directly in the sentence but should be inferable.
 
 
16
 
17
+
18
+ Here are some example questions to guide your work:
19
+ {{examples}}`;