perplexity

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

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
}

Client implements web.Searcher against Perplexity's Search API.

func NewClient

func NewClient(config Config) (*Client, error)

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 *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.

Jump to

Keyboard shortcuts

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