Documentation
¶
Index ¶
- Constants
- type AnswerReviewResult
- type AnswerReviewVerdict
- type JudgeOptions
- type JudgeResult
- type JudgeVerdict
- type Options
- type ProgressEvent
- type Result
- type RetryAction
- type VerificationResult
- func GuardAnchoredAnswer(pack brainresearch.Pack, prepared brainresearch.PreparedSynthesis, ...) VerificationResult
- func VerifyCitations(pack brainresearch.Pack, result brainresearch.SynthesisResult) VerificationResult
- func VerifyPreparedCitations(prepared brainresearch.PreparedSynthesis, result brainresearch.SynthesisResult) VerificationResult
- type WeakEvidenceRow
Constants ¶
const ( StopEnoughEvidence = "enough_evidence" StopNoEvidence = "no_evidence" StopWeakEvidenceBudgetExhausted = "weak_evidence_budget_exhausted" StopPlannerFailedDeterministicUsed = "planner_failed_deterministic_used" StopMaxStepsReached = "max_steps_reached" StopTimeoutExceeded = "timeout_exceeded" StopSynthesisFailed = "synthesis_failed" StopVerificationFailed = "verification_failed" StopTraceFailed = "trace_failed" )
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"`
}
func RunAnswerReview ¶
func RunAnswerReview(ctx context.Context, cfg config.Config, prepared brainresearch.PreparedSynthesis, synthesis brainresearch.SynthesisResult, opts Options) AnswerReviewResult
type AnswerReviewVerdict ¶
type AnswerReviewVerdict string
const ( AnswerReviewPass AnswerReviewVerdict = "pass" AnswerReviewWarn AnswerReviewVerdict = "warn" AnswerReviewFail AnswerReviewVerdict = "fail" AnswerReviewError AnswerReviewVerdict = "error" )
type JudgeOptions ¶
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
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 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"`
}
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 GuardAnchoredAnswer(pack brainresearch.Pack, prepared brainresearch.PreparedSynthesis, synthesis brainresearch.SynthesisResult) VerificationResult
func VerifyCitations ¶
func VerifyCitations(pack brainresearch.Pack, result brainresearch.SynthesisResult) VerificationResult
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.