client

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Error string `json:"error"`
}

APIError represents an error response from the Exa API

type Client

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

func New

func New(apiKey string) (*Client, error)

func (*Client) GetContents

func (c *Client) GetContents(ctx context.Context, req *ContentsRequest) (*ContentsResponse, error)

GetContents retrieves content from URLs

func (*Client) Search

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

Search performs a web search using Exa

type ContentStatus

type ContentStatus struct {
	ID     string `json:"id" toon:"id"`
	Status string `json:"status" toon:"status"`
	Error  *struct {
		Tag            string `json:"tag,omitempty"`
		HTTPStatusCode int    `json:"httpStatusCode,omitempty"`
	} `json:"error,omitempty"`
}

ContentStatus represents the status of a content fetch

type ContentsOptions

type ContentsOptions struct {
	Text       any `json:"text,omitempty"`       // bool or TextOptions
	Highlights any `json:"highlights,omitempty"` // bool
	Summary    any `json:"summary,omitempty"`    // bool or SummaryOptions
}

ContentsOptions specifies what content to retrieve

type ContentsRequest

type ContentsRequest struct {
	IDs              []string `json:"ids"`
	Text             any      `json:"text,omitempty"`       // bool or TextOptions
	Highlights       any      `json:"highlights,omitempty"` // bool
	Summary          any      `json:"summary,omitempty"`    // bool or SummaryOptions
	Context          any      `json:"context,omitempty"`    // bool or ContextOptions
	Subpages         int      `json:"subpages,omitempty"`
	SubpageTarget    []string `json:"subpageTarget,omitempty"`
	MaxAgeHours      *int     `json:"maxAgeHours,omitempty"`
	LivecrawlTimeout int      `json:"livecrawlTimeout,omitempty"`
}

ContentsRequest represents a contents API request

type ContentsResponse

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

ContentsResponse represents the response from the contents API

type ContextOptions

type ContextOptions struct {
	MaxCharacters int `json:"maxCharacters,omitempty"`
}

ContextOptions configures context output for RAG

type SearchRequest

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

SearchRequest represents a search API request

type SearchResponse

type SearchResponse struct {
	Results            []SearchResult `json:"results" toon:"results"`
	AutopromptString   string         `json:"autopromptString,omitempty" toon:"autopromptString,omitempty"`
	ResolvedSearchType string         `json:"resolvedSearchType,omitempty" toon:"resolvedSearchType,omitempty"`
}

SearchResponse represents the response from search and find-similar APIs

type SearchResult

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

SearchResult represents a single search result

type SummaryOptions

type SummaryOptions struct {
	Query  string `json:"query,omitempty"`
	Schema any    `json:"schema,omitempty"` // JSON schema for structured extraction
}

SummaryOptions configures summary generation

type TextOptions

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

TextOptions configures text content retrieval

Jump to

Keyboard shortcuts

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