shieldadapter

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package shieldadapter provides a guardrail adapter that bridges an external Shield content safety engine to the Nexus guard.Guard interface.

Deprecated: Shield ships its own guard, github.com/xraph/shield/integrations/nexusguard. This package will be removed in v2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapMessages

func WrapMessages(messages []provider.Message) string

WrapMessages extracts text from provider messages for Shield checking.

Types

type Adapter deprecated

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

Adapter bridges Shield to the Nexus guard.Guard interface.

Deprecated: Shield ships its own guard, github.com/xraph/shield/integrations/nexusguard. This package will be removed in v2.

func New deprecated

func New(engine Engine) *Adapter

New creates a Shield guard adapter.

Deprecated: Shield ships its own guard, github.com/xraph/shield/integrations/nexusguard. This package will be removed in v2.

func NewWithAction deprecated

func NewWithAction(engine Engine, action guard.Action) *Adapter

NewWithAction creates a Shield guard adapter with a specific action.

Deprecated: Shield ships its own guard, github.com/xraph/shield/integrations/nexusguard. This package will be removed in v2.

func (*Adapter) Check

func (a *Adapter) Check(ctx context.Context, input *guard.CheckInput) (*guard.CheckResult, error)

func (*Adapter) Name

func (a *Adapter) Name() string

func (*Adapter) Phase

func (a *Adapter) Phase() guard.Phase

type Engine

type Engine interface {
	// Check evaluates content for safety violations.
	Check(ctx context.Context, content string) (*Result, error)
}

Engine represents an external Shield content safety engine. This is the minimal interface that the adapter requires.

type Result

type Result struct {
	Allowed bool    `json:"allowed"`
	Reason  string  `json:"reason,omitempty"`
	Score   float64 `json:"score"`
}

Result is the Shield check result.

Jump to

Keyboard shortcuts

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