web

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrService = errors.New("service failed")

ErrService is a host/network/auth/rate-limit failure (not a model-fixable query).

Functions

func WebFetch

func WebFetch(client *Exa) *tacklr.Tool

func WebSearch

func WebSearch(client *Exa) *tacklr.Tool

Types

type ContentsOptions

type ContentsOptions struct {
	Highlights  any  `json:"highlights,omitempty"` // bool or HighlightsOptions
	Text        any  `json:"text,omitempty"`       // bool or TextOptions
	MaxAgeHours *int `json:"maxAgeHours,omitempty"`
}

ContentsOptions controls extraction and freshness on each result.

type ContentsRequest

type ContentsRequest struct {
	URLs        []string `json:"urls,omitempty"`
	IDs         []string `json:"ids,omitempty"`
	Text        any      `json:"text,omitempty"`       // bool or TextOptions
	Highlights  any      `json:"highlights,omitempty"` // bool or HighlightsOptions
	MaxAgeHours *int     `json:"maxAgeHours,omitempty"`
}

ContentsRequest is POST /contents (known URLs or prior result ids). Provide urls or ids, not both. Content options are top-level (not nested).

type ContentsResponse

type ContentsResponse struct {
	Results  []SearchResult      `json:"results"`
	Statuses []ContentsURLStatus `json:"statuses,omitempty"`
}

ContentsResponse is the body for a successful POST /contents call.

type ContentsURLStatus

type ContentsURLStatus struct {
	ID     string `json:"id"`
	Status string `json:"status"` // success | error
	Error  *struct {
		Tag string `json:"tag,omitempty"`
	} `json:"error,omitempty"`
}

ContentsURLStatus reports per-URL fetch outcome from /contents.

type Exa

type Exa struct {
	APIKey     string
	BaseURL    string
	HTTPClient *http.Client
}

Exa calls Exa’s Search and Contents APIs.

func NewExa

func NewExa(apiKey string) *Exa

NewExa builds a client for the given API key.

func (*Exa) Contents

func (c *Exa) Contents(ctx context.Context, req ContentsRequest) (*ContentsResponse, error)

Contents performs POST /contents for known URLs (or prior result ids). Provide at least one of URLs or IDs.

func (*Exa) Search

func (c *Exa) Search(ctx context.Context, req SearchRequest) (*SearchResponse, error)

Search performs POST /search. req.Query must be non-empty.

type HighlightsOptions

type HighlightsOptions struct {
	Query         string `json:"query,omitempty"`
	MaxCharacters int    `json:"maxCharacters,omitempty"`
}

HighlightsOptions steers highlight extraction.

type SearchRequest

type SearchRequest struct {
	Query              string           `json:"query"`
	Type               string           `json:"type,omitempty"`
	NumResults         int              `json:"numResults,omitempty"`
	Category           string           `json:"category,omitempty"`
	IncludeDomains     []string         `json:"includeDomains,omitempty"`
	ExcludeDomains     []string         `json:"excludeDomains,omitempty"`
	StartPublishedDate string           `json:"startPublishedDate,omitempty"`
	EndPublishedDate   string           `json:"endPublishedDate,omitempty"`
	UserLocation       string           `json:"userLocation,omitempty"`
	SystemPrompt       string           `json:"systemPrompt,omitempty"`
	Contents           *ContentsOptions `json:"contents,omitempty"`
}

SearchRequest is the subset of POST /search we use for agent tools. JSON names match Exa’s camelCase wire format.

type SearchResponse

type SearchResponse struct {
	Results []SearchResult   `json:"results"`
	Output  *SynthesisOutput `json:"output,omitempty"`
}

SearchResponse is the JSON body for a successful non-streaming /search call.

type SearchResult

type SearchResult struct {
	Title         string   `json:"title"`
	URL           string   `json:"url"`
	PublishedDate string   `json:"publishedDate,omitempty"`
	Author        string   `json:"author,omitempty"`
	Text          string   `json:"text,omitempty"`
	Highlights    []string `json:"highlights,omitempty"`
	Summary       string   `json:"summary,omitempty"`
}

SearchResult is one hit from Exa.

type StatusError

type StatusError struct {
	Op     string
	Status int
	Body   string
}

StatusError is an Exa HTTP status. QueryFixable is a 4xx the model can correct (not 401/403/429). Those plus 5xx unwrap as ErrService.

func (*StatusError) Error

func (e *StatusError) Error() string

func (*StatusError) PublicationDomain

func (e *StatusError) PublicationDomain() bool

func (*StatusError) QueryFixable

func (e *StatusError) QueryFixable() bool

func (*StatusError) Unwrap

func (e *StatusError) Unwrap() error

type SynthesisOutput

type SynthesisOutput struct {
	Content json.RawMessage `json:"content,omitempty"`
}

SynthesisOutput holds optional deep-search / schema synthesis. Content may be a string or a JSON object depending on outputSchema.

type TextOptions

type TextOptions struct {
	MaxCharacters int    `json:"maxCharacters,omitempty"`
	Verbosity     string `json:"verbosity,omitempty"` // compact | standard | full
}

TextOptions steers full-page text extraction.

Jump to

Keyboard shortcuts

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