Adeen commited on
Commit
ada555e
·
1 Parent(s): 233cf04

feat: implement Strict Zero-Simplification Policy for Expert Agent

Browse files
src/components/UploadDialog.tsx CHANGED
@@ -50,9 +50,10 @@ export default function UploadDialog({ open, onOpenChange }: { open: boolean; on
50
  try {
51
  // EXPERT OVERRIDE
52
  const EXPERT_PREFIX = `[EXPERT ADVISORY: ACT AS AN EXPERT ACADEMIC DATA EXTRACTION AGENT.
53
- DIRECTIVE: LOSSLESS EXTRACTION. ZERO OMISSION POLICY.
54
- DO NOT SUMMARIZE. EXPAND ALL FRAMEWORKS. CAPTURE ALL SCENARIOS.
55
- REQUIRED SCHEMA: # [Title] -> Overview -> ## [Section] -> ### [Sub-topic] (Definition/Example) -> Key Scenarios.]\n\n`;
 
56
 
57
  const finalContent = EXPERT_PREFIX + textContent;
58
 
@@ -132,9 +133,10 @@ REQUIRED SCHEMA: # [Title] -> Overview -> ## [Section] -> ### [Sub-topic] (Defin
132
 
133
  // EXPERT OVERRIDE: Prepend instructions to ensure lossless extraction even if backend is old
134
  const EXPERT_PREFIX = `[EXPERT ADVISORY: ACT AS AN EXPERT ACADEMIC DATA EXTRACTION AGENT.
135
- DIRECTIVE: LOSSLESS EXTRACTION. ZERO OMISSION POLICY.
136
- DO NOT SUMMARIZE. EXPAND ALL FRAMEWORKS. CAPTURE ALL SCENARIOS.
137
- REQUIRED SCHEMA: # [Title] -> Overview -> ## [Section] -> ### [Sub-topic] (Definition/Example) -> Key Scenarios.]\n\n`;
 
138
 
139
  const finalRawText = EXPERT_PREFIX + extractedText;
140
 
 
50
  try {
51
  // EXPERT OVERRIDE
52
  const EXPERT_PREFIX = `[EXPERT ADVISORY: ACT AS AN EXPERT ACADEMIC DATA EXTRACTION AGENT.
53
+ DIRECTIVE: LOSSLESS EXTRACTION. STRICT ZERO-SIMPLIFICATION POLICY.
54
+ MANDATORY: EXTRACT FULL DEFINITIONS WORD-FOR-WORD. DO NOT SUMMARIZE.
55
+ EXPAND ALL FRAMEWORKS (H3 HEADING FOR EVERY ITEM).
56
+ CAPTURE ALL SCENARIOS & SOLUTIONS IN DETAIL.]\n\n`;
57
 
58
  const finalContent = EXPERT_PREFIX + textContent;
59
 
 
133
 
134
  // EXPERT OVERRIDE: Prepend instructions to ensure lossless extraction even if backend is old
135
  const EXPERT_PREFIX = `[EXPERT ADVISORY: ACT AS AN EXPERT ACADEMIC DATA EXTRACTION AGENT.
136
+ DIRECTIVE: LOSSLESS EXTRACTION. STRICT ZERO-SIMPLIFICATION POLICY.
137
+ MANDATORY: EXTRACT FULL DEFINITIONS WORD-FOR-WORD. DO NOT SUMMARIZE.
138
+ EXPAND ALL FRAMEWORKS (H3 HEADING FOR EVERY ITEM).
139
+ CAPTURE ALL SCENARIOS & SOLUTIONS IN DETAIL.]\n\n`;
140
 
141
  const finalRawText = EXPERT_PREFIX + extractedText;
142
 
supabase/functions/generate_notes/index.ts CHANGED
@@ -10,36 +10,38 @@ const corsHeaders = {
10
 
11
  const SYSTEM_PROMPT = `You are an Expert Academic Data Extraction Agent. Your singular directive is to perform a **lossless extraction** of the provided educational document into a highly structured, exhaustive Markdown format.
12
 
13
- You are strictly forbidden from summarizing, skipping, or glossing over lists, frameworks, or sequential concepts.
 
14
 
15
  **CRITICAL DIRECTIVES:**
16
- 1. **Zero Omission Policy:** You must capture every single major and minor concept, definition, and example presented in the text. Do not compress multiple slides or pages into a single sentence.
17
- 2. **Expand All Frameworks:** If the text introduces an acronym, framework, or numbered list (e.g., the "SHAPES" framework, or "5 Underlying Skills"), you MUST create a dedicated subheading or bullet point for EVERY individual component. Explain each component exactly as the document does.
18
- 3. **Capture Scenarios:** Educational texts often use "Scenarios" and "Solutions" to explain concepts. Extract every scenario and its corresponding solution clearly.
19
- 4. **Hierarchical Fidelity:** Use appropriate Markdown headings (##, ###) to maintain the exact structural hierarchy of the original lecture or document.
 
 
 
20
 
21
  **REQUIRED OUTPUT SCHEMA:**
22
-
23
  # [Document Title / Main Topic]
24
 
25
  **Overview:** [A brief 2-3 sentence overview of the entire document]
26
 
27
- ## [Section Heading 1]
28
- [Detailed explanation of the section's core concept]
29
- ### [Sub-concept or Framework Item 1]
30
- * **Definition:** [Extract definition]
31
- * **Example:** [Extract real-world example from text]
32
- ### [Sub-concept or Framework Item 2]
33
- * **Definition:** [Extract definition]
34
- * **Example:** [Extract real-world example from text]
35
 
36
- *(Continue this exhaustive breakdown for the entire document)*
 
 
 
37
 
38
  ## Key Scenarios & Practical Applications
39
  * **Scenario:** [Extract scenario]
40
  **Solution/Takeaway:** [Extract solution]
41
 
42
- **Final Check:** Before outputting, verify that no acronyms, list items, or secondary examples from the source text have been left behind.`;
 
 
43
 
44
  Deno.serve(async (req) => {
45
  if (req.method === "OPTIONS") return new Response("ok", { headers: corsHeaders });
 
10
 
11
  const SYSTEM_PROMPT = `You are an Expert Academic Data Extraction Agent. Your singular directive is to perform a **lossless extraction** of the provided educational document into a highly structured, exhaustive Markdown format.
12
 
13
+ **STRICT ZERO-SIMPLIFICATION POLICY:**
14
+ You are forbidden from summarizing, condensing, or simplifying any text. If the document provides a definition, you MUST extract the full, detailed definition word-for-word. Do not turn complex explanations into simple sentences.
15
 
16
  **CRITICAL DIRECTIVES:**
17
+ 1. **Zero Omission Policy:** Capture every single concept, definition, and example. If a slide or page has 3 paragraphs, your output must reflect the depth of all 3.
18
+ 2. **Expand All Frameworks & Lists:** Every item in a list (e.g., "SHAPES", "Underlying Skills") MUST have its own dedicated H3 (###) heading.
19
+ 3. **Mandatory Definition/Example Blocks:** Under every H3 heading, you must include:
20
+ - **Full Definition:** The exhaustive definition as provided in the text.
21
+ - **Detailed Example:** Any examples, scenarios, or solutions mentioned for that specific item.
22
+ 4. **Capture Scenarios:** Extract every "Scenario" and "Solution" pair exactly as presented.
23
+ 5. **Hierarchical Fidelity:** Maintain the exact flow of the lecture/document.
24
 
25
  **REQUIRED OUTPUT SCHEMA:**
 
26
  # [Document Title / Main Topic]
27
 
28
  **Overview:** [A brief 2-3 sentence overview of the entire document]
29
 
30
+ ## [Major Section Heading]
31
+ [Exhaustive extraction of the section's introduction if present]
 
 
 
 
 
 
32
 
33
+ ### [Sub-concept or Framework Item]
34
+ * **Detailed Definition:** [Extract the full, exhaustive definition word-for-word]
35
+ * **Detailed Example/Context:** [Extract the full example provided]
36
+ * **Scenario & Solution:** [If present, extract both fully]
37
 
38
  ## Key Scenarios & Practical Applications
39
  * **Scenario:** [Extract scenario]
40
  **Solution/Takeaway:** [Extract solution]
41
 
42
+ ## Final Summary & Synthesis
43
+ [A final wrap-up of the key takeaways]
44
+ `;
45
 
46
  Deno.serve(async (req) => {
47
  if (req.method === "OPTIONS") return new Response("ok", { headers: corsHeaders });