llmproxy

package
v0.310.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSearchResultsForPrompt

func FormatSearchResultsForPrompt(results []SearchResult) string

FormatSearchResultsForPrompt formats a slice of SearchResult values as a numbered, human-readable list suitable for injection into a prompt message.

Types

type LLMProxyServer

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

LLMProxyServer is an OpenAI-compatible HTTP proxy server.

func NewServer

func NewServer(cfg ProxyConfig) *LLMProxyServer

NewServer creates a new LLMProxyServer with the given configuration.

func (*LLMProxyServer) Shutdown

func (s *LLMProxyServer) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server without interrupting active connections.

func (*LLMProxyServer) Start

func (s *LLMProxyServer) Start() error

Start begins listening and serving HTTP requests.

type ProxyConfig

type ProxyConfig struct {
	Host   string
	Port   int
	APIKey string // optional, for Bearer auth
	Debug  bool
}

ProxyConfig holds configuration for the LLM proxy server.

type SearchResult

type SearchResult struct {
	Title   string `json:"title"`
	URL     string `json:"url"`
	Snippet string `json:"snippet"`
}

SearchResult represents a single web search result.

func SearchWithFallback

func SearchWithFallback(ctx context.Context, query string, maxResults int) ([]SearchResult, error)

SearchWithFallback attempts each provider in the chain in order, returning the first non-empty result set. If all providers fail or the chain is empty, an error is returned.

type WebSearcher

type WebSearcher interface {
	Search(ctx context.Context, query string, maxResults int) ([]SearchResult, error)
}

WebSearcher can perform web searches.

func NewWebSearchChain

func NewWebSearchChain() []WebSearcher

NewWebSearchChain returns a slice of configured WebSearcher implementations in priority order: Google, Exa, Brave. Providers without valid configuration are omitted from the chain.

Jump to

Keyboard shortcuts

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