service.preclass.processors.gen_structure module
- class service.preclass.processors.gen_structure.SERVICE[source]
Bases:
object
Service class for handling structure generation jobs via message queue.
This service processes PowerPoint scripts to generate hierarchical content structure using MongoDB for storage and RabbitMQ for job queue management.
- static callback(ch, method, properties, body)[source]
Process a structure generation job from the message queue.
- Parameters:
ch – RabbitMQ channel
method – RabbitMQ method frame
properties – RabbitMQ properties
body – Message body containing job ID
- static trigger(parent_service, lecture_id, parent_job_id)[source]
Trigger a new structure generation job.
- Parameters:
parent_service (str) – Name of the parent service
lecture_id (ObjectId) – MongoDB ID of the lecture
parent_job_id (ObjectId) – MongoDB ID of the parent job
- Returns:
ID of the created job
- Return type:
str
- class service.preclass.processors.gen_structure.Structurelizor(root_agenda_title, input_scripts)[source]
Bases:
object
A class that generates hierarchical structure from PowerPoint presentation scripts.
This class processes input scripts from PowerPoint slides and organizes them into a hierarchical structure using LLM-based generation. It maintains section/subsection relationships while preserving the original page order.
- input_scripts
List of PowerPoint page scripts to process
- root_title
Title of the root agenda/section
- prompt
System prompt for the LLM to generate structured outlines
- call_generation(content, return_formatter=<function Structurelizor.<lambda>>, use_cache=True, timeout=300, **kwargs)[source]
Call OpenAI generation with waiting capability.
- Parameters:
content – The content to send to the model
return_formatter – Function to format the response
timeout – Maximum time to wait in seconds
**kwargs – Additional arguments for the OpenAI trigger
- service.preclass.processors.gen_structure.now(tz=None)
Returns new datetime object representing current time local to tz.
- tz
Timezone object.
If no tz is specified, uses local timezone.