Documentation
¶
Index ¶
- Constants
- Variables
- func NewValidationError(msg string) error
- func ValidateAPIKey(key string, providerName string) error
- func ValidateCrossProviderConfig(cfg *config.Config) error
- func ValidateProviderModel(providerName, modelName string) error
- func ValidateURL(rawURL string, providerName string) error
- type KeyFormat
- type ValidationError
Constants ¶
View Source
const ( // MaxProviderNameLength is the maximum length for custom provider names. // Most provider names are short identifiers (e.g., "anthropic", "openai"). MaxProviderNameLength = 50 // MaxModelNameLength is the maximum length for model names. // Most LLM model names are reasonable length (e.g., "claude-3-opus-20240229"). MaxModelNameLength = 100 )
Validation limits for provider and model names.
Variables ¶
View Source
var ( ErrInvalidAPIKey = &ValidationError{msg: "API key validation failed"} ErrInvalidURL = &ValidationError{msg: "invalid URL: must be HTTPS and not use blocked hosts"} )
Functions ¶
func NewValidationError ¶
func ValidateAPIKey ¶
func ValidateCrossProviderConfig ¶ added in v1.10.0
validateCrossProviderConfig validates configuration across all providers to detect conflicts.
This function checks for environment variable collisions where multiple providers attempt to set the same environment variable with different values. Collisions with identical values are allowed (idempotent).
func ValidateProviderModel ¶ added in v1.10.0
ValidateProviderModel validates a model name against provider capabilities. For built-in providers with default models, this ensures the model is reasonable. Returns an error if the model name is invalid.
func ValidateURL ¶
Types ¶
type ValidationError ¶
type ValidationError struct {
// contains filtered or unexported fields
}
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Click to show internal directories.
Click to hide internal directories.