exa

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnswerRequest

type AnswerRequest struct {
	Query      string `json:"query"`
	NumResults int    `json:"numResults,omitempty"`
	Text       bool   `json:"text,omitempty"`
}

AnswerRequest represents an answer request.

type AnswerResponse

type AnswerResponse struct {
	Answer    string         `json:"answer"`
	Citations []SearchResult `json:"citations,omitempty"`
}

AnswerResponse is the response from an answer request.

type Client

type Client struct {
	*api.Client
}

Client wraps the API client with Exa-specific methods.

func NewClient

func NewClient(apiKey string) *Client

NewClient creates a new Exa API client.

func (*Client) Answer

func (c *Client) Answer(ctx context.Context, req AnswerRequest) (*AnswerResponse, error)

Answer gets an AI-generated answer with citations.

func (*Client) FindSimilar

func (c *Client) FindSimilar(ctx context.Context, req FindSimilarRequest) (*SearchResponse, error)

FindSimilar finds pages similar to a given URL.

func (*Client) Search

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

Search performs a web search.

func (*Client) SearchAndContents

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

SearchAndContents performs a search and returns page contents.

type ContentOptions

type ContentOptions struct {
	Text       *TextOptions `json:"text,omitempty"`
	Highlights bool         `json:"highlights,omitempty"`
	Summary    bool         `json:"summary,omitempty"`
}

ContentOptions controls what content is returned with search results.

type FindSimilarRequest

type FindSimilarRequest struct {
	URL            string          `json:"url"`
	NumResults     int             `json:"numResults,omitempty"`
	IncludeDomains []string        `json:"includeDomains,omitempty"`
	ExcludeDomains []string        `json:"excludeDomains,omitempty"`
	Contents       *ContentOptions `json:"contents,omitempty"`
}

FindSimilarRequest represents a find-similar request.

type SearchRequest

type SearchRequest struct {
	Query          string          `json:"query"`
	NumResults     int             `json:"numResults,omitempty"`
	Type           string          `json:"type,omitempty"`
	UseAutoprompt  bool            `json:"useAutoprompt,omitempty"`
	IncludeDomains []string        `json:"includeDomains,omitempty"`
	ExcludeDomains []string        `json:"excludeDomains,omitempty"`
	StartPublished string          `json:"startPublishedDate,omitempty"`
	EndPublished   string          `json:"endPublishedDate,omitempty"`
	Contents       *ContentOptions `json:"contents,omitempty"`
}

SearchRequest represents a search request to the Exa API.

type SearchResponse

type SearchResponse struct {
	Results        []SearchResult `json:"results"`
	AutopromptText string         `json:"autopromptString,omitempty"`
}

SearchResponse is the response from a search request.

type SearchResult

type SearchResult struct {
	URL           string   `json:"url"`
	Title         string   `json:"title"`
	Score         float64  `json:"score,omitempty"`
	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 represents a single search result.

type TextOptions

type TextOptions struct {
	MaxCharacters int  `json:"maxCharacters,omitempty"`
	IncludeHTML   bool `json:"includeHtmlTags,omitempty"`
}

TextOptions controls text content retrieval.

Jump to

Keyboard shortcuts

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