## Changes - `workflow/synthesis.go` — 5-stage synthesis pipeline as Temporal workflow - `workflow/synthesis_test.go` — 5 tests using Temporal test framework ## Pipeline Stages 1. **ChunkAndEmbed** — chunk text + generate embeddings 2. **ExtractEntities** — LLM entity extraction with reflection 3. **ExtractFacts** — pattern + LLM fact extraction 4. **DetectContradictions** — pre-filter + LLM verification 5. **PersistSynthesis** — save all results to DB
This commit was merged in pull request #12.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package types
|
||||
|
||||
import "time"
|
||||
|
||||
// SynthesisInput contains the input for the synthesis workflow.
|
||||
type SynthesisInput struct {
|
||||
Project string `json:"project"`
|
||||
Source string `json:"source"`
|
||||
Text string `json:"text"`
|
||||
Kind string `json:"kind"` // L1, L2, reference
|
||||
Tags []string `json:"tags,omitempty"`
|
||||
}
|
||||
|
||||
// SynthesisResult contains the output of the synthesis workflow.
|
||||
type SynthesisResult struct {
|
||||
ChunkID string `json:"chunk_id"`
|
||||
EntitiesExtracted int `json:"entities_extracted"`
|
||||
FactsExtracted int `json:"facts_extracted"`
|
||||
Contradictions int `json:"contradictions"`
|
||||
ReviewQueued int `json:"review_queued"`
|
||||
Entities []ExtractedEntity `json:"entities"`
|
||||
Facts []ExtractedFact `json:"facts"`
|
||||
Duration time.Duration `json:"duration"`
|
||||
}
|
||||
|
||||
// ExtractedEntity represents an entity found during synthesis.
|
||||
type ExtractedEntity struct {
|
||||
Name string `json:"name"`
|
||||
EntityType string `json:"entity_type"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
}
|
||||
|
||||
// ExtractedFact represents a fact extracted during synthesis.
|
||||
type ExtractedFact struct {
|
||||
Subject string `json:"subject"`
|
||||
Predicate string `json:"predicate"`
|
||||
Object string `json:"object"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
}
|
||||
|
||||
// ContradictionResult represents a contradiction detection result.
|
||||
type ContradictionResult struct {
|
||||
FactA ExtractedFact `json:"fact_a"`
|
||||
FactB ExtractedFact `json:"fact_b"`
|
||||
Severity string `json:"severity"` // low, medium, high
|
||||
AutoResolved bool `json:"auto_resolved"`
|
||||
QueuedReview bool `json:"queued_review"`
|
||||
}
|
||||
|
||||
// PersistInput groups all synthesis results for persistence.
|
||||
type PersistInput struct {
|
||||
ChunkID string `json:"chunk_id"`
|
||||
Project string `json:"project"`
|
||||
Source string `json:"source"`
|
||||
Kind string `json:"kind"`
|
||||
Entities []ExtractedEntity `json:"entities"`
|
||||
Facts []ExtractedFact `json:"facts"`
|
||||
Contradictions []ContradictionResult `json:"contradictions"`
|
||||
}
|
||||
Reference in New Issue
Block a user