systemprompt

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package systemprompt is the built-in system_prompt plugin: it injects, overrides, or decorates the system message before the provider call.

Index

Constants

View Source
const Name = "system_prompt"

Name is the plugin's manifest name.

Variables

This section is empty.

Functions

func New

func New() pluginapi.Plugin

New returns a fresh plugin value.

Types

type Config

type Config struct {
	Mode    string `json:"mode"`
	Content string `json:"content"`
}

Config is the instance configuration.

func ParseConfig

func ParseConfig(raw json.RawMessage) (Config, error)

ParseConfig decodes and validates a config: mode defaults to inject and content is required.

type Mode

type Mode string

Mode selects how the configured content is applied.

const (
	// ModeInject adds a system message only if none exists.
	ModeInject Mode = "inject"
	// ModeOverride replaces every system and developer message with one.
	ModeOverride Mode = "override"
	// ModeDecorator prepends the content to the first system message, or
	// injects one when there is none.
	ModeDecorator Mode = "decorator"
)

type Plugin

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

Plugin implements the prompt hook.

func (*Plugin) Close

func (p *Plugin) Close(context.Context) error

Close releases nothing.

func (*Plugin) Init

func (p *Plugin) Init(_ context.Context, raw json.RawMessage, _ pluginapi.Host) error

Init parses and validates the config.

func (*Plugin) Manifest

func (p *Plugin) Manifest() pluginapi.Manifest

Manifest describes the plugin.

func (*Plugin) OnPrompt

OnPrompt applies the configured mode to the prompt's system messages.

func (*Plugin) Summarize

func (p *Plugin) Summarize(raw json.RawMessage) string

Summarize renders the one-line summary shown in the guardrails list.

Jump to

Keyboard shortcuts

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