Documentation
¶
Overview ¶
Package store persists user-selected LLM providers and credentials.
Index ¶
- func ChangeDefault(Model types.LLMProvider) error
- type Config
- type LLMProvider
- type StoreMethods
- func (s *StoreMethods) CleanupCache() error
- func (s *StoreMethods) ClearCache() error
- func (s *StoreMethods) DefaultLLMKey() (*LLMProvider, error)
- func (s *StoreMethods) DeleteModel(Model types.LLMProvider) error
- func (s *StoreMethods) GetCacheHitRate() float64
- func (s *StoreMethods) GetCacheManager() *cache.CacheManager
- func (s *StoreMethods) GetCacheStats() *types.CacheStats
- func (s *StoreMethods) GetCachedMessage(provider types.LLMProvider, diff string, opts *types.GenerationOptions) (*types.CacheEntry, bool)
- func (s *StoreMethods) GetMostUsedProvider() (types.LLMProvider, int)
- func (s *StoreMethods) GetOverallSuccessRate() float64
- func (s *StoreMethods) GetProviderRanking() []types.LLMProvider
- func (s *StoreMethods) GetUsageManager() *usage.StatsManager
- func (s *StoreMethods) GetUsageStats() *types.UsageStats
- func (s *StoreMethods) RecordGenerationEvent(event *types.GenerationEvent) error
- func (s *StoreMethods) ResetUsageStats() error
- func (s *StoreMethods) Save(LLMConfig LLMProvider) error
- func (s *StoreMethods) SetCachedMessage(provider types.LLMProvider, diff string, opts *types.GenerationOptions, ...) error
- func (s *StoreMethods) UpdateAPIKey(Model types.LLMProvider, APIKey string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeDefault ¶
func ChangeDefault(Model types.LLMProvider) error
ChangeDefault updates the default LLM provider selection in the config.
Types ¶
type Config ¶
type Config struct {
Default types.LLMProvider `json:"default"`
LLMProviders []types.LLMProvider `json:"models"`
}
Config describes the on-disk structure for all saved LLM providers.
func ListSavedModels ¶
ListSavedModels loads all persisted LLM provider configurations.
type LLMProvider ¶
type LLMProvider struct {
LLM types.LLMProvider `json:"model"`
APIKey string `json:"api_key"`
}
LLMProvider represents a single stored LLM provider and its credential.
type StoreMethods ¶ added in v1.3.35
type StoreMethods struct {
// contains filtered or unexported fields
}
func KeyringInit ¶ added in v1.3.35
func KeyringInit() (*StoreMethods, error)
KeyringInit initializes a StoreMethods instance with both keyring and cache support. This function is kept for backward compatibility with main.go.
func NewStoreMethods ¶ added in v1.6.0
func NewStoreMethods() (*StoreMethods, error)
NewStoreMethods creates a new StoreMethods instance with cache support.
func (*StoreMethods) CleanupCache ¶ added in v1.6.0
func (s *StoreMethods) CleanupCache() error
CleanupCache removes old entries from the cache.
func (*StoreMethods) ClearCache ¶ added in v1.6.0
func (s *StoreMethods) ClearCache() error
ClearCache removes all entries from the cache.
func (*StoreMethods) DefaultLLMKey ¶ added in v1.3.35
func (s *StoreMethods) DefaultLLMKey() (*LLMProvider, error)
DefaultLLMKey returns the currently selected default LLM provider, if any.
func (*StoreMethods) DeleteModel ¶ added in v1.3.35
func (s *StoreMethods) DeleteModel(Model types.LLMProvider) error
DeleteModel removes the specified provider from the saved configuration.
func (*StoreMethods) GetCacheHitRate ¶ added in v1.7.0
func (s *StoreMethods) GetCacheHitRate() float64
GetCacheHitRate returns the cache hit rate as a percentage.
func (*StoreMethods) GetCacheManager ¶ added in v1.6.0
func (s *StoreMethods) GetCacheManager() *cache.CacheManager
GetCacheManager returns the cache manager instance.
func (*StoreMethods) GetCacheStats ¶ added in v1.6.0
func (s *StoreMethods) GetCacheStats() *types.CacheStats
GetCacheStats returns cache statistics.
func (*StoreMethods) GetCachedMessage ¶ added in v1.6.0
func (s *StoreMethods) GetCachedMessage(provider types.LLMProvider, diff string, opts *types.GenerationOptions) (*types.CacheEntry, bool)
GetCachedMessage retrieves a cached commit message if it exists.
func (*StoreMethods) GetMostUsedProvider ¶ added in v1.7.0
func (s *StoreMethods) GetMostUsedProvider() (types.LLMProvider, int)
GetMostUsedProvider returns the most frequently used LLM provider.
func (*StoreMethods) GetOverallSuccessRate ¶ added in v1.7.0
func (s *StoreMethods) GetOverallSuccessRate() float64
GetOverallSuccessRate returns the overall success rate as a percentage.
func (*StoreMethods) GetProviderRanking ¶ added in v1.7.0
func (s *StoreMethods) GetProviderRanking() []types.LLMProvider
GetProviderRanking returns providers ranked by usage frequency.
func (*StoreMethods) GetUsageManager ¶ added in v1.7.0
func (s *StoreMethods) GetUsageManager() *usage.StatsManager
GetUsageManager returns the usage statistics manager instance.
func (*StoreMethods) GetUsageStats ¶ added in v1.7.0
func (s *StoreMethods) GetUsageStats() *types.UsageStats
GetUsageStats returns comprehensive usage statistics.
func (*StoreMethods) RecordGenerationEvent ¶ added in v1.7.0
func (s *StoreMethods) RecordGenerationEvent(event *types.GenerationEvent) error
RecordGenerationEvent records a commit message generation event for statistics.
func (*StoreMethods) ResetUsageStats ¶ added in v1.7.0
func (s *StoreMethods) ResetUsageStats() error
ResetUsageStats clears all usage statistics.
func (*StoreMethods) Save ¶ added in v1.3.35
func (s *StoreMethods) Save(LLMConfig LLMProvider) error
Save persists or updates an LLM provider entry, marking it as the default.
func (*StoreMethods) SetCachedMessage ¶ added in v1.6.0
func (s *StoreMethods) SetCachedMessage(provider types.LLMProvider, diff string, opts *types.GenerationOptions, message string, cost float64, tokens *types.UsageInfo) error
SetCachedMessage stores a commit message in the cache.
func (*StoreMethods) UpdateAPIKey ¶ added in v1.3.35
func (s *StoreMethods) UpdateAPIKey(Model types.LLMProvider, APIKey string) error
UpdateAPIKey rotates the credential for an existing provider entry.