File size: 6,784 Bytes
0ff2e07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
"""Notes generation tool for creating educational notes."""

from agents import function_tool


@function_tool
def generate_note_structure(
    topic: str,
    difficulty_level: str,
    include_examples: bool = True,
    include_diagrams: bool = False,
) -> str:
    """
    Generate a structured outline for educational notes.

    This tool helps create a consistent structure for notes based on difficulty level.
    The agent should fill in the content for each section.

    Args:
        topic: The main topic for the notes
        difficulty_level: Education level (primary, high_school, college, undergrad, postgrad)
        include_examples: Whether to include example sections
        include_diagrams: Whether to include diagram placeholders

    Returns:
        Markdown outline structure for the notes
    """
    # Base structure
    structure = [f"# {topic}\n"]

    # Difficulty-specific sections
    if difficulty_level == "primary":
        structure.extend([
            "## What is this?",
            "[Simple explanation in 1-2 sentences]\n",
            "## How does it work?",
            "[Step-by-step explanation with simple words]\n",
        ])
        if include_examples:
            structure.extend([
                "## Examples from Daily Life",
                "[Real-world examples kids can relate to]\n",
            ])
        structure.extend([
            "## Key Points to Remember",
            "[Bullet points with main ideas]\n",
        ])

    elif difficulty_level == "high_school":
        structure.extend([
            "## Introduction",
            "[Clear definition and context]\n",
            "## Main Concepts",
            "[Core ideas with explanations]\n",
            "## How It Works",
            "[Detailed explanation]\n",
        ])
        if include_examples:
            structure.extend([
                "## Real-World Applications",
                "[Practical examples and use cases]\n",
            ])
        if include_diagrams:
            structure.extend([
                "## Visual Representation",
                "[Diagram placeholder]\n",
            ])
        structure.extend([
            "## Summary",
            "[Key takeaways]\n",
        ])

    elif difficulty_level in ["college", "undergrad"]:
        structure.extend([
            "## Abstract",
            "[Brief overview]\n",
            "## Introduction",
            "[Background and significance]\n",
            "## Theoretical Foundation",
            "[Core theories and principles]\n",
            "## Detailed Analysis",
            "[In-depth explanation]\n",
        ])
        if include_examples:
            structure.extend([
                "## Examples and Case Studies",
                "[Detailed examples]\n",
            ])
        if include_diagrams:
            structure.extend([
                "## Diagrams and Visualizations",
                "[Technical diagrams]\n",
            ])
        structure.extend([
            "## Applications",
            "[Practical applications]\n",
            "## Conclusion",
            "[Summary and implications]\n",
        ])
        if difficulty_level == "undergrad":
            structure.extend([
                "## Further Reading",
                "[References and resources]\n",
            ])

    elif difficulty_level == "postgrad":
        structure.extend([
            "## Abstract",
            "[Concise summary of content]\n",
            "## Introduction",
            "[Context, motivation, and research landscape]\n",
            "## Theoretical Framework",
            "[Advanced theoretical concepts]\n",
            "## Methodological Considerations",
            "[Approaches and methodologies]\n",
            "## Critical Analysis",
            "[Detailed examination and critique]\n",
            "## Contemporary Research",
            "[Current developments and debates]\n",
        ])
        if include_examples:
            structure.extend([
                "## Case Studies and Applications",
                "[Advanced examples from research]\n",
            ])
        if include_diagrams:
            structure.extend([
                "## Figures and Models",
                "[Complex diagrams and models]\n",
            ])
        structure.extend([
            "## Implications and Future Directions",
            "[Research implications]\n",
            "## References",
            "[Scholarly citations]\n",
        ])

    else:
        # Default college structure
        structure.extend([
            "## Introduction",
            "## Main Content",
            "## Examples",
            "## Summary",
        ])

    return "\n".join(structure)


@function_tool
def suggest_note_sections(
    topic: str,
    current_sections: str,
    missing_aspects: str = "",
) -> str:
    """
    Suggest additional sections or content to add to notes.

    Use this tool when you need to enhance existing notes or identify gaps.

    Args:
        topic: The topic of the notes
        current_sections: List of current section headings (one per line)
        missing_aspects: Optional aspects that should be covered

    Returns:
        Suggestions for additional sections or improvements
    """
    suggestions = []

    # Common educational elements to check
    common_elements = {
        "definition": ["Introduction", "What is", "Overview"],
        "examples": ["Examples", "Applications", "Case Studies"],
        "diagrams": ["Diagram", "Visual", "Figure", "Chart"],
        "summary": ["Summary", "Conclusion", "Key Points"],
        "practice": ["Exercises", "Questions", "Problems"],
    }

    sections_lower = current_sections.lower()

    # Check for missing common elements
    for element, keywords in common_elements.items():
        if not any(kw.lower() in sections_lower for kw in keywords):
            if element == "examples":
                suggestions.append("Add 'Examples and Applications' section with real-world use cases")
            elif element == "diagrams":
                suggestions.append("Add visual diagrams to illustrate complex concepts")
            elif element == "summary":
                suggestions.append("Add 'Summary' section with key takeaways")
            elif element == "practice":
                suggestions.append("Consider adding practice questions or exercises")

    # Topic-specific suggestions
    if missing_aspects:
        suggestions.append(f"Consider addressing: {missing_aspects}")

    if not suggestions:
        return "Notes appear comprehensive. Consider adding:\n- More examples\n- Visual aids\n- Practice problems"

    return "\n".join([f"- {s}" for s in suggestions])


__all__ = ["generate_note_structure", "suggest_note_sections"]