core.mt_factory¶
Module: templates.master_instructions_notes.factory
This module is integral to the creation of structured instructions and tasks for a variety of document drafting processes. The MasterTemplateFactory class at its core is designed to support a wide range of applications, from study reports to any structured document requiring detailed, step-by-step instructions for creation or analysis.
By leveraging a rich library of tasks, the MasterTemplateFactory enables the generation of comprehensive guides that facilitate the automated drafting or analysis of documents. These guides are pivotal in ensuring efficiency, consistency, and adherence to specific guidelines or standards across diverse domains.
- Classes:
MasterTemplateFactory: A versatile class that generates structured instructions and tasks, adaptable to various drafting and analytical needs.
This module represents a flexible tool for automating and enhancing the document creation process, capable of catering to a broad spectrum of document types and requirements.
- class celi_framework.core.mt_factory.MasterTemplateFactory(job_desc, schema)
Bases:
objectA versatile factory class for generating structured instructions and tasks applicable to various document drafting or analytical processes. It abstracts the complexity of document planning into actionable, step-by-step guides, making it a valuable asset for automating document creation across different fields.
- config
Configuration details including user roles, drafting contexts, and specific task lists.
- Type:
dict
- schema
The schema or structural blueprint of the document to be created or analyzed.
- Type:
dict
- role
The intended role of the user or system utilizing the generated instructions, allowing for tailored guidance.
- Type:
str
- context
The overarching context or scope of the document-related tasks, ensuring relevance and focus.
- Type:
str
- task_list
A detailed compilation of tasks, each with specific descriptions and operational instructions.
- Type:
dict
- final_output_task
The designated concluding task of the process, marking the endpoint of the instruction set.
- Type:
str
- general_comments
Supplementary comments or notes providing additional insights or clarifications.
- Type:
str
- user_message
A customizable message to convey specific instructions or information to the user or system.
- Type:
str
- include_prerequisites
A flag indicating whether prerequisite tasks should be included in the instructions.
- Type:
bool
- id
A unique identifier for the generated template, facilitating traceability and version control.
- Type:
str
- __init__(config, schema)
Prepares the factory with necessary configurations and the document schema for instruction generation.
- get_algorithm_setup_section()
Constructs the introductory section of the algorithm, establishing the groundwork for subsequent tasks.
- get_tasks_section(include_prerequisites)
Assembles the tasks section, detailing each task’s execution pathway, optionally including prerequisites.
- create_system_message()
Synthesizes the setup instructions, task details, and general comments into a unified system message for users or systems.
The MasterTemplateFactory is designed to bridge the gap between conceptual document planning and practical execution, offering a systematic approach to document creation and analysis that enhances productivity, consistency, and quality across a wide array of applications.
- create_system_message()
Generates a comprehensive system message that includes all tasks with updated references. The system message is composed of the algorithm setup section, the tasks section, and the general comments. Each part is separated by two newline characters for readability.
- Returns:
- A string that comprises the algorithm setup section, the tasks section, and the general comments,
with each part separated by two newline characters.
- Return type:
str
- get_algorithm_setup_section()
Generates the initial setup section of the instruction set, providing foundational context and guidelines for the document drafting or analysis process. This section outlines the role of the user, the overall objective, and the structural approach to be taken, setting the stage for the detailed tasks that follow.
- Returns:
- A string containing the setup instructions, including an introduction to the document creation
or analysis process, the user’s role, and the context within which the tasks are to be performed. This setup section is designed to orient users or systems towards the goals and expectations of the process, ensuring a clear understanding of the task ahead.
- Return type:
str
This method plays a crucial role in ensuring that the instructions begin with a clear and comprehensive overview, laying a solid foundation for the successful execution of subsequent tasks.
- get_numbered_tasks()
Returns a version of this class’s task list including dynamically assigned numbers and updated references to other tasks within the task details to reflect these numbers.
- print_initial_user_message()
- print_system_message()
- celi_framework.core.mt_factory.generate_hash_id(obj)¶
Generates a unique template ID based on the hash of stringable object.
- Parameters:
config (stringable type) – An object that can be turned into a string to hash.
- Returns:
A unique template ID.
- Return type:
str