researchrun

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	StopEnoughEvidence                 = "enough_evidence"
	StopNoEvidence                     = "no_evidence"
	StopWeakEvidenceBudgetExhausted    = "weak_evidence_budget_exhausted"
	StopPlannerFailedDeterministicUsed = "planner_failed_deterministic_used"
	StopMaxStepsReached                = "max_steps_reached"
	StopTimeoutExceeded                = "timeout_exceeded"
	StopSynthesisUnavailable           = "synthesis_unavailable"
	StopSynthesisFailed                = "synthesis_failed"
	StopVerificationFailed             = "verification_failed"
	StopTraceFailed                    = "trace_failed"
)
View Source
const (
	JudgeEnoughEvidence JudgeVerdict = "enough_evidence"
	JudgeNoEvidence     JudgeVerdict = "no_evidence"
	JudgeWeakEvidence   JudgeVerdict = "weak_evidence"

	RetryNone             RetryAction = "none"
	RetryFocusedVariant   RetryAction = "focused_retry"
	RetryRelatedExpansion RetryAction = "related_expansion"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnswerReviewResult

type AnswerReviewResult struct {
	Enabled  bool                `json:"enabled"`
	Verdict  AnswerReviewVerdict `json:"verdict,omitempty"`
	Model    string              `json:"model,omitempty"`
	Warnings []string            `json:"warnings,omitempty"`
	Errors   []string            `json:"errors,omitempty"`
	Raw      string              `json:"raw,omitempty"`
}

type AnswerReviewVerdict

type AnswerReviewVerdict string
const (
	AnswerReviewPass        AnswerReviewVerdict = "pass"
	AnswerReviewWarn        AnswerReviewVerdict = "warn"
	AnswerReviewFail        AnswerReviewVerdict = "fail"
	AnswerReviewUnavailable AnswerReviewVerdict = "unavailable"
	AnswerReviewError       AnswerReviewVerdict = "error"
)

type JudgeOptions

type JudgeOptions struct {
	MinEvidenceForEnough int
	AllowRetry           bool
	FocusQuestion        string
}

type JudgeResult

type JudgeResult struct {
	Verdict         JudgeVerdict      `json:"verdict"`
	Reason          string            `json:"reason,omitempty"`
	MissingConcepts []string          `json:"missing_concepts,omitempty"`
	WeakRows        []WeakEvidenceRow `json:"weak_rows,omitempty"`
	AnchorSupport   map[string]int    `json:"anchor_support,omitempty"`
	RetryAction     RetryAction       `json:"retry_action"`
	RetryVariant    string            `json:"retry_variant,omitempty"`
	ExpansionLookup string            `json:"expansion_lookup,omitempty"`
}

func Judge

func Judge(pack brainresearch.Pack, opts JudgeOptions) JudgeResult

type JudgeVerdict

type JudgeVerdict string

type Options

type Options struct {
	Question              string
	RawQuestion           string
	SynthesisQuestion     string
	Topic                 string
	Limit                 int
	SourceTypes           []string
	RelatedLimit          int
	SeedLimit             int
	IncludeTopic          *bool
	MaxCharsPerDoc        int
	InspectionLimit       int
	InspectionMaxChars    int
	PlannerModel          string
	PlannerTimeout        time.Duration
	PlannerBinary         string
	UseModelPlanner       bool
	DisablePlanner        bool
	UseSemantic           bool
	DisableSemantic       bool
	EffectiveSemanticMode semanticconfig.Mode
	Model                 string
	CLI                   string
	Binary                string
	MaxEvidenceChars      int
	SynthesisTimeout      time.Duration
	EnableAnswerReview    bool
	AnswerReviewModel     string
	AnswerReviewBinary    string
	AnswerReviewTimeout   time.Duration
	RunnerTimeout         time.Duration
	StageTimeout          time.Duration
	MaxSteps              int
	StopAfterJudge        bool
	MinEvidenceForEnough  int
	TraceEnabled          *bool
	Surface               string
	ChatContinuity        *researchtrace.ChatContinuity
	KeepAllTraces         bool
	Progress              func(ProgressEvent)
}

type ProgressEvent

type ProgressEvent struct {
	Stage      string                 `json:"stage"`
	Status     string                 `json:"status"`
	Message    string                 `json:"message,omitempty"`
	StopReason string                 `json:"stop_reason,omitempty"`
	Data       map[string]interface{} `json:"data,omitempty"`
}

type Result

type Result struct {
	Pack              brainresearch.Pack               `json:"research_pack"`
	PreparedSynthesis *brainresearch.PreparedSynthesis `json:"prepared_synthesis,omitempty"`
	Synthesis         *brainresearch.SynthesisResult   `json:"synthesis,omitempty"`
	Judge             JudgeResult                      `json:"judge"`
	Verification      VerificationResult               `json:"verification"`
	AnswerReview      AnswerReviewResult               `json:"answer_review,omitempty"`
	TracePath         string                           `json:"trace_path,omitempty"`
	StopReason        string                           `json:"stop_reason"`
	Warnings          []string                         `json:"warnings,omitempty"`
	Retried           bool                             `json:"retried,omitempty"`
}

func Run

func Run(ctx context.Context, cfg config.Config, st *store.Store, opts Options) (Result, error)

type RetryAction

type RetryAction string

type VerificationResult

type VerificationResult struct {
	Passed   bool     `json:"passed"`
	Errors   []string `json:"errors,omitempty"`
	Warnings []string `json:"warnings,omitempty"`
}

func GuardAnchoredAnswer added in v0.3.0

func VerifyPreparedCitations added in v0.5.0

func VerifyPreparedCitations(prepared brainresearch.PreparedSynthesis, result brainresearch.SynthesisResult) VerificationResult

VerifyPreparedCitations verifies against the exact evidence admitted to the synthesis prompt, rather than the wider retrieval pack. This rejects citations to rows removed by relevance selection or evidence-budget truncation.

type WeakEvidenceRow

type WeakEvidenceRow struct {
	SourceKey       string   `json:"source_key"`
	Reason          string   `json:"reason"`
	Relationship    string   `json:"relationship,omitempty"`
	MissingConcepts []string `json:"missing_concepts,omitempty"`
}

Jump to

Keyboard shortcuts

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