deepresearch

package
v0.0.0-...-9e5e0b2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 26 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

This section is empty.

Variables

View Source
var (
	ErrJobNotFound        = errors.New("job not found")
	ErrJobForbidden       = errors.New("job forbidden")
	ErrReportNotReady     = errors.New("report not ready")
	ErrJobAlreadyTerminal = errors.New("job already terminal")
	ErrInvalidRouteMode   = errors.New("invalid route_mode")
	ErrRateLimited        = errors.New("deep research rate limit exceeded")
	ErrTooManyActiveJobs  = errors.New("too many deep research jobs in progress")
)

Functions

This section is empty.

Types

type Budget

type Budget struct {
	MaxSteps   int `json:"max_steps"`
	MaxSources int `json:"max_sources"`
	MaxSeconds int `json:"max_seconds"`
}

type Calibration

type Calibration struct {
	Coverage           float64             `json:"coverage"`
	Groundedness       float64             `json:"groundedness"`
	Freshness          float64             `json:"freshness"`
	ConflictRisk       string              `json:"conflict_risk"`
	Confidence         float64             `json:"confidence"`
	RecommendedAction  string              `json:"recommended_action"`
	TakeawayCandidates []TakeawayCandidate `json:"takeaway_candidates,omitempty"`
}

type Citation

type Citation struct {
	EvidenceID string `json:"evidence_id"`
	Title      string `json:"title"`
	URL        string `json:"url"`
}

type CreateJobRequest

type CreateJobRequest struct {
	RequestedID    string                 `json:"requested_id,omitempty"`
	UserID         string                 `json:"user_id,omitempty"`
	TenantID       string                 `json:"tenant_id,omitempty"`
	ConversationID string                 `json:"conversation_id,omitempty"`
	ProviderID     string                 `json:"provider_id,omitempty"`
	Query          string                 `json:"query"`
	RetryContext   string                 `json:"retry_context,omitempty"`
	RetryFeedback  map[string]interface{} `json:"retry_feedback,omitempty"`
	Mode           Mode                   `json:"mode,omitempty"`
	RouteMode      RouteMode              `json:"route_mode,omitempty"`
	Lang           string                 `json:"lang,omitempty"`
	Budget         *Budget                `json:"budget,omitempty"`
	StrictEntity   *bool                  `json:"strict_entity,omitempty"`
	TimeWindows    []string               `json:"time_windows,omitempty"`
	ReportStyle    string                 `json:"report_style,omitempty"`
}

type EntityDisambiguation

type EntityDisambiguation struct {
	Enabled        bool    `json:"enabled"`
	Threshold      float64 `json:"threshold"`
	FilteredCount  int     `json:"filtered_count,omitempty"`
	AmbiguousCount int     `json:"ambiguous_count,omitempty"`
}

type Event

type Event struct {
	ID        string      `json:"id,omitempty"`
	Type      string      `json:"type"`
	Timestamp time.Time   `json:"timestamp"`
	Payload   interface{} `json:"payload,omitempty"`
}

type EventPublisher

type EventPublisher interface {
	Publish(userID string, eventType string, data any)
}

type Evidence

type Evidence struct {
	ID               string     `json:"id"`
	TaskID           string     `json:"task_id"`
	Query            string     `json:"query"`
	Title            string     `json:"title"`
	URL              string     `json:"url"`
	Snippet          string     `json:"snippet,omitempty"`
	Source           string     `json:"source,omitempty"`
	Domain           string     `json:"domain,omitempty"`
	FetchedAt        time.Time  `json:"fetched_at"`
	PublishedAt      *time.Time `json:"published_at,omitempty"`
	Author           string     `json:"author,omitempty"`
	Quote            string     `json:"quote,omitempty"`
	RelevanceScore   float64    `json:"relevance_score"`
	CredibilityScore float64    `json:"credibility_score"`
	NoveltyScore     float64    `json:"novelty_score"`
	EntityScore      float64    `json:"entity_score,omitempty"`
	ClaimKey         string     `json:"claim_key,omitempty"`
	TimeLabel        string     `json:"time_label,omitempty"`
}

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) CancelJob

func (h *Handler) CancelJob(c echo.Context) error

func (*Handler) CreateJob

func (h *Handler) CreateJob(c echo.Context) error

func (*Handler) GetJob

func (h *Handler) GetJob(c echo.Context) error

func (*Handler) GetReport

func (h *Handler) GetReport(c echo.Context) error

func (*Handler) ListJobs

func (h *Handler) ListJobs(c echo.Context) error

func (*Handler) RegisterGroup

func (h *Handler) RegisterGroup(g *echo.Group)

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(e *echo.Echo)

func (*Handler) SetJobCreator

func (h *Handler) SetJobCreator(creator interface {
	CreateJob(ctx context.Context, req CreateJobRequest) (*Job, error)
})

func (*Handler) SetJobService

func (h *Handler) SetJobService(service interface {
	ListJobsForUser(userID, tenantID string, activeOnly bool) ([]JobSummary, error)
	GetJobForUser(id, userID, tenantID string) (*Job, error)
	GetReportForUser(id, userID, tenantID string) (*Report, error)
	CancelJobForUser(id, userID, tenantID string) error
	SubscribeForUser(jobID, userID, tenantID string) (<-chan Event, func(), error)
})

func (*Handler) StreamEvents

func (h *Handler) StreamEvents(c echo.Context) error

type HeuristicPlanner

type HeuristicPlanner struct{}

func NewHeuristicPlanner

func NewHeuristicPlanner() *HeuristicPlanner

func (*HeuristicPlanner) Plan

func (p *HeuristicPlanner) Plan(query string, mode Mode, lang string) []Task

type Job

type Job struct {
	ID                 string                 `json:"id"`
	ConversationID     string                 `json:"conversation_id,omitempty"`
	UserID             string                 `json:"user_id,omitempty"`
	TenantID           string                 `json:"tenant_id,omitempty"`
	ProviderID         string                 `json:"provider_id,omitempty"`
	Query              string                 `json:"query"`
	RetryContext       string                 `json:"retry_context,omitempty"`
	RetryFeedback      map[string]interface{} `json:"retry_feedback,omitempty"`
	Lang               string                 `json:"lang,omitempty"`
	Mode               Mode                   `json:"mode"`
	RequestedRouteMode RouteMode              `json:"requested_route_mode,omitempty"`
	EffectiveRouteMode RouteMode              `json:"effective_route_mode,omitempty"`
	RouteReason        string                 `json:"route_reason,omitempty"`
	StrictEntity       bool                   `json:"strict_entity,omitempty"`
	TimeWindows        []string               `json:"time_windows,omitempty"`
	ReportStyle        string                 `json:"report_style,omitempty"`
	Status             JobStatus              `json:"status"`
	Budget             Budget                 `json:"budget"`
	Progress           int                    `json:"progress"`
	Stage              string                 `json:"stage,omitempty"`
	Iteration          int                    `json:"iteration,omitempty"`
	LatestGap          string                 `json:"latest_gap,omitempty"`
	LatestAction       string                 `json:"latest_action,omitempty"`
	Error              string                 `json:"error,omitempty"`
	CreatedAt          time.Time              `json:"created_at"`
	UpdatedAt          time.Time              `json:"updated_at"`
	CompletedAt        *time.Time             `json:"completed_at,omitempty"`
	Tasks              []Task                 `json:"tasks,omitempty"`
	Evidence           []Evidence             `json:"evidence,omitempty"`
	Report             *Report                `json:"report,omitempty"`
}

type JobStatus

type JobStatus string
const (
	JobStatusPending      JobStatus = "pending"
	JobStatusRunning      JobStatus = "running"
	JobStatusSynthesizing JobStatus = "synthesizing"
	JobStatusCompleted    JobStatus = "completed"
	JobStatusFailed       JobStatus = "failed"
	JobStatusCancelled    JobStatus = "cancelled"
)

type JobSummary

type JobSummary struct {
	ID             string    `json:"id"`
	JobID          string    `json:"job_id"`
	Query          string    `json:"query"`
	Status         JobStatus `json:"status"`
	Stage          string    `json:"stage,omitempty"`
	Progress       int       `json:"progress"`
	Iteration      int       `json:"iteration,omitempty"`
	LatestAction   string    `json:"latest_action,omitempty"`
	LatestGap      string    `json:"latest_gap,omitempty"`
	ConversationID string    `json:"conversation_id,omitempty"`
	UpdatedAt      time.Time `json:"updated_at"`
}

type Mode

type Mode string
const (
	ModeFast     Mode = "fast"
	ModeStandard Mode = "standard"
	ModeDeep     Mode = "deep"
)

type Planner

type Planner interface {
	Plan(query string, mode Mode, lang string) []Task
}

type Report

type Report struct {
	Answer               string                   `json:"answer"`
	Confidence           float64                  `json:"confidence"`
	Citations            []Citation               `json:"citations"`
	OpenQuestions        []string                 `json:"open_questions,omitempty"`
	SupportCount         int                      `json:"support_count,omitempty"`
	ConflictCount        int                      `json:"conflict_count,omitempty"`
	HasConflict          bool                     `json:"has_conflict,omitempty"`
	Iterations           int                      `json:"iterations,omitempty"`
	StopReason           string                   `json:"stop_reason,omitempty"`
	CitationCoverage     float64                  `json:"citation_coverage,omitempty"`
	EntityDisambiguation *EntityDisambiguation    `json:"entity_disambiguation,omitempty"`
	StageErrors          []string                 `json:"stage_errors,omitempty"`
	TimelineSections     []TimelineSection        `json:"timeline_sections,omitempty"`
	ResearchTrace        []ResearchTraceEntry     `json:"research_trace,omitempty"`
	VerificationSummary  *VerificationSummary     `json:"verification_summary,omitempty"`
	Calibration          *Calibration             `json:"calibration,omitempty"`
	ItemsBySource        map[string]interface{}   `json:"items_by_source,omitempty"`
	ErrorsBySource       map[string]string        `json:"errors_by_source,omitempty"`
	Clusters             []map[string]interface{} `json:"clusters,omitempty"`
	LookbackDays         int                      `json:"lookback_days,omitempty"`
	BrowserAssisted      bool                     `json:"browser_assisted,omitempty"`
	RetrievalProfile     string                   `json:"retrieval_profile,omitempty"`
}

type ResearchTraceEntry

type ResearchTraceEntry struct {
	Iteration           int    `json:"iteration"`
	Focus               string `json:"focus,omitempty"`
	Gap                 string `json:"gap,omitempty"`
	FollowUpQuery       string `json:"follow_up_query,omitempty"`
	EvidenceAdded       int    `json:"evidence_added,omitempty"`
	VerificationOutcome string `json:"verification_outcome,omitempty"`
}

type RouteMode

type RouteMode string
const (
	RouteModeWeb RouteMode = "web"
)

type RoutePolicy

type RoutePolicy struct{}

type SearchHit

type SearchHit struct {
	Title       string
	URL         string
	Description string
	Source      string
}

type Searcher

type Searcher interface {
	Search(ctx context.Context, query string, maxResults int, lang string) ([]SearchHit, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(planner Planner, searcher Searcher) *Service

func (*Service) CancelJob

func (s *Service) CancelJob(id string) error

func (*Service) CancelJobForUser

func (s *Service) CancelJobForUser(id, userID, tenantID string) error

func (*Service) CreateJob

func (s *Service) CreateJob(ctx context.Context, req CreateJobRequest) (*Job, error)

func (*Service) GetJob

func (s *Service) GetJob(id string) (*Job, error)

func (*Service) GetJobForUser

func (s *Service) GetJobForUser(id, userID, tenantID string) (*Job, error)

func (*Service) GetReport

func (s *Service) GetReport(id string) (*Report, error)

func (*Service) GetReportForUser

func (s *Service) GetReportForUser(id, userID, tenantID string) (*Report, error)

func (*Service) IsV2Enabled

func (s *Service) IsV2Enabled() bool

func (*Service) ListJobsForUser

func (s *Service) ListJobsForUser(userID, tenantID string, activeOnly bool) ([]JobSummary, error)

func (*Service) SetEventPublisher

func (s *Service) SetEventPublisher(publisher EventPublisher)

func (*Service) SetRoutePolicy

func (s *Service) SetRoutePolicy(policy RoutePolicy)

func (*Service) SetSummarySynthesizer

func (s *Service) SetSummarySynthesizer(synth SummarySynthesizer)

func (*Service) SetV2Enabled

func (s *Service) SetV2Enabled(enabled bool)

func (*Service) Subscribe

func (s *Service) Subscribe(jobID string) (<-chan Event, func(), error)

func (*Service) SubscribeForUser

func (s *Service) SubscribeForUser(jobID, userID, tenantID string) (<-chan Event, func(), error)

type SkillExecutor

type SkillExecutor struct {
	// contains filtered or unexported fields
}

SkillExecutor adapts deep research service to builtin skill executor interface.

func NewSkillExecutor

func NewSkillExecutor(service *Service) *SkillExecutor

func (*SkillExecutor) Execute

func (e *SkillExecutor) Execute(ctx context.Context, args map[string]interface{}) (interface{}, error)

Execute runs deep research synchronously for skill invocation and returns a map result.

func (*SkillExecutor) SetV2Enabled

func (e *SkillExecutor) SetV2Enabled(enabled bool)

type SummaryInput

type SummaryInput struct {
	Query               string
	Lang                string
	Evidence            []Evidence
	AllEvidence         []Evidence
	Draft               string
	ResearchTrace       []ResearchTraceEntry
	VerificationSummary *VerificationSummary
}

type SummarySynthesizer

type SummarySynthesizer interface {
	Summarize(ctx context.Context, input SummaryInput) (string, error)
}

type TakeawayCandidate

type TakeawayCandidate struct {
	Lesson      string   `json:"lesson"`
	WhenToApply string   `json:"when_to_apply,omitempty"`
	Evidence    string   `json:"evidence"`
	EvidenceIDs []string `json:"evidence_ids,omitempty"`
	Confidence  float64  `json:"confidence,omitempty"`
	TargetFile  string   `json:"target_file,omitempty"`
}

type Task

type Task struct {
	ID          string   `json:"id"`
	Question    string   `json:"question"`
	Priority    int      `json:"priority"`
	Depth       int      `json:"depth"`
	Status      string   `json:"status"`
	Axis        string   `json:"axis,omitempty"`
	Category    string   `json:"category,omitempty"`
	TimeWindow  string   `json:"time_window,omitempty"`
	FollowUpOf  string   `json:"follow_up_of,omitempty"`
	NegKeywords []string `json:"neg_keywords,omitempty"`
}

type TimelineSection

type TimelineSection struct {
	Label       string   `json:"label"`
	Highlights  []string `json:"highlights,omitempty"`
	EvidenceIDs []string `json:"evidence_ids,omitempty"`
}

type ToolWebSearcher

type ToolWebSearcher struct {
	// contains filtered or unexported fields
}

func NewToolWebSearcher

func NewToolWebSearcher() *ToolWebSearcher

func NewToolWebSearcherWithConfig

func NewToolWebSearcherWithConfig(cfg tools.WebSearchConfig) *ToolWebSearcher

func (*ToolWebSearcher) Search

func (s *ToolWebSearcher) Search(ctx context.Context, query string, maxResults int, lang string) ([]SearchHit, error)

type VerificationItem

type VerificationItem struct {
	Focus       string   `json:"focus,omitempty"`
	Gap         string   `json:"gap,omitempty"`
	Status      string   `json:"status,omitempty"`
	Summary     string   `json:"summary,omitempty"`
	EvidenceIDs []string `json:"evidence_ids,omitempty"`
}

type VerificationSummary

type VerificationSummary struct {
	ResolvedCount     int                `json:"resolved_count,omitempty"`
	ConflictedCount   int                `json:"conflicted_count,omitempty"`
	InsufficientCount int                `json:"insufficient_count,omitempty"`
	Items             []VerificationItem `json:"items,omitempty"`
}

Jump to

Keyboard shortcuts

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