models

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsKnownAggregatorURL added in v0.10.0

func IsKnownAggregatorURL(sourceURL string) bool

IsKnownAggregatorURL reports whether sourceURL's host matches (or is a subdomain of) a known aggregator domain. Exported so callers outside this package (the orchestrator's VEAL verification loop) can reject an aggregator-sourced candidate before it ever reaches classifySourceType.

func ParseAsOfDate added in v0.10.0

func ParseAsOfDate(s string) (*time.Time, error)

ParseAsOfDate parses an LLM- or user-supplied "YYYY-MM-DD" as_of_date. An empty string is not an error — the field is optional, and callers (LLM prompts) are instructed to omit it rather than guess. A non-empty, unparseable value is returned as an error so the caller can log and drop it instead of silently keeping a bad date.

Types

type CandidateStatistic

type CandidateStatistic struct {
	Name      string           `json:"name"`
	Value     float32          `json:"value"`
	Unit      string           `json:"unit"`
	Precision claims.Precision `json:"precision,omitempty"`
	Source    string           `json:"source"`
	SourceURL string           `json:"source_url"`
	Excerpt   string           `json:"excerpt"`
	AsOfDate  *time.Time       `json:"as_of_date,omitempty"`
}

CandidateStatistic represents an unverified statistic from research

type OrchestrationRequest

type OrchestrationRequest struct {
	Topic            string `json:"topic"`
	MinVerifiedStats int    `json:"min_verified_stats"` // Minimum verified statistics required
	MaxCandidates    int    `json:"max_candidates"`     // Maximum candidates to research
	ReputableOnly    bool   `json:"reputable_only"`
}

OrchestrationRequest represents the main request to the orchestrator

type OrchestrationResponse

type OrchestrationResponse struct {
	Topic           string      `json:"topic"`
	Statistics      []Statistic `json:"statistics"`
	TotalCandidates int         `json:"total_candidates"`
	VerifiedCount   int         `json:"verified_count"`
	FailedCount     int         `json:"failed_count"`
	Timestamp       time.Time   `json:"timestamp"`
	Partial         bool        `json:"partial"`                   // True if target not met
	TargetCount     int         `json:"target_count"`              // The minimum requested
	ContinuationID  string      `json:"continuation_id,omitempty"` // ID for continuing the search
}

OrchestrationResponse represents the final response

func (*OrchestrationResponse) ToClaimsReport added in v0.8.0

func (r *OrchestrationResponse) ToClaimsReport() *claims.ClaimsReport

ToClaimsReport converts OrchestrationResponse to a ClaimsReport. This provides a standardized output format compatible with structured-evaluation.

func (*OrchestrationResponse) ToClaimsReportWithFailures added in v0.8.0

func (r *OrchestrationResponse) ToClaimsReportWithFailures(
	failures []VerificationResult,
) *claims.ClaimsReport

ToClaimsReportWithFailures includes both verified and failed verification results. This provides a complete audit trail of all statistics that were checked.

type ResearchRequest

type ResearchRequest struct {
	Topic         string `json:"topic"`
	MinStatistics int    `json:"min_statistics"` // Minimum number of statistics to find
	MaxStatistics int    `json:"max_statistics"` // Maximum number of statistics to find
	ReputableOnly bool   `json:"reputable_only"` // Only search reputable sources
}

ResearchRequest represents a request to find statistics

type ResearchResponse

type ResearchResponse struct {
	Topic         string         `json:"topic"`
	SearchResults []SearchResult `json:"search_results"`
	Timestamp     time.Time      `json:"timestamp"`
}

ResearchResponse represents the response from research agent. The research worker's job is source discovery (web search), not extraction — it returns SearchResults (URL/title/snippet/domain), not CandidateStatistics. Extraction is the synthesis worker's job.

type SearchResult

type SearchResult struct {
	URL      string `json:"url"`
	Title    string `json:"title"`
	Snippet  string `json:"snippet"`
	Domain   string `json:"domain"`
	Position int    `json:"position,omitempty"`
}

SearchResult represents a source URL from research agent

type Statistic

type Statistic struct {
	Name      string           `json:"name"`                 // Name/description of the statistic
	Value     float32          `json:"value"`                // Numerical value
	Unit      string           `json:"unit"`                 // Unit of measurement (e.g., "°C", "%", "million")
	Precision claims.Precision `json:"precision,omitempty"`  // How exact Value is (exact/approximate/estimated/range); empty means unknown/unset
	Source    string           `json:"source"`               // Name of the source (e.g., "Pew Research Center")
	SourceURL string           `json:"source_url"`           // URL to the source
	Excerpt   string           `json:"excerpt"`              // Verbatim quote containing the statistic
	Verified  bool             `json:"verified"`             // Whether this has been verified by verification agent
	DateFound time.Time        `json:"date_found"`           // When the research pipeline found this statistic (crawl time)
	AsOfDate  *time.Time       `json:"as_of_date,omitempty"` // When the underlying fact was true, if known — distinct from DateFound
}

Statistic represents a verified statistic with its source

type SynthesisRequest

type SynthesisRequest struct {
	Topic         string         `json:"topic"`
	SearchResults []SearchResult `json:"search_results"`
	MinStatistics int            `json:"min_statistics"`
	MaxStatistics int            `json:"max_statistics"`
}

SynthesisRequest is the request to synthesis agent

type SynthesisResponse

type SynthesisResponse struct {
	Topic           string               `json:"topic"`
	Candidates      []CandidateStatistic `json:"candidates"`
	SourcesAnalyzed int                  `json:"sources_analyzed"`
	Timestamp       time.Time            `json:"timestamp"`
}

SynthesisResponse is the response from synthesis agent

type VerificationRequest

type VerificationRequest struct {
	Candidates []CandidateStatistic `json:"candidates"`
}

VerificationRequest represents a request to verify statistics

type VerificationResponse

type VerificationResponse struct {
	Results   []VerificationResult `json:"results"`
	Verified  int                  `json:"verified_count"`
	Failed    int                  `json:"failed_count"`
	Timestamp time.Time            `json:"timestamp"`
}

VerificationResponse represents the response from verification agent

func (*VerificationResponse) ToClaimsReport added in v0.8.0

func (r *VerificationResponse) ToClaimsReport(topic string) *claims.ClaimsReport

ToClaimsReport converts a VerificationResponse to a ClaimsReport. This is useful when you want to report on verification results directly.

type VerificationResult

type VerificationResult struct {
	Statistic *Statistic `json:"statistic"`
	Verified  bool       `json:"verified"`
	Reason    string     `json:"reason,omitempty"` // Why verification failed (if applicable)
}

VerificationResult represents the result of verifying a statistic

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL