Documentation
¶
Overview ¶
Package perplexity wires Perplexity's Search API into web.Searcher.
Requests use POST /search with a bearer token.
web.SearchRequest maps to the Perplexity request:
- Query → query
- MaxResults → max_results (omitted when unset)
- AllowedDomains → search_domain_filter
- BlockedDomains → search_domain_filter entries prefixed with "-"
- Recency → search_recency_filter
Results map title → Title, url → URL, snippet → Snippet, and date → PublishedTime when it is a time.DateOnly date.
Reference: https://docs.perplexity.ai/api-reference/search-post
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, request *web.SearchRequest) (*web.SearchResponse, error)
type Config ¶
type Config struct {
APIKey string
BaseURL string
// HTTPClient remains host-owned. Requests and redirects are restricted to
// BaseURL's origin, including when the host redirect policy changes a request.
HTTPClient *http.Client
}
Config configures a Client. APIKey is required; an empty BaseURL selects Perplexity's public endpoint and a nil HTTPClient selects a default client.
Click to show internal directories.
Click to hide internal directories.