perplexity

package
v0.0.0-...-4c5b182 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

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 represents a Perplexity API client.

func New

func New(apiKey string) *Client

New creates a new Perplexity client with the given API key.

func (*Client) Query

func (c *Client) Query(ctx context.Context, query string) (string, error)

Query sends a query to Perplexity and returns the first response.

func (*Client) WithURL

func (c *Client) WithURL(url string) *Client

WithURL returns a new client with a custom API URL.

type CompletionRequest

type CompletionRequest struct {
	Model    string    `json:"model"`
	Messages []Message `json:"messages"`
}

type CompletionResponse

type CompletionResponse struct {
	ID      string `json:"id"`
	Model   string `json:"model"`
	Created int64  `json:"created"`
	Choices []struct {
		Message struct {
			Role    string `json:"role"`
			Content string `json:"content"`
		} `json:"message"`
	} `json:"choices"`
}

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

Jump to

Keyboard shortcuts

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