Documentation
¶
Overview ¶
* ChatCLI - Command Line Interface for LLM interaction * Copyright (c) 2024 Edilson Freitas * License: MIT
Index ¶
- type ConfigError
- type LLMManager
- type LLMManagerImpl
- func (m *LLMManagerImpl) CreateClientWithConfig(provider, model, apiKey string, providerConfig map[string]string) (client.LLMClient, error)
- func (m *LLMManagerImpl) CreateClientWithKey(provider, model, apiKey string) (client.LLMClient, error)
- func (m *LLMManagerImpl) GetAvailableProviders() []string
- func (m *LLMManagerImpl) GetClient(provider string, model string) (client.LLMClient, error)
- func (m *LLMManagerImpl) GetStackSpotAgentID() string
- func (m *LLMManagerImpl) GetStackSpotRealm() string
- func (m *LLMManagerImpl) GetTokenManager() (token.Manager, bool)
- func (m *LLMManagerImpl) RefreshProviders()
- func (m *LLMManagerImpl) SetStackSpotAgentID(agentID string)
- func (m *LLMManagerImpl) SetStackSpotRealm(realm string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigError ¶
type ConfigError struct {
Mensagem string
}
ConfigError representa um erro de configuração, como variáveis de ambiente ausentes
func (*ConfigError) Error ¶
func (e *ConfigError) Error() string
Error implementa a interface de erro para ConfigError
type LLMManager ¶
type LLMManager interface {
GetClient(provider string, model string) (client.LLMClient, error)
GetAvailableProviders() []string
GetTokenManager() (token.Manager, bool)
SetStackSpotRealm(realm string)
SetStackSpotAgentID(agentID string)
GetStackSpotRealm() string
GetStackSpotAgentID() string
RefreshProviders()
// CreateClientWithKey creates an LLM client using a caller-provided API key
// instead of the server's default credentials. Used for client-forwarded tokens.
CreateClientWithKey(provider, model, apiKey string) (client.LLMClient, error)
// CreateClientWithConfig creates an LLM client using caller-provided credentials
// plus provider-specific configuration. Supports all providers including StackSpot
// (needs client_id, client_key, realm, agent_id) and Ollama (needs base_url).
CreateClientWithConfig(provider, model, apiKey string, providerConfig map[string]string) (client.LLMClient, error)
}
LLMManager é a interface que define os métodos que o gerenciador de LLMs deve implementar
func NewLLMManager ¶
func NewLLMManager(logger *zap.Logger) (LLMManager, error)
NewLLMManager cria uma nova instância de LLMManagerImpl.
type LLMManagerImpl ¶
type LLMManagerImpl struct {
// contains filtered or unexported fields
}
LLMManagerImpl gerencia diferentes clientes LLM e o TokenManager
func (*LLMManagerImpl) CreateClientWithConfig ¶ added in v1.55.0
func (m *LLMManagerImpl) CreateClientWithConfig(provider, model, apiKey string, providerConfig map[string]string) (client.LLMClient, error)
CreateClientWithConfig creates an LLM client using caller-provided credentials plus provider-specific configuration from the providerConfig map. Supports all providers including StackSpot and Ollama.
StackSpot config keys: "client_id", "client_key", "realm", "agent_id" Ollama config keys: "base_url"
func (*LLMManagerImpl) CreateClientWithKey ¶ added in v1.55.0
func (m *LLMManagerImpl) CreateClientWithKey(provider, model, apiKey string) (client.LLMClient, error)
CreateClientWithKey creates an LLM client using a caller-provided API key instead of the server's default credentials. Supports OPENAI, CLAUDEAI, GOOGLEAI, and XAI providers. Returns an error for unsupported providers.
func (*LLMManagerImpl) GetAvailableProviders ¶
func (m *LLMManagerImpl) GetAvailableProviders() []string
GetAvailableProviders retorna uma lista de provedores disponíveis configurados
func (*LLMManagerImpl) GetClient ¶
GetClient retorna um cliente LLM com base no provedor e no modelo especificados.
func (*LLMManagerImpl) GetStackSpotAgentID ¶ added in v1.30.0
func (m *LLMManagerImpl) GetStackSpotAgentID() string
GetStackSpotAgentID retorna o agentID atual.
func (*LLMManagerImpl) GetStackSpotRealm ¶ added in v1.30.0
func (m *LLMManagerImpl) GetStackSpotRealm() string
GetStackSpotRealm retorna o realm atual.
func (*LLMManagerImpl) GetTokenManager ¶
func (m *LLMManagerImpl) GetTokenManager() (token.Manager, bool)
GetTokenManager retorna o TokenManager se ele estiver configurado.
func (*LLMManagerImpl) RefreshProviders ¶ added in v1.50.0
func (m *LLMManagerImpl) RefreshProviders()
RefreshProviders re-checks auth credentials and registers any providers that became available (e.g. after an OAuth login at runtime).
func (*LLMManagerImpl) SetStackSpotAgentID ¶ added in v1.30.0
func (m *LLMManagerImpl) SetStackSpotAgentID(agentID string)
SetStackSpotAgentID atualiza o agentID em tempo de execução.
func (*LLMManagerImpl) SetStackSpotRealm ¶ added in v1.30.0
func (m *LLMManagerImpl) SetStackSpotRealm(realm string)
SetStackSpotRealm atualiza o realm em tempo de execução.