Documentation
¶
Index ¶
- type AnswerRequest
- type AnswerResponse
- type Client
- func (c *Client) Answer(ctx context.Context, req AnswerRequest) (*AnswerResponse, error)
- func (c *Client) FindSimilar(ctx context.Context, req FindSimilarRequest) (*SearchResponse, error)
- func (c *Client) Search(ctx context.Context, req SearchRequest) (*SearchResponse, error)
- func (c *Client) SearchAndContents(ctx context.Context, req SearchRequest) (*SearchResponse, error)
- type ContentOptions
- type FindSimilarRequest
- type SearchRequest
- type SearchResponse
- type SearchResult
- type TextOptions
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 ¶
Client wraps the API client with Exa-specific methods.
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.