Documentation
¶
Index ¶
- Constants
- Variables
- func EvidenceMatchesAnyProtectedAnchor(row ask.Evidence, anchors []ProtectedAnchor) bool
- func EvidenceMatchesProtectedAnchor(row ask.Evidence, anchor ProtectedAnchor) bool
- func HasCurrentProtectedAnchor(raw string) bool
- func MergeRetryPack(initial Pack, retry Pack, opts MergeRetryOptions) (Pack, MergeRetryDecision)
- type AnchorResolver
- type AnchorSynthesisAnchorStatus
- type AnchorSynthesisContextStatus
- type AttemptPlannerInputObserver
- type AttemptPlannerOutputObserver
- type Bucket
- type Builder
- type Citation
- type Coverage
- type MergeRetryDecision
- type MergeRetryOptions
- type Observer
- type Options
- type Pack
- type PreparedSynthesis
- type ProtectedAnchor
- type QueryConcept
- type QueryPlan
- type QueryVariant
- type SuggestedAction
- type SynthesisOptions
- type SynthesisResult
- type TopicBrief
- type TruncationMetadata
Constants ¶
View Source
const ( SynthesisSchemaVersion = "research_synthesis.v1" SynthesisPromptVersion = "brain-research-synthesis-v3" DefaultMaxEvidenceChars = 24000 )
View Source
const (
SchemaVersion = "research_pack.v1"
)
Variables ¶
Functions ¶
func EvidenceMatchesAnyProtectedAnchor ¶ added in v0.3.0
func EvidenceMatchesAnyProtectedAnchor(row ask.Evidence, anchors []ProtectedAnchor) bool
func EvidenceMatchesProtectedAnchor ¶ added in v0.3.0
func EvidenceMatchesProtectedAnchor(row ask.Evidence, anchor ProtectedAnchor) bool
func HasCurrentProtectedAnchor ¶ added in v0.3.0
func MergeRetryPack ¶ added in v0.3.0
func MergeRetryPack(initial Pack, retry Pack, opts MergeRetryOptions) (Pack, MergeRetryDecision)
Types ¶
type AnchorResolver ¶ added in v0.3.0
type AnchorResolver interface {
ResolveAnchors(ctx context.Context, anchors []ProtectedAnchor) ([]ProtectedAnchor, error)
}
type AnchorSynthesisAnchorStatus ¶ added in v0.3.0
type AnchorSynthesisAnchorStatus struct {
Anchor string `json:"anchor"`
SupportedSourceKeys []string `json:"supported_source_keys,omitempty"`
CitationSourceKeys []string `json:"citation_source_keys,omitempty"`
DroppedSourceKeys []string `json:"dropped_source_keys,omitempty"`
PartiallyTrimmedSourceKeys []string `json:"partially_trimmed_source_keys,omitempty"`
Reasons []string `json:"reasons,omitempty"`
}
type AnchorSynthesisContextStatus ¶ added in v0.3.0
type AnchorSynthesisContextStatus struct {
Anchors []AnchorSynthesisAnchorStatus `json:"anchors,omitempty"`
}
type AttemptPlannerInputObserver ¶ added in v0.3.0
type AttemptPlannerOutputObserver ¶ added in v0.3.0
type Coverage ¶
type Coverage struct {
EvidenceCount int `json:"evidence_count"`
ByKind []Bucket `json:"by_kind"`
BySourceType []Bucket `json:"by_source_type"`
TopUserTags []Bucket `json:"top_user_tags,omitempty"`
ExactTagMatches []Bucket `json:"exact_tag_matches,omitempty"`
ItemTextMatches int `json:"item_text_matches,omitempty"`
SourceTextMatches int `json:"source_text_matches,omitempty"`
TopicNodeCount int `json:"topic_node_count,omitempty"`
TopicEdgeCount int `json:"topic_edge_count,omitempty"`
DisplayedLimit int `json:"displayed_limit"`
RelatedLimit int `json:"related_limit,omitempty"`
RecallNote string `json:"recall_note,omitempty"`
}
type MergeRetryDecision ¶ added in v0.3.0
type MergeRetryDecision struct {
PreservedInitialSourceKeys []string `json:"preserved_initial_source_keys,omitempty"`
AcceptedRetrySourceKeys []string `json:"accepted_retry_source_keys,omitempty"`
RejectedRetrySourceKeys []string `json:"rejected_retry_source_keys,omitempty"`
FinalSourceKeys []string `json:"final_source_keys,omitempty"`
Reason string `json:"reason,omitempty"`
}
type MergeRetryOptions ¶ added in v0.3.0
type Options ¶
type Options struct {
Question string
RawQuestion string
Topic string
Limit int
SourceTypes []string
IncludeRelated bool
RelatedLimit int
SeedLimit int
IncludeTopic *bool
MaxCharsPerDoc int
PlannerModel string
PlannerTimeout time.Duration
PlannerBinary string
UseModelPlanner bool
DisablePlanner bool
UseSemantic bool
DisableSemantic bool
ContinuityAnchors []ProtectedAnchor
Attempt string
AnchorResolver AnchorResolver
Observer Observer
}
type Pack ¶
type Pack struct {
SchemaVersion string `json:"schema_version"`
Question string `json:"question"`
Mode string `json:"mode"`
QueryPlan QueryPlan `json:"query_plan"`
Coverage Coverage `json:"coverage"`
Topic string `json:"topic,omitempty"`
UsedTopicBrief bool `json:"used_topic_brief"`
Evidence []ask.Evidence `json:"evidence"`
ExactTagEvidence []ask.Evidence `json:"exact_tag_evidence,omitempty"`
TopicBrief *TopicBrief `json:"topic_brief,omitempty"`
NextSteps []SuggestedAction `json:"next_steps,omitempty"`
}
type PreparedSynthesis ¶
type PreparedSynthesis struct {
SchemaVersion string `json:"schema_version"`
Question string `json:"question"`
Model string `json:"model"`
PromptVersion string `json:"prompt_version"`
Input string `json:"-"`
Truncation TruncationMetadata `json:"truncation"`
Citations []Citation `json:"citations,omitempty"`
AnchorContext AnchorSynthesisContextStatus `json:"anchor_context,omitempty"`
Warnings []string `json:"answer_warnings,omitempty"`
Status string `json:"answer_status"`
}
func PrepareSynthesis ¶
func PrepareSynthesis(cfg config.Config, opts SynthesisOptions) (PreparedSynthesis, error)
type ProtectedAnchor ¶ added in v0.3.0
type ProtectedAnchor struct {
Kind string `json:"kind"`
Relation string `json:"relation,omitempty"`
Raw string `json:"raw"`
Canonical string `json:"canonical,omitempty"`
ResolvedID string `json:"resolved_id,omitempty"`
Source string `json:"source,omitempty"`
Confidence string `json:"confidence,omitempty"`
ExactTerms []string `json:"exact_terms,omitempty"`
PhraseTerms []string `json:"phrase_terms,omitempty"`
ExpansionTerms []string `json:"expansion_terms,omitempty"`
}
type QueryConcept ¶
type QueryPlan ¶
type QueryPlan struct {
TextQuery string `json:"text_query"`
QueryFamily string `json:"query_family,omitempty"`
QueryTerms []string `json:"query_terms"`
TagQueries []string `json:"tag_queries"`
QueryVariants []QueryVariant `json:"query_variants,omitempty"`
Concepts []QueryConcept `json:"concepts,omitempty"`
ProtectedAnchors []ProtectedAnchor `json:"protected_anchors,omitempty"`
Planner string `json:"planner,omitempty"`
PlannerModel string `json:"planner_model,omitempty"`
PlannerError string `json:"planner_error,omitempty"`
SourceTypes []string `json:"source_types,omitempty"`
RetrievalLanes []retrieval.RetrievalLane `json:"retrieval_lanes,omitempty"`
Limit int `json:"limit"`
MaxCharsPerDoc int `json:"max_chars_per_doc"`
IncludeRelated bool `json:"include_related"`
RelatedLimit int `json:"related_limit,omitempty"`
Topic string `json:"topic,omitempty"`
TopicSource string `json:"topic_source,omitempty"`
IncludeTopicBrief bool `json:"include_topic_brief"`
}
type QueryVariant ¶
type SuggestedAction ¶
type SynthesisOptions ¶
type SynthesisResult ¶
type SynthesisResult struct {
SchemaVersion string `json:"schema_version"`
Question string `json:"question"`
Answer string `json:"answer"`
AnswerStatus string `json:"answer_status"`
Warnings []string `json:"answer_warnings,omitempty"`
Truncation TruncationMetadata `json:"truncation"`
Citations []Citation `json:"citations,omitempty"`
AnchorContext AnchorSynthesisContextStatus `json:"anchor_context,omitempty"`
PromptVersion string `json:"prompt_version"`
Model string `json:"model"`
Tool string `json:"tool"`
ToolVersion string `json:"tool_version"`
}
func RunPreparedSynthesis ¶
func RunPreparedSynthesis(ctx context.Context, cfg config.Config, prepared PreparedSynthesis, opts SynthesisOptions) (SynthesisResult, error)
func Synthesize ¶
func Synthesize(ctx context.Context, cfg config.Config, opts SynthesisOptions) (SynthesisResult, error)
type TopicBrief ¶
type TopicBrief struct {
Topic string `json:"topic"`
SourceTypes []string `json:"source_types,omitempty"`
SeedLimit int `json:"seed_limit"`
RelatedLimit int `json:"related_limit"`
Summary string `json:"summary"`
Pivots topics.TopicPivots `json:"pivots,omitempty"`
Entities []topics.TopicEntity `json:"entities,omitempty"`
Nodes []topics.TopicMapNode `json:"nodes"`
Edges []topics.TopicMapEdge `json:"edges"`
}
type TruncationMetadata ¶
Source Files
¶
- anchor_resolver.go
- anchors.go
- coverage.go
- exact_tags.go
- next_steps.go
- observer.go
- planner.go
- planner_merge.go
- planner_parse.go
- planner_sanitize.go
- research.go
- retry_merge.go
- search_filter.go
- strategy.go
- strategy_concepts.go
- strategy_evidence.go
- strategy_family.go
- strategy_scoring.go
- strategy_variants.go
- synthesize.go
- synthesize_input.go
- synthesize_input_evidence.go
- synthesize_run.go
- synthesize_util.go
- topic.go
- types.go
- util.go
Click to show internal directories.
Click to hide internal directories.