flowchart TB
reader["TrainingDataReader
+ ValidateAsync()
+ ReadCategoryValuesAsync()
+ ReadPatternsAsync()"]
definitions["Training definitions
TrainingCategories
TrainingSubjects
TrainingCategoryDefinition
TrainingCategoryValue"]
channel["Bounded Channel
Parallel workers write completed plan items;
ordered writer consumes"]
service["TrainingGenerationService
+ GenerateAsync()
- GenerateCategoryAsync()
- CreatePlan()
- GeneratePassAsync()
- PersistOrderedAsync()
- FindResumableRunAsync()
- ValidateGeneratedValue()"]
lmclient["LmStudioClient
+ CompleteAsync()
- ResolveFragmentTokens()
- ResolveArticles()
- SendCompletionAsync()"]
config["Configuration
GenerationOptions
LmStudioOptions
SentenceTenses"]
context["RlhfGeneratorDbContext
DbSet Category
DbSet TrainingItem
DbSet GenerationRun
DbSet Keyword
DbSet KeywordVariant"]
run["GenerationRun
Status, seed, fingerprints,
checkpoint and counts,
failure/cancellation data"]
item["TrainingItem
RecordKey, PlanOrdinal,
Category, Keyword,
IsPositive, Value"]
service -->|Validates and reads inputs| reader
reader -->|Returns| definitions
service -->|Plans with| definitions
service -->|Coordinates producers and consumer| channel
service -->|Calls concurrently| lmclient
config -->|Binds| service
config -->|Binds| lmclient
service -->|Queries and transacts| context
context -->|Tracks| run
context -->|Tracks| item
run -->|Owns ordered items| item
classDef core fill:#dae8fc,stroke:#6c8ebf,color:#000;
classDef input fill:#d5e8d4,stroke:#82b366,color:#000;
classDef integration fill:#e1d5e7,stroke:#9673a6,color:#000;
classDef persistence fill:#f8cecc,stroke:#b85450,color:#000;
classDef config fill:#fff2cc,stroke:#d6b656,color:#000;
classDef coordination fill:#ffe6cc,stroke:#d79b00,color:#000;
class service core;
class reader,definitions input;
class lmclient integration;
class context,run,item persistence;
class config config;
class channel coordination;