brickfrog commited on
Commit
edb3b14
Β·
verified Β·
1 Parent(s): 6fa809e

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +91 -18
README.md CHANGED
@@ -3,27 +3,60 @@ title: AnkiGen
3
  emoji: πŸ“š
4
  app_file: app.py
5
  requirements: requirements.txt
6
- python: 3.12
7
  sdk: gradio
8
- sdk_version: 5.13.1
9
  ---
10
 
11
  # AnkiGen - Anki Card Generator
12
 
13
- AnkiGen is a Gradio-based web application that generates Anki-compatible CSV and `.apkg` deck files using Large Language Models (LLMs) based on user-specified subjects and preferences.
14
 
15
  ## Features
16
 
17
- - Generate Anki cards for various subjects or from provided text/URLs.
18
- - Generate a structured learning path for a complex topic.
19
- - Customizable number of topics and cards per topic.
20
- - User-friendly interface powered by Gradio.
21
- - Exports to CSV for manual import or `.apkg` format with default styling.
22
- - Utilizes OpenAI's structured output capabilities.
23
-
24
- ## Screenshot
25
-
26
- ![AnkiGen Screenshot](example.png)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  ## Installation for Local Use
29
 
@@ -48,6 +81,7 @@ Preferred usage: [uv](https://github.com/astral-sh/uv)
48
  - Create a `.env` file in the project root (`ankigen/`).
49
  - Add your key like this: `OPENAI_API_KEY="your_sk-xxxxxxxx_key_here"`
50
  - The application will load this key automatically.
 
51
 
52
  ## Usage
53
 
@@ -75,14 +109,23 @@ Preferred usage: [uv](https://github.com/astral-sh/uv)
75
 
76
  ## Project Structure
77
 
78
- The codebase has been refactored from a single script into a more modular structure:
79
 
80
  - `app.py`: Main Gradio application interface and event handling.
81
  - `ankigen_core/`: Directory containing the core logic modules:
 
 
 
 
 
 
 
 
 
82
  - `models.py`: Pydantic models for data structures.
83
  - `utils.py`: Logging, caching, web fetching utilities.
84
- - `llm_interface.py`: Interaction logic with the OpenAI API.
85
- - `card_generator.py`: Core logic for generating topics and cards.
86
  - `learning_path.py`: Logic for the learning path analysis feature.
87
  - `exporters.py`: Functions for exporting data to CSV and `.apkg`.
88
  - `ui_logic.py`: Functions handling UI component updates and visibility.
@@ -92,6 +135,33 @@ The codebase has been refactored from a single script into a more modular struct
92
  - `pyproject.toml`: Defines project metadata, dependencies, and build system configuration.
93
  - `README.md`: This file.
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  ## Development
96
 
97
  This project uses `uv` for environment and package management and `pytest` for testing.
@@ -124,8 +194,11 @@ This project uses `uv` for environment and package management and `pytest` for t
124
  ## TODO
125
 
126
  - [ ] Edit columns /fields
127
- - [ ] Improve crawler / RAG(?)
128
- - [ ] Chain of thought / reasoning, recurse for better questions
 
 
 
129
 
130
  ## License
131
 
 
3
  emoji: πŸ“š
4
  app_file: app.py
5
  requirements: requirements.txt
6
+ python: 3.10
7
  sdk: gradio
8
+ sdk_version: 5.34.2
9
  ---
10
 
11
  # AnkiGen - Anki Card Generator
12
 
13
+ AnkiGen is a Gradio-based web application that generates high-quality Anki-compatible CSV and `.apkg` deck files using an advanced multi-agent system powered by OpenAI Agents. The system employs specialized generator agents, quality assessment judges, and enhancement agents to create superior flashcards.
14
 
15
  ## Features
16
 
17
+ - **Multi-Agent Card Generation**: Utilizes specialized agents for subject expertise, pedagogical guidance, and content structuring
18
+ - **Quality Assurance System**: Multiple judge agents evaluate cards for accuracy, clarity, pedagogical value, and completeness
19
+ - **Adaptive Enhancement**: Revision and enhancement agents improve cards based on judge feedback
20
+ - Generate Anki cards for various subjects or from provided text/URLs
21
+ - Generate a structured learning path for a complex topic
22
+ - Customizable number of topics and cards per topic
23
+ - User-friendly interface powered by Gradio
24
+ - Exports to CSV for manual import or `.apkg` format with default styling
25
+ - Advanced OpenAI Agents SDK integration with structured outputs
26
+
27
+ ## How It Works
28
+
29
+ ```mermaid
30
+ graph TD
31
+ A[User Input] --> B[Generation Coordinator]
32
+ B --> C[Subject Expert Agent]
33
+ B --> D[Pedagogical Agent]
34
+ B --> E[Content Structuring Agent]
35
+
36
+ C --> F[Generated Cards]
37
+ D --> F
38
+ E --> F
39
+
40
+ F --> G[Judge Coordinator]
41
+ G --> H[Content Accuracy Judge]
42
+ G --> I[Pedagogical Judge]
43
+ G --> J[Clarity Judge]
44
+ G --> K[Technical Judge]
45
+ G --> L[Completeness Judge]
46
+
47
+ H --> M{All Judges Pass?}
48
+ I --> M
49
+ J --> M
50
+ K --> M
51
+ L --> M
52
+
53
+ M -->|No| N[Revision Agent]
54
+ N --> O[Enhancement Agent]
55
+ O --> B
56
+
57
+ M -->|Yes| P[Final High-Quality Cards]
58
+ P --> Q[Export to CSV/APKG]
59
+ ```
60
 
61
  ## Installation for Local Use
62
 
 
81
  - Create a `.env` file in the project root (`ankigen/`).
82
  - Add your key like this: `OPENAI_API_KEY="your_sk-xxxxxxxx_key_here"`
83
  - The application will load this key automatically.
84
+ - **Note**: This application requires OpenAI API access and uses the `openai-agents` SDK for advanced multi-agent functionality.
85
 
86
  ## Usage
87
 
 
109
 
110
  ## Project Structure
111
 
112
+ The codebase uses a sophisticated multi-agent architecture powered by the OpenAI Agents SDK:
113
 
114
  - `app.py`: Main Gradio application interface and event handling.
115
  - `ankigen_core/`: Directory containing the core logic modules:
116
+ - `agents/`: **OpenAI Agents system implementation**:
117
+ - `base.py`: Base agent wrapper and configuration classes
118
+ - `generators.py`: Specialized generator agents (SubjectExpertAgent, PedagogicalAgent, ContentStructuringAgent)
119
+ - `judges.py`: Quality assessment agents (ContentAccuracyJudge, PedagogicalJudge, ClarityJudge, etc.)
120
+ - `enhancers.py`: Revision and enhancement agents for card improvement
121
+ - `integration.py`: AgentOrchestrator for coordinating the entire agent system
122
+ - `config.py`: Agent configuration management
123
+ - `schemas.py`: Pydantic schemas for structured agent outputs
124
+ - `templates/`: Jinja2 templates for agent prompts
125
  - `models.py`: Pydantic models for data structures.
126
  - `utils.py`: Logging, caching, web fetching utilities.
127
+ - `llm_interface.py`: OpenAI API client management.
128
+ - `card_generator.py`: Integration layer for agent-based card generation.
129
  - `learning_path.py`: Logic for the learning path analysis feature.
130
  - `exporters.py`: Functions for exporting data to CSV and `.apkg`.
131
  - `ui_logic.py`: Functions handling UI component updates and visibility.
 
135
  - `pyproject.toml`: Defines project metadata, dependencies, and build system configuration.
136
  - `README.md`: This file.
137
 
138
+ ## Agent System Architecture
139
+
140
+ AnkiGen employs a sophisticated multi-agent system built on the OpenAI Agents SDK that ensures high-quality flashcard generation through specialized roles and quality control:
141
+
142
+ ### Generator Agents
143
+ - **SubjectExpertAgent**: Provides domain-specific expertise for accurate content creation
144
+ - **PedagogicalAgent**: Ensures cards follow effective learning principles and memory techniques
145
+ - **ContentStructuringAgent**: Optimizes card structure, formatting, and information hierarchy
146
+
147
+ ### Quality Assurance Judges
148
+ - **ContentAccuracyJudge**: Verifies factual correctness and subject matter accuracy
149
+ - **PedagogicalJudge**: Evaluates learning effectiveness and educational value
150
+ - **ClarityJudge**: Assesses readability, comprehension, and clear communication
151
+ - **TechnicalJudge**: Reviews technical accuracy for specialized subjects
152
+ - **CompletenessJudge**: Ensures comprehensive coverage without information gaps
153
+
154
+ ### Enhancement Agents
155
+ - **RevisionAgent**: Identifies areas for improvement based on judge feedback
156
+ - **EnhancementAgent**: Implements refinements and optimizations to failed cards
157
+
158
+ ### Orchestration
159
+ - **GenerationCoordinator**: Manages the card generation workflow and agent handoffs
160
+ - **JudgeCoordinator**: Coordinates quality assessment across all judge agents
161
+ - **AgentOrchestrator**: Main system controller that initializes and manages the entire agent ecosystem
162
+
163
+ This architecture ensures that every generated flashcard undergoes rigorous quality control and iterative improvement, resulting in superior learning materials.
164
+
165
  ## Development
166
 
167
  This project uses `uv` for environment and package management and `pytest` for testing.
 
194
  ## TODO
195
 
196
  - [ ] Edit columns /fields
197
+ - [ ] Improve crawler / RAG integration with agents
198
+ - [ ] Add agent performance metrics and monitoring
199
+ - [ ] Implement agent conversation history and context persistence
200
+ - [ ] Add custom agent configuration UI
201
+ - [ ] Expand subject-specific agent templates
202
 
203
  ## License
204