[Phase 2.2] Synthesis activities (5 activities) #13
@@ -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"`
|
||||
}
|
||||
+8
-44
@@ -6,52 +6,16 @@ import (
|
||||
|
||||
"go.temporal.io/sdk/temporal"
|
||||
"go.temporal.io/sdk/workflow"
|
||||
"github.com/rockliang/poimen/workflows/pkg/types"
|
||||
)
|
||||
|
||||
// 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"`
|
||||
}
|
||||
// Re-export shared types from pkg/types for backward compatibility
|
||||
type SynthesisInput = types.SynthesisInput
|
||||
type SynthesisResult = types.SynthesisResult
|
||||
type ExtractedEntity = types.ExtractedEntity
|
||||
type ExtractedFact = types.ExtractedFact
|
||||
type ContradictionResult = types.ContradictionResult
|
||||
type PersistInput = types.PersistInput
|
||||
|
||||
var synthesisActivityOptions = workflow.ActivityOptions{
|
||||
StartToCloseTimeout: 60 * time.Second,
|
||||
|
||||
Reference in New Issue
Block a user