retrieval

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderHealthAvailable          = "available"
	ProviderHealthCredentialMissing  = "credential_missing"
	ProviderHealthCredentialInvalid  = "credential_invalid"
	ProviderHealthQuotaLimited       = "quota_limited"
	ProviderHealthRateLimited        = "rate_limited"
	ProviderHealthNetworkBlocked     = "network_blocked"
	ProviderHealthUnsupportedFeature = "unsupported_feature"
	ProviderHealthStatusError        = "status_error"
	ProviderHealthDecodeError        = "decode_error"
	ProviderHealthRequestFailed      = "request_failed"
	ProviderHealthTimeout            = "timeout"
	ProviderHealthUnknown            = "unknown"
)
View Source
const (
	ProviderDirectHTTP = "direct_http"
	ProviderFirecrawl  = "firecrawl"
)
View Source
const (
	DefaultSearchEndpoint      = "https://api.search.brave.com/res/v1/web/search"
	DefaultSearchPerplexityURL = "https://api.perplexity.ai/chat/completions"
	DefaultSearchOpenRouterURL = "https://openrouter.ai/api/v1/chat/completions"
	DefaultSearchArkURL        = "https://open.feedcoopapi.com/search_api/web_search"
	DefaultSearchBaiduURL      = "https://qianfan.baidubce.com/v2/ai_search/web_search"
	DefaultSearchProvider      = "brave"
)

Variables

This section is empty.

Functions

func AppendSearchProviderNote

func AppendSearchProviderNote(current string, note string) string

func BuildFreshnessFromDateRange

func BuildFreshnessFromDateRange(dateAfter string, dateBefore string, now time.Time) string

func CanUsePerplexityStructuredDateFilters

func CanUsePerplexityStructuredDateFilters(apiKey string, baseURL string) bool

func CompactWhitespace

func CompactWhitespace(value string) string

func DefaultSearchEndpointForProvider

func DefaultSearchEndpointForProvider(provider string) string

func FetchProviderForExtractor

func FetchProviderForExtractor(extractor string) string

func FirstHTTPURLAlias

func FirstHTTPURLAlias(params map[string]any) (field string, rawURL string, ok bool)

FirstHTTPURLAlias returns the first safe retrieval URL alias when no canonical url is present.

func FirstNonBlank

func FirstNonBlank(values ...string) string

func FormatDateForPerplexity

func FormatDateForPerplexity(value string) string

func InferOpenPageWarning

func InferOpenPageWarning(page Page) string

InferOpenPageWarning derives a generic page-quality warning for page follow-up flows. It intentionally stays domain-neutral and only classifies generic shell/no-text/consent-wall cases.

func IsHTTPURLAliasCandidate

func IsHTTPURLAliasCandidate(value string) bool

IsHTTPURLAliasCandidate reports whether value is an absolute http(s) URL.

func IsSupportedSearchProvider

func IsSupportedSearchProvider(provider string) bool

func IsSynthesizedSearchProvider

func IsSynthesizedSearchProvider(provider string) bool

func IsValidISODate

func IsValidISODate(value string) bool

func LooksLikeHTML

func LooksLikeHTML(value string) bool

func LooksLikeMarkdownContentType

func LooksLikeMarkdownContentType(contentType string) bool

func MapFreshnessForArk

func MapFreshnessForArk(value string) (string, bool)

func MapFreshnessForBaidu

func MapFreshnessForBaidu(value string) (string, bool)

func MapFreshnessForPerplexity

func MapFreshnessForPerplexity(value string) (string, bool)

func MarkdownToPlainText

func MarkdownToPlainText(value string) string

func NormalizeFreshness

func NormalizeFreshness(value string) string

func NormalizeProviderHealthStatus

func NormalizeProviderHealthStatus(raw string) string

func NormalizeSearchDomainFilter

func NormalizeSearchDomainFilter(items []string) ([]string, string)

func NormalizeSearchProvider

func NormalizeSearchProvider(value string) string

func NormalizeWebFetchContentType

func NormalizeWebFetchContentType(raw string) string

NormalizeWebFetchContentType canonicalizes content-type strings for shared fetch/page flows.

func NormalizeWebFetchExtractMode

func NormalizeWebFetchExtractMode(raw string) string

NormalizeWebFetchExtractMode canonicalizes fetch extract modes for shared fetch/page flows.

func OpenPageCacheKey

func OpenPageCacheKey(urlValue string, maxChars int, maxResponseBytes int, requestSignature string) string

func OpenPageIDForCacheKey

func OpenPageIDForCacheKey(key string) string

func ReadWebFetchCache

func ReadWebFetchCache(key string) ([]byte, bool)

func ResetOpenPageCache

func ResetOpenPageCache()

func ResetSearchCache

func ResetSearchCache()

func ResetWebFetchCache

func ResetWebFetchCache()

func ResolveDateFilterProvider

func ResolveDateFilterProvider(currentProvider string, configuredProvider string, configuredProviderAPIKey string, configuredPerplexityAPIKey string, configuredPerplexityURL string, isConfigured func(provider string, providerAPIKey string, perplexityAPIKey string) bool) string

func ResolveSearchSiteName

func ResolveSearchSiteName(value string) string

func SearchCacheKey

func SearchCacheKey(provider string, query string, count int, country string, searchLang string, uiLang string, freshness string, dateAfter string, dateBefore string, domainFilter []string, model string, trustedEnvProxy bool) string

func TruncateToolText

func TruncateToolText(value string, max int) string

func WebFetchCacheKey

func WebFetchCacheKey(urlValue string, maxChars int, maxResponseBytes int, extractMode string, requestSignature string) string

func WriteOpenPageCache

func WriteOpenPageCache(key string, page Page, ttl time.Duration)

func WriteSearchCache

func WriteSearchCache(key string, payload SearchPayload, ttl time.Duration)

func WriteWebFetchCache

func WriteWebFetchCache(key string, payload []byte, ttl time.Duration)

Types

type ExecuteWebFetchOptions

type ExecuteWebFetchOptions struct {
	ToolName                string
	RawURL                  string
	DefaultExtractMode      string
	RequestedExtractMode    string
	UseCache                bool
	RequestMaxChars         int
	RequestMaxResponseBytes int
	RequestTimeoutMs        int
	MaxRedirects            int
	UserAgent               string
	RequestSignature        string
	CacheTTL                time.Duration
	Firecrawl               WebFetchFirecrawlConfig
	Prepare                 Preparer
	ClassifyNetworkError    NetworkErrorClassifier
}

type ExternalContentMeta

type ExternalContentMeta struct {
	Untrusted bool     `json:"untrusted"`
	Source    string   `json:"source,omitempty"`
	Wrapped   bool     `json:"wrapped,omitempty"`
	Fields    []string `json:"fields,omitempty"`
}

ExternalContentMeta identifies untrusted fields returned by retrieval.

type FetchProviderDiagnosticsInput

type FetchProviderDiagnosticsInput struct {
	Tool              string
	RequestedProvider string
	EffectiveProvider string
	ProviderNote      string
	IncludeFirecrawl  bool
	FallbackFrom      string
	FallbackTo        string
	FallbackReason    string
	FallbackHint      string
}

type FindInPageDiagnostics

type FindInPageDiagnostics struct {
	Scope             string   `json:"scope,omitempty"`
	PageCacheHit      bool     `json:"page_cache_hit"`
	PageTextOK        bool     `json:"page_text_ok,omitempty"`
	Issue             string   `json:"issue,omitempty"`
	MatchStatus       string   `json:"match_status,omitempty"`
	SuggestedNextTool string   `json:"suggested_next_tool,omitempty"`
	Retryable         bool     `json:"retryable,omitempty"`
	Warnings          []string `json:"warnings,omitempty"`
}

type FindInPageResult

type FindInPageResult struct {
	PageID      string                 `json:"page_id"`
	Query       string                 `json:"query"`
	Status      string                 `json:"status,omitempty"`
	Error       string                 `json:"error,omitempty"`
	ErrorClass  string                 `json:"error_class,omitempty"`
	Title       string                 `json:"title,omitempty"`
	FinalURL    string                 `json:"final_url,omitempty"`
	MatchCount  int                    `json:"match_count"`
	HasMore     bool                   `json:"has_more,omitempty"`
	Matches     []PageMatch            `json:"matches,omitempty"`
	Diagnostics *FindInPageDiagnostics `json:"diagnostics,omitempty"`
}

func FindInPage

func FindInPage(page Page, query string, maxMatches int, contextChars int) FindInPageResult

func FindInPageCacheMiss

func FindInPageCacheMiss(pageID string, query string) FindInPageResult

type NetworkErrorClass

type NetworkErrorClass string

NetworkErrorClass lets a Host retain its own network error identities while mapping them into the stable retrieval error vocabulary.

const (
	NetworkErrorUnknown       NetworkErrorClass = ""
	NetworkErrorRedirectLimit NetworkErrorClass = "redirect_limit"
	NetworkErrorProxyConfig   NetworkErrorClass = "proxy_config"
	NetworkErrorPolicyBlocked NetworkErrorClass = "policy_blocked"
)

type NetworkErrorClassifier

type NetworkErrorClassifier func(error) NetworkErrorClass

NetworkErrorClassifier maps a Host-specific error without transferring policy ownership into this package.

type Page

type Page struct {
	PageID              string               `json:"page_id"`
	RequestURL          string               `json:"request_url"`
	FinalURL            string               `json:"final_url"`
	Status              int                  `json:"status"`
	ContentType         string               `json:"content_type,omitempty"`
	SiteName            string               `json:"site_name,omitempty"`
	Title               string               `json:"title,omitempty"`
	Byline              string               `json:"byline,omitempty"`
	Excerpt             string               `json:"excerpt,omitempty"`
	Text                string               `json:"text"`
	Markdown            string               `json:"markdown,omitempty"`
	Links               []PageLink           `json:"links,omitempty"`
	Extractor           string               `json:"extractor,omitempty"`
	FallbackUsed        bool                 `json:"fallback_used,omitempty"`
	ReadabilityUsed     bool                 `json:"readability_used,omitempty"`
	Truncated           bool                 `json:"truncated,omitempty"`
	Warning             string               `json:"warning,omitempty"`
	WordCount           int                  `json:"word_count,omitempty"`
	FetchedAt           int64                `json:"fetched_at"`
	TookMs              int64                `json:"took_ms,omitempty"`
	Diagnostics         *PageDiagnostics     `json:"diagnostics,omitempty"`
	ProviderDiagnostics *ProviderDiagnostics `json:"provider_diagnostics,omitempty"`
}

func ReadOpenPageCache

func ReadOpenPageCache(key string) (Page, bool)

func ReadOpenPageCacheByID

func ReadOpenPageCacheByID(pageID string) (Page, bool)

func ReadOpenPageCacheByURL

func ReadOpenPageCacheByURL(urlValue string) (Page, bool)

type PageDiagnostics

type PageDiagnostics struct {
	PageTextOK        bool     `json:"page_text_ok"`
	Issue             string   `json:"issue,omitempty"`
	ExtractionMethod  string   `json:"extraction_method,omitempty"`
	ExtractMode       string   `json:"extract_mode,omitempty"`
	Redirected        bool     `json:"redirected,omitempty"`
	RedirectCount     int      `json:"redirect_count,omitempty"`
	CacheHit          bool     `json:"cache_hit,omitempty"`
	BodyTruncated     bool     `json:"body_truncated,omitempty"`
	ContentTruncated  bool     `json:"content_truncated,omitempty"`
	ResponseBytes     int      `json:"response_bytes,omitempty"`
	SuggestedNextTool string   `json:"suggested_next_tool,omitempty"`
	Warnings          []string `json:"warnings,omitempty"`
}

func BuildOpenPageDiagnostics

func BuildOpenPageDiagnostics(page Page, input PageDiagnosticsInput) *PageDiagnostics

type PageDiagnosticsInput

type PageDiagnosticsInput struct {
	ExtractMode      string
	Redirected       bool
	RedirectCount    int
	CacheHit         bool
	BodyTruncated    bool
	ContentTruncated bool
	ResponseBytes    int
}
type PageLink struct {
	Text string `json:"text,omitempty"`
	URL  string `json:"url"`
}
func DedupePageLinks(items []PageLink) []PageLink
func ExtractPageLinks(raw string, contentType string, pageURL string, limit int) []PageLink

type PageMatch

type PageMatch struct {
	Start   int    `json:"start"`
	End     int    `json:"end"`
	Snippet string `json:"snippet"`
	Heading string `json:"heading,omitempty"`
}

type PreparedSearchRequest

type PreparedSearchRequest struct {
	Query                string
	Count                int
	Country              string
	SearchLang           string
	UILang               string
	RequestedProvider    string
	EffectiveProvider    string
	ProviderNote         string
	Freshness            string
	DateAfter            string
	DateBefore           string
	DomainFilter         []string
	ArkTimeRange         string
	BaiduRecency         string
	PerplexityRecency    string
	PerplexityDateAfter  string
	PerplexityDateBefore string
}

type Preparer

type Preparer = httprequest.Preparer

Preparer is the narrow Host-owned network construction port used by search and page retrieval. The Host owns URL policy, proxy selection, redirects and transport lifecycle; this package owns only provider and extraction logic.

type ProviderCapability

type ProviderCapability struct {
	Provider             string `json:"provider"`
	Kind                 string `json:"kind,omitempty"`
	DateFilters          bool   `json:"date_filters"`
	DomainFilters        bool   `json:"domain_filters"`
	Locale               bool   `json:"locale"`
	StructuredSnippets   bool   `json:"structured_snippets"`
	SynthesizedCitations bool   `json:"synthesized_citations"`
	ContentExtraction    bool   `json:"content_extraction"`
	PDFBinaryHandoff     bool   `json:"pdf_binary_handoff"`
	Cache                bool   `json:"cache"`
	MaxResults           int    `json:"max_results,omitempty"`
}

func FetchProviderCapabilities

func FetchProviderCapabilities(tool string, providers []string) []ProviderCapability

func FetchProviderCapability

func FetchProviderCapability(tool string, provider string) ProviderCapability

func NormalizeProviderCapabilities

func NormalizeProviderCapabilities(items []ProviderCapability) []ProviderCapability

func SearchProviderCapabilities

func SearchProviderCapabilities(providers []string) []ProviderCapability

func SearchProviderCapability

func SearchProviderCapability(provider string) ProviderCapability

type ProviderDiagnostics

type ProviderDiagnostics struct {
	Tool              string               `json:"tool,omitempty"`
	RequestedProvider string               `json:"requested_provider,omitempty"`
	EffectiveProvider string               `json:"effective_provider,omitempty"`
	ProviderNote      string               `json:"provider_note,omitempty"`
	Capabilities      []ProviderCapability `json:"capabilities,omitempty"`
	Health            []ProviderHealth     `json:"health,omitempty"`
	Fallback          *ProviderFallback    `json:"fallback,omitempty"`
}

func BuildFetchProviderDiagnostics

func BuildFetchProviderDiagnostics(input FetchProviderDiagnosticsInput) *ProviderDiagnostics

func BuildProviderDiagnostics

func BuildProviderDiagnostics(input ProviderDiagnosticsInput) ProviderDiagnostics

func CloneProviderDiagnostics

func CloneProviderDiagnostics(input ProviderDiagnostics) ProviderDiagnostics

type ProviderDiagnosticsInput

type ProviderDiagnosticsInput struct {
	Tool              string
	RequestedProvider string
	EffectiveProvider string
	ProviderNote      string
	Capabilities      []ProviderCapability
	Health            []ProviderHealth
	FallbackFrom      string
	FallbackTo        string
	FallbackReason    string
	FallbackHint      string
}

type ProviderFallback

type ProviderFallback struct {
	From   string `json:"from,omitempty"`
	To     string `json:"to,omitempty"`
	Reason string `json:"reason,omitempty"`
	Hint   string `json:"hint,omitempty"`
}

type ProviderHealth

type ProviderHealth struct {
	Provider    string   `json:"provider"`
	Available   bool     `json:"available"`
	Configured  bool     `json:"configured"`
	Status      string   `json:"status"`
	Reason      string   `json:"reason,omitempty"`
	RequiresEnv []string `json:"requires_env,omitempty"`
	Retryable   bool     `json:"retryable,omitempty"`
}

func NormalizeProviderHealth

func NormalizeProviderHealth(items []ProviderHealth) []ProviderHealth

type SearchAuditEvent

type SearchAuditEvent struct {
	Prepared    PreparedSearchRequest
	Provider    string
	Event       string
	CacheHit    bool
	ResultCount int
	StartedAt   time.Time
	Err         error
}

SearchAuditEvent is the policy-neutral observation emitted by search. Persistence, redaction and enablement remain Host responsibilities.

type SearchCacheEntry

type SearchCacheEntry struct {
	ExpiresAt time.Time
	Payload   SearchPayload
}

type SearchExecuteOptions

type SearchExecuteOptions struct {
	Prepared             PreparedSearchRequest
	Endpoint             string
	ProviderAPIKey       string
	PerplexityAPIKey     string
	PerplexityBaseURL    string
	PerplexityModel      string
	TimeoutMs            int
	CacheTTL             time.Duration
	TrustedEnvProxy      bool
	Prepare              Preparer
	ClassifyNetworkError NetworkErrorClassifier
	Audit                func(SearchAuditEvent)
}

type SearchPayload

type SearchPayload struct {
	Query                  string               `json:"query"`
	Provider               string               `json:"provider"`
	ProviderKind           string               `json:"provider_kind,omitempty"`
	ResultKind             string               `json:"result_kind,omitempty"`
	RequestedProvider      string               `json:"requested_provider,omitempty"`
	ProviderNote           string               `json:"provider_note,omitempty"`
	ProviderFallbackFrom   string               `json:"provider_fallback_from,omitempty"`
	ProviderFallbackReason string               `json:"provider_fallback_reason,omitempty"`
	ProviderDiagnostics    *ProviderDiagnostics `json:"provider_diagnostics,omitempty"`
	Count                  int                  `json:"count"`
	TookMs                 int64                `json:"took_ms"`
	Results                []SearchResult       `json:"results,omitempty"`
	Cached                 bool                 `json:"cached,omitempty"`
}

func ExecutePreparedSearch

func ExecutePreparedSearch(ctx context.Context, opts SearchExecuteOptions) (SearchPayload, error)

func ReadSearchCache

func ReadSearchCache(key string) (SearchPayload, bool)

func RunSearch

func RunSearch(ctx context.Context, opts SearchRunOptions) (SearchPayload, error)

type SearchPrepareOptions

type SearchPrepareOptions struct {
	ConfiguredProvider                    string
	RequestedProvider                     string
	Query                                 string
	Count                                 int
	Country                               string
	SearchLang                            string
	UILang                                string
	Freshness                             string
	DateAfter                             string
	DateBefore                            string
	DomainFilter                          []string
	CanUseProvider                        func(provider string) bool
	CanUsePerplexityStructuredDateFilters bool
	Now                                   func() time.Time
}

type SearchProviderKind

type SearchProviderKind string
const (
	SearchProviderKindStructuredSearch    SearchProviderKind = "structured_search"
	SearchProviderKindSynthesizedCitation SearchProviderKind = "synthesized_citation"
)

func ResolveSearchProviderKind

func ResolveSearchProviderKind(provider string) SearchProviderKind

type SearchResult

type SearchResult struct {
	Title       string `json:"title"`
	URL         string `json:"url"`
	Description string `json:"description"`
	Published   string `json:"published,omitempty"`
	SiteName    string `json:"site_name,omitempty"`
}

type SearchResultKind

type SearchResultKind string
const (
	SearchResultKindStructuredResults   SearchResultKind = "structured_results"
	SearchResultKindSynthesizedCitation SearchResultKind = "synthesized_citation"
)

func ResolveSearchResultKind

func ResolveSearchResultKind(provider string) SearchResultKind

type SearchRunOptions

type SearchRunOptions struct {
	Provider               string
	Query                  string
	Count                  int
	Country                string
	SearchLang             string
	UILang                 string
	Freshness              string
	TimeoutMs              int
	BraveEndpoint          string
	BraveAPIKey            string
	ArkEndpoint            string
	ArkAPIKey              string
	ArkTimeRange           string
	BaiduEndpoint          string
	BaiduAPIKey            string
	BaiduRecency           string
	PerplexityAPIKey       string
	PerplexityBaseURL      string
	PerplexityModel        string
	PerplexityRecency      string
	PerplexityDateAfter    string
	PerplexityDateBefore   string
	PerplexityDomainFilter []string
	Prepare                Preparer
	ClassifyNetworkError   NetworkErrorClassifier
}

type SearchValidationError

type SearchValidationError struct {
	Code    string
	Message string
}

type URLPrepareError

type URLPrepareError struct {
	Tool  string
	URL   string
	Cause error
}

URLPrepareError reports a Host rejection without exposing URL credentials or losing the Host error identity for errors.Is/errors.As.

func (*URLPrepareError) Error

func (e *URLPrepareError) Error() string

func (*URLPrepareError) Unwrap

func (e *URLPrepareError) Unwrap() error

type WebFetchDiagnostics

type WebFetchDiagnostics struct {
	RequestedMode     string `json:"requested_mode,omitempty"`
	Extractor         string `json:"extractor,omitempty"`
	Redirected        bool   `json:"redirected,omitempty"`
	RedirectCount     int    `json:"redirect_count,omitempty"`
	CacheHit          bool   `json:"cache_hit,omitempty"`
	FallbackUsed      bool   `json:"fallback_used,omitempty"`
	ReadabilityUsed   bool   `json:"readability_used,omitempty"`
	BinaryUnsupported bool   `json:"binary_unsupported,omitempty"`
}

type WebFetchError

type WebFetchError struct {
	Kind        WebFetchErrorKind
	ToolName    string
	URL         string
	TimeoutMs   int
	Status      int
	StatusClass string
	ContentType string
	Challenge   bool
	// contains filtered or unexported fields
}

func (*WebFetchError) Error

func (e *WebFetchError) Error() string

func (*WebFetchError) Unwrap

func (e *WebFetchError) Unwrap() error

type WebFetchErrorKind

type WebFetchErrorKind string
const (
	WebFetchErrorRequest       WebFetchErrorKind = "request_failed"
	WebFetchErrorTimeout       WebFetchErrorKind = "timeout"
	WebFetchErrorRedirectLimit WebFetchErrorKind = "redirect_limit"
	WebFetchErrorProxyConfig   WebFetchErrorKind = "proxy_config_invalid"
	WebFetchErrorPolicyBlocked WebFetchErrorKind = "policy_blocked"
	WebFetchErrorTLS           WebFetchErrorKind = "tls_error"
	WebFetchErrorStatus        WebFetchErrorKind = "status_error"
)

type WebFetchExecutionResult

type WebFetchExecutionResult struct {
	Payload WebFetchPayload
	Links   []PageLink
}

type WebFetchExtractResult

type WebFetchExtractResult struct {
	Content         string
	Title           string
	SiteName        string
	Byline          string
	Excerpt         string
	Mode            string
	WordCount       int
	FallbackUsed    bool
	ReadabilityUsed bool
}

func ExtractReadableHTMLContent

func ExtractReadableHTMLContent(trimmed string, mode string) WebFetchExtractResult

func ExtractReadableHTMLContentWithURL

func ExtractReadableHTMLContentWithURL(trimmed string, mode string, pageURL string) WebFetchExtractResult

func NormalizeFetchContent

func NormalizeFetchContent(raw string, contentType string, requestedMode string) WebFetchExtractResult

func NormalizeFetchContentWithURL

func NormalizeFetchContentWithURL(raw string, contentType string, requestedMode string, pageURL string) WebFetchExtractResult

type WebFetchFirecrawlAttempt

type WebFetchFirecrawlAttempt struct {
	Payload   WebFetchPayload
	Used      bool
	Attempted bool
	Detail    string
}

type WebFetchFirecrawlConfig

type WebFetchFirecrawlConfig struct {
	Enabled         bool
	APIKey          string
	Endpoint        string
	TimeoutMs       int
	MaxAgeMs        int
	OnlyMainContent bool
}

type WebFetchFirecrawlRequest

type WebFetchFirecrawlRequest struct {
	URL              string
	FinalURLFallback string
	StatusFallback   int
	ToolName         string
	FallbackReason   string
	FallbackHint     string
	ExtractMode      string
	MaxChars         int
}

type WebFetchFirecrawlResponse

type WebFetchFirecrawlResponse struct {
	Success bool   `json:"success"`
	Warning string `json:"warning,omitempty"`
	Error   string `json:"error,omitempty"`
	Data    struct {
		Markdown string `json:"markdown,omitempty"`
		Content  string `json:"content,omitempty"`
		Metadata struct {
			Title      string `json:"title,omitempty"`
			SourceURL  string `json:"sourceURL,omitempty"`
			StatusCode int    `json:"statusCode,omitempty"`
		} `json:"metadata,omitempty"`
	} `json:"data,omitempty"`
}

type WebFetchHandoff

type WebFetchHandoff struct {
	Kind          string `json:"kind,omitempty"`
	PreferredTool string `json:"preferred_tool,omitempty"`
	Summary       string `json:"summary,omitempty"`
}

type WebFetchPayload

type WebFetchPayload struct {
	URL                 string               `json:"url"`
	FinalURL            string               `json:"final_url"`
	Status              int                  `json:"status"`
	ContentType         string               `json:"content_type,omitempty"`
	Redirected          bool                 `json:"redirected,omitempty"`
	RedirectCount       int                  `json:"redirect_count,omitempty"`
	RedirectChain       []string             `json:"redirect_chain,omitempty"`
	Extractor           string               `json:"extractor,omitempty"`
	Diagnostics         *WebFetchDiagnostics `json:"extractor_diagnostics,omitempty"`
	Handoff             *WebFetchHandoff     `json:"handoff,omitempty"`
	ExternalContent     *ExternalContentMeta `json:"external_content,omitempty"`
	ProviderDiagnostics *ProviderDiagnostics `json:"provider_diagnostics,omitempty"`
	SiteName            string               `json:"site_name,omitempty"`
	Title               string               `json:"title,omitempty"`
	Byline              string               `json:"byline,omitempty"`
	Excerpt             string               `json:"excerpt,omitempty"`
	Content             string               `json:"content"`
	ContentChars        int                  `json:"content_chars,omitempty"`
	WordCount           int                  `json:"word_count,omitempty"`
	ExtractMode         string               `json:"extract_mode,omitempty"`
	FallbackUsed        bool                 `json:"fallback_used,omitempty"`
	ReadabilityUsed     bool                 `json:"readability_used,omitempty"`
	ResponseBytes       int                  `json:"response_bytes,omitempty"`
	BodyTruncated       bool                 `json:"body_truncated,omitempty"`
	Warning             string               `json:"warning,omitempty"`
	Truncated           bool                 `json:"truncated"`
	TruncationReason    string               `json:"truncation_reason,omitempty"`
	FromCache           bool                 `json:"from_cache"`
	FetchedAt           int64                `json:"fetched_at"`
	TookMs              int64                `json:"took_ms,omitempty"`
}

Jump to

Keyboard shortcuts

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