search

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeminiSearcher

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

GeminiSearcher is a stub for LLM-based tool search re-ranking via Gemini. The real implementation will use the google/generative-ai-go SDK.

func NewGeminiSearcher

func NewGeminiSearcher(apiKey, model string) *GeminiSearcher

NewGeminiSearcher creates a new stub GeminiSearcher.

func (*GeminiSearcher) Search

func (g *GeminiSearcher) Search(_ context.Context, _ string, _ int) ([]types.SearchResult, error)

Search is a stub that returns an error indicating LLM search is not yet implemented.

type KeywordSearcher

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

KeywordSearcher scores tools by counting matching tokens in name + description.

func NewKeywordSearcher

func NewKeywordSearcher(catalogFn func() []types.ToolEntry) *KeywordSearcher

NewKeywordSearcher creates a keyword-based searcher.

func (*KeywordSearcher) Search

func (k *KeywordSearcher) Search(_ context.Context, query string, limit int) ([]types.SearchResult, error)

Search tokenizes the query and scores each tool by token overlap.

type OrchestratedSearcher

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

OrchestratedSearcher performs keyword search as the primary strategy, and optionally re-ranks results via an LLM searcher. A cache is used to avoid redundant LLM calls.

func (*OrchestratedSearcher) Search

func (o *OrchestratedSearcher) Search(ctx context.Context, query string, limit int) ([]types.SearchResult, error)

Search first checks the LLM cache, then tries LLM re-ranking, falling back to keyword search if the LLM fails.

type QueryCache

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

QueryCache caches search results keyed by normalized query strings. It supports exact match and fuzzy matching based on token overlap.

func NewQueryCache

func NewQueryCache() *QueryCache

NewQueryCache creates an empty query cache.

func (*QueryCache) Get

func (c *QueryCache) Get(query string) ([]types.SearchResult, bool)

Get retrieves cached results. It first tries an exact match on the normalized query, then falls back to token-overlap matching with a 60% threshold.

func (*QueryCache) Put

func (c *QueryCache) Put(query string, results []types.SearchResult)

Put stores results for a normalized query key.

type Searcher

type Searcher interface {
	Search(ctx context.Context, query string, limit int) ([]types.SearchResult, error)
}

Searcher searches the tool catalog.

func NewSearcher

func NewSearcher(apiKey, model string, catalogFn func() []types.ToolEntry) Searcher

NewSearcher constructs the appropriate Searcher based on configuration. If apiKey is empty, a plain KeywordSearcher is returned. If apiKey is provided, an OrchestratedSearcher wrapping keyword + LLM + cache is returned.

Jump to

Keyboard shortcuts

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