Documentation
¶
Index ¶
- Constants
- type ActionSettings
- type ModerationData
- type Plugin
- func (p *Plugin) Execute(ctx context.Context, in appplugins.ExecInput) (*appplugins.Result, error)
- func (p *Plugin) MandatoryStages() []policy.Stage
- func (p *Plugin) MutatesMetadata() bool
- func (p *Plugin) MutatesRequestBody() bool
- func (p *Plugin) MutatesResponseBody() bool
- func (p *Plugin) Name() string
- func (p *Plugin) SupportedModes() []policy.Mode
- func (p *Plugin) SupportedStages() []policy.Stage
- func (p *Plugin) ValidateConfig(settings map[string]any) error
- type Settings
Constants ¶
View Source
const PluginName = "openai_moderation"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionSettings ¶
type ActionSettings struct {
Message string `mapstructure:"message"`
}
type ModerationData ¶
type ModerationData struct {
Model string `json:"model,omitempty"`
CategoryScores map[string]float64 `json:"category_scores,omitempty"`
MaxScore float64 `json:"max_score"`
MaxScoreCategory string `json:"max_score_category,omitempty"`
FlaggedByOpenAI bool `json:"flagged_by_openai"`
FlaggedCategories []violation `json:"flagged_categories,omitempty"`
Decision string `json:"decision,omitempty"`
}
type Plugin ¶
type Plugin struct {
// contains filtered or unexported fields
}
func (*Plugin) Execute ¶
func (p *Plugin) Execute(ctx context.Context, in appplugins.ExecInput) (*appplugins.Result, error)
func (*Plugin) MandatoryStages ¶
func (*Plugin) MutatesMetadata ¶
func (*Plugin) MutatesRequestBody ¶
func (*Plugin) MutatesResponseBody ¶
func (*Plugin) SupportedModes ¶
func (*Plugin) SupportedStages ¶
type Settings ¶
type Settings struct {
APIKey string `mapstructure:"api_key"` // #nosec G101 -- config field name, not a credential
Model string `mapstructure:"model"`
Stages []string `mapstructure:"stages"`
Categories []string `mapstructure:"categories"`
Thresholds map[string]float64 `mapstructure:"thresholds"`
BlockOnFlagged bool `mapstructure:"block_on_flagged"`
Action ActionSettings `mapstructure:"action"`
}
Click to show internal directories.
Click to hide internal directories.