123 lines
5.5 KiB
Go
123 lines
5.5 KiB
Go
package config
|
|
|
|
import "gitea.maximumdirect.net/eric/notarius/internal/framework/pipeline"
|
|
|
|
// Document is the version 5 configuration shape decoded by ConfigKit. It is
|
|
// deliberately separate from Config so YAML presence and composition concerns
|
|
// do not reach runtime pipeline types.
|
|
type Document struct {
|
|
Version string `yaml:"version"`
|
|
PromptKit *PromptKitDocument `yaml:"promptkit,omitempty"`
|
|
Pipelines map[string]PipelineDocument `yaml:"pipelines,omitempty"`
|
|
Concurrency *ConcurrencyDocument `yaml:"concurrency,omitempty"`
|
|
Output *OutputDocument `yaml:"output,omitempty"`
|
|
Cache *CacheDocument `yaml:"cache,omitempty"`
|
|
Debug *DebugDocument `yaml:"debug,omitempty"`
|
|
}
|
|
|
|
type PromptKitDocument struct {
|
|
ProfileDir *string `yaml:"profile_dir,omitempty"`
|
|
ProfileFile *string `yaml:"profile_file,omitempty"`
|
|
LocalBackend *PromptKitLocalBackendDocument `yaml:"local_backend,omitempty"`
|
|
}
|
|
|
|
type PromptKitLocalBackendDocument struct {
|
|
Endpoint *string `yaml:"endpoint,omitempty"`
|
|
ConcurrencyLimit *int `yaml:"concurrency_limit,omitempty"`
|
|
}
|
|
|
|
type PipelineDocument struct {
|
|
LLMProfile *string `yaml:"llm_profile,omitempty"`
|
|
StructuredOutputRepairAttempts *int `yaml:"structured_output_repair_attempts,omitempty"`
|
|
ValidationPolicy *ValidationPolicyDocument `yaml:"validation_policy,omitempty"`
|
|
Input BindingDocument `yaml:"input"`
|
|
Chunk *BindingDocument `yaml:"chunk,omitempty"`
|
|
Artifacts map[string]ArtifactLaneDocument `yaml:"artifacts,omitempty"`
|
|
Steps []PipelineStepDocument `yaml:"steps,omitempty"`
|
|
Output *BindingDocument `yaml:"output,omitempty"`
|
|
References map[string]ReferenceDocument `yaml:"references,omitempty"`
|
|
}
|
|
|
|
type PipelineStepDocument struct {
|
|
ID string `yaml:"id"`
|
|
Artifacts map[string]ArtifactLaneDocument `yaml:"artifacts"`
|
|
References map[string]ReferenceDocument `yaml:"references,omitempty"`
|
|
}
|
|
|
|
type ArtifactLaneDocument struct {
|
|
Extract BindingDocument `yaml:"extract"`
|
|
Merge *BindingDocument `yaml:"merge,omitempty"`
|
|
Normalize *BindingDocument `yaml:"normalize,omitempty"`
|
|
Validators []ValidatorDocument `yaml:"validators,omitempty"`
|
|
References map[string]ReferenceDocument `yaml:"references,omitempty"`
|
|
}
|
|
|
|
// BindingDocument represents a producer binding. ValidatorDocument is a
|
|
// deliberately finite subset so nested validator-only fields are rejected by
|
|
// ConfigKit's strict decoder.
|
|
type BindingDocument struct {
|
|
Module string `yaml:"module"`
|
|
LLMProfile *string `yaml:"llm_profile,omitempty"`
|
|
StructuredOutputRepairAttempts *int `yaml:"structured_output_repair_attempts,omitempty"`
|
|
ValidationPolicy *ValidationPolicyDocument `yaml:"validation_policy,omitempty"`
|
|
Retries int `yaml:"retries,omitempty"`
|
|
Options map[string]any `yaml:"options,omitempty"`
|
|
References map[string]ReferenceDocument `yaml:"references,omitempty"`
|
|
Validators []ValidatorDocument `yaml:"validators,omitempty"`
|
|
}
|
|
|
|
type ValidatorDocument struct {
|
|
Module string `yaml:"module"`
|
|
LLMProfile *string `yaml:"llm_profile,omitempty"`
|
|
StructuredOutputRepairAttempts *int `yaml:"structured_output_repair_attempts,omitempty"`
|
|
Retries int `yaml:"retries,omitempty"`
|
|
Options map[string]any `yaml:"options,omitempty"`
|
|
}
|
|
|
|
// ReferenceDocument is the explicit version 5 union. Later document
|
|
// validation establishes which locations permit generated references and
|
|
// requires exactly one populated branch.
|
|
type ReferenceDocument struct {
|
|
Path *string `yaml:"path,omitempty"`
|
|
Artifact *ArtifactReferenceDocument `yaml:"artifact,omitempty"`
|
|
}
|
|
|
|
type ArtifactReferenceDocument struct {
|
|
Step string `yaml:"step"`
|
|
Lane string `yaml:"lane"`
|
|
}
|
|
|
|
type ValidationPolicyDocument struct {
|
|
ProducerStructuralFailure *pipeline.ProducerStructuralFailureAction `yaml:"producer_structural_failure,omitempty"`
|
|
SemanticRejection *pipeline.SemanticRejectionAction `yaml:"semantic_rejection,omitempty"`
|
|
ValidatorFailure *pipeline.ValidatorFailureAction `yaml:"validator_failure,omitempty"`
|
|
}
|
|
|
|
type ConcurrencyDocument struct {
|
|
TotalLLM *int `yaml:"total_llm,omitempty"`
|
|
StageWorkers map[string]int `yaml:"stage_workers,omitempty"`
|
|
}
|
|
|
|
type OutputDocument struct {
|
|
Directory *string `yaml:"directory,omitempty"`
|
|
}
|
|
|
|
type CacheDocument struct {
|
|
ChunkPlans *ChunkPlanCacheDocument `yaml:"chunk_plans,omitempty"`
|
|
Checkpoints *CheckpointCacheDocument `yaml:"checkpoints,omitempty"`
|
|
}
|
|
|
|
type ChunkPlanCacheDocument struct {
|
|
Directory *string `yaml:"directory,omitempty"`
|
|
Mode *string `yaml:"mode,omitempty"`
|
|
}
|
|
|
|
type CheckpointCacheDocument struct {
|
|
Enabled *bool `yaml:"enabled,omitempty"`
|
|
Directory *string `yaml:"directory,omitempty"`
|
|
}
|
|
|
|
type DebugDocument struct {
|
|
Directory *string `yaml:"directory,omitempty"`
|
|
}
|