Repository navigation
4. Structure Generator
Important
The details presented in this document are generated in part automatically by AI. Because this document is not regenerated systematically, it may not reflect the latest version of the source code.
| Technical identity | Value |
|---|---|
| Audience | Software developers and functional analysts |
| Namespace | JbtiEvolution.OraklLearn.Generator.Books |
| Main class | BookStructureBuilder |
The Structure Generator converts a learning intent into an editable book blueprint. It produces sections, chapters, and related-content cues before the Book Generator writes the full learning material. This separation gives a subject-matter expert a meaningful approval point: the intended progression can be reviewed before text, images, audio, or publication assets are created.
It supports two paths:
| Path | Starting point | Result |
|---|---|---|
Build |
New subject and keywords. | A proposed structure for a new book. |
BuildDeeper |
A completed book plus one selected section or chapter. | A new, narrower structure that develops the selected fragment without repeating the rest of the source book. |
- Functional position in the learning journey
- Architectural view
- Standard structure generation
- Deeper-structure generation
- Data and validation rules
- Code map
flowchart LR
A[Business topic and learning objective] --> B[Topic refinement]
B --> C[Structure Generator]
C --> D[Expert review and editing]
D --> E[Book Generator]
E --> F[Book, media, and exports]
F --> G[Select a section or chapter]
G --> H[Deeper Structure Generator]
H --> D
The module returns a plan, not a published book. The plan remains editable; the generation of the actual text and media occurs later in the Book Generator.
flowchart TB
T[Structure transaction] --> V[Validate language, settings, and credit preauthorization]
V --> P[Prompt construction]
P --> I[Generative text service]
I --> N[Normalize returned sections and chapters]
N --> L1[Level 1: outline]
L1 --> L2[Level 2: chapters and related content]
L2 --> R[BookStructure result]
R --> C[Claim approved cost]
C --> S[Completed state]
B[Completed source-book trace] --> SC[Build selected-content scope]
SC --> P
The builder depends on tracing, system settings, profile and trace storage, a pricing calculator, and generative inference scopes. The inference provider is deliberately abstracted behind the inference interface; the business behavior depends on capabilities, not a specific vendor.
Build(BookStructureTransaction transaction) follows a fail-fast transaction model:
- Sets the
BookStructurecost from the invoice presented to the user. - Changes its state to
Running. - Validates the language and performs credit preauthorization.
- Runs the settings validation rules and records every validation error in the trace.
- Builds the first prompt set from the requested subject, keywords, audience settings, and book options.
- Builds and expands the structure.
- Claims the cost only after a structure has been created.
- Stores the structure in the transaction and changes state to
Completed.
Any failed validation, unavailable response, rejected claim, or unhandled exception changes the builder state to Error and returns false.
flowchart TD
A[Input: subject, keywords, book settings] --> B[Level 1 request]
B --> C[Sections with initial chapter titles]
C --> D{Section is first or last?}
D -->|yes| E[Preserve only for structural validation]
D -->|no| F[Build inclusion and exclusion scope]
F --> G[Level 2 request per content section]
G --> H[Returned sub-sections become chapters]
H --> I[Returned chapter titles become related-content cues]
E --> J[Remove introduction and conclusion]
I --> J
J --> K[Editable content structure]
Level 1 establishes the broad outline: section titles and initial chapter titles. Empty section and chapter titles are ignored while the response is normalized into a BookStructure.
Level 2 expands each content section. The builder creates a scope that identifies the selected section’s content and the material that should be excluded from that section. The resulting second-level sections become the final chapter titles; their chapter titles become RelatedContents for those chapters.
The first and last sections are expected to represent introduction and conclusion. They are checked to validate the returned outline, then removed with any remaining chapter titles that end in those labels. The result therefore focuses on the editable learning-content structure; introduction and conclusion are reintroduced by the book production flow when appropriate.
BuildDeeper(BookDeeperStructureTransaction transaction) starts from a completed book, rather than a free-text topic.
| Step | What happens |
|---|---|
| Load source | Reads the completed source-book trace using the source BID. Only the user who owns that trace can use it. |
| Select fragment | Accepts a section identifier (S<n>) or a chapter identifier (S<n>C<n>). |
| Build scope | Adds the selected material to the inclusion list and places the rest of the reference book in the exclusion list. |
| Derive focus | Uses generative text capabilities to formulate a focused subject and keywords from the inclusion and exclusion lists. |
| Generate plan | Runs the same two-stage structure construction using the derived focus. |
| Complete transaction | Saves the new structure and claims the DeepStructure cost after success. |
This makes the “deeper book” path explicit: it expands a specific part of an owned, completed source book while using the remaining source content as a boundary against duplication.
| Area | Rule implemented by the builder |
|---|---|
| Language | Must be supported by BookSettings; the current UI culture is set to that language for localized templates and messages. |
| Transaction | New structures validate all settings. Deeper structures temporarily ignore the input subject and keyword length rules because they are generated from the selected source fragment. |
| Ownership | A deeper structure requires a completed source trace belonging to the requesting user. |
| Output hygiene | Blank titles are dropped while converting the generative response into sections and chapters. |
| Introduction/conclusion | The outline must contain the expected first and last conceptual sections; they are then removed from the editable result. |
| Cost | Preauthorization occurs before inference. The claim occurs only after the resulting structure is available. |
| Cancellation | The cancellation token is passed to inference calls, so an interrupted request does not continue silently. |
| Concern | Main implementation point |
|---|---|
| New-book blueprint | BookStructureBuilder.Build |
| Focused blueprint from an existing book | BookStructureBuilder.BuildDeeper |
| Subject and keyword derivation |
CanDefineSubject and CanDefineKeywords
|
| Generative request boundary | RequestAI |
| Level-1 response normalization | BuildStructureLevelExtended |
| Level-2 expansion and related contents | CanBuildStructureLevel2 |
| Inclusion/exclusion model | BuildContentScope |
| Source ownership and completed-state check | CanLoadStates |
By separating outline creation from book production, the Structure Generator makes the functional architecture reviewable: the organization can approve the scope, progression, and coverage before committing to full content and media generation.

https://orakllearn.com · Author: Jimmy Bourque · https://jbti-evolution.com
- Main page
- Overview
- Foundation
- Integration
- Flow
- Using OraklLearn
- Configuration
- Monitoring