search

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BraveProvider

type BraveProvider struct {
	// contains filtered or unexported fields
}

BraveProvider implements the Brave Search provider

func NewBraveProvider

func NewBraveProvider() *BraveProvider

NewBraveProvider creates a new Brave provider

func (*BraveProvider) DisplayName

func (p *BraveProvider) DisplayName() string

func (*BraveProvider) EnvVars

func (p *BraveProvider) EnvVars() []string

func (*BraveProvider) IsAvailable

func (p *BraveProvider) IsAvailable() bool

func (*BraveProvider) Name

func (p *BraveProvider) Name() ProviderName

func (*BraveProvider) RequiresAPIKey

func (p *BraveProvider) RequiresAPIKey() bool

func (*BraveProvider) Search

func (p *BraveProvider) Search(ctx context.Context, query string, opts SearchOptions) ([]SearchResult, error)

Search performs a web search using Brave Search

type ExaProvider

type ExaProvider struct{}

ExaProvider implements the Exa AI search provider

func NewExaProvider

func NewExaProvider() *ExaProvider

NewExaProvider creates a new Exa provider

func (*ExaProvider) DisplayName

func (p *ExaProvider) DisplayName() string

func (*ExaProvider) EnvVars

func (p *ExaProvider) EnvVars() []string

func (*ExaProvider) IsAvailable

func (p *ExaProvider) IsAvailable() bool

func (*ExaProvider) Name

func (p *ExaProvider) Name() ProviderName

func (*ExaProvider) RequiresAPIKey

func (p *ExaProvider) RequiresAPIKey() bool

func (*ExaProvider) Search

func (p *ExaProvider) Search(ctx context.Context, query string, opts SearchOptions) ([]SearchResult, error)

Search performs a web search using Exa MCP endpoint

type Provider

type Provider interface {
	// Name returns the provider name
	Name() ProviderName

	// DisplayName returns the human-readable name
	DisplayName() string

	// RequiresAPIKey returns true if an API key is needed
	RequiresAPIKey() bool

	// EnvVars returns the environment variable names for credentials
	EnvVars() []string

	// IsAvailable checks if the provider is configured and ready
	IsAvailable() bool

	// Search performs a web search
	Search(ctx context.Context, query string, opts SearchOptions) ([]SearchResult, error)
}

Provider is the interface for search providers

func CreateProvider

func CreateProvider(name ProviderName) Provider

CreateProvider creates a search provider by name

func GetAvailableProviders

func GetAvailableProviders() []Provider

GetAvailableProviders returns all providers that are currently available

func GetDefaultProvider

func GetDefaultProvider() Provider

GetDefaultProvider returns the first available search provider Priority: Exa (no key needed) > Serper > Brave

type ProviderMeta

type ProviderMeta struct {
	Name           ProviderName
	DisplayName    string
	RequiresAPIKey bool
	EnvVars        []string
}

ProviderMeta contains metadata about a search provider

func AllProviders

func AllProviders() []ProviderMeta

AllProviders returns metadata for all search providers

type ProviderName

type ProviderName string

ProviderName identifies a search provider

const (
	ProviderExa    ProviderName = "exa"
	ProviderSerper ProviderName = "serper"
	ProviderBrave  ProviderName = "brave"
)

type SearchOptions

type SearchOptions struct {
	NumResults     int
	AllowedDomains []string
	BlockedDomains []string
	Timeout        time.Duration
}

SearchOptions configures search behavior

func DefaultOptions

func DefaultOptions() SearchOptions

DefaultOptions returns default search options

type SearchResult

type SearchResult struct {
	Title   string
	URL     string
	Snippet string
}

SearchResult represents a single search result

type SerperProvider

type SerperProvider struct {
	// contains filtered or unexported fields
}

SerperProvider implements the Serper.dev search provider

func NewSerperProvider

func NewSerperProvider() *SerperProvider

NewSerperProvider creates a new Serper provider

func (*SerperProvider) DisplayName

func (p *SerperProvider) DisplayName() string

func (*SerperProvider) EnvVars

func (p *SerperProvider) EnvVars() []string

func (*SerperProvider) IsAvailable

func (p *SerperProvider) IsAvailable() bool

func (*SerperProvider) Name

func (p *SerperProvider) Name() ProviderName

func (*SerperProvider) RequiresAPIKey

func (p *SerperProvider) RequiresAPIKey() bool

func (*SerperProvider) Search

func (p *SerperProvider) Search(ctx context.Context, query string, opts SearchOptions) ([]SearchResult, error)

Search performs a web search using Serper

Jump to

Keyboard shortcuts

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