patch

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultUpdateFormSystemPromptTemplate = `` /* 2465-byte string literal not displayed */

DefaultUpdateFormSystemPromptTemplate is the default system prompt template used by ToolBasedPatchGenerator. The template may contain a single "%s" placeholder for the tool name.

Variables

This section is empty.

Functions

func ApplyRFC6902

func ApplyRFC6902[T any](current T, ops []Operation) (T, error)

Types

type Generator

type Generator[T any] interface {
	GeneratePatch(ctx context.Context, req *types.ToolRequest[T]) (*UpdateFormArgs, error)
}

type GeneratorOption added in v0.0.2

type GeneratorOption func(*patchGeneratorOptions)

func WithPatchSystemPrompt added in v0.0.2

func WithPatchSystemPrompt(systemPrompt string) GeneratorOption

WithPatchSystemPrompt overrides the system prompt used by ToolBasedPatchGenerator.

func WithPatchSystemPromptTemplate added in v0.0.2

func WithPatchSystemPromptTemplate(systemPromptTemplate string) GeneratorOption

WithPatchSystemPromptTemplate overrides the system prompt template used by ToolBasedPatchGenerator. If the template contains "%s", it will be formatted with the tool name.

type Operation

type Operation struct {
	Op    string `json:"op" jsonschema:"enum=add,enum=replace,enum=remove,description=RFC6902 operation type (add, replace, remove)"`
	Path  string `json:"path" jsonschema:"pattern=^/.*$,description=RFC6902 JSON Pointer, must start with '/'"`
	Value any    `json:"value,omitempty" jsonschema:"description=Value to apply for add/replace operations (optional for remove)"`
}

type ToolBasedPatchGenerator

type ToolBasedPatchGenerator[T any] struct {
	// contains filtered or unexported fields
}

func NewToolBasedPatchGenerator

func NewToolBasedPatchGenerator[T any](chatModel model.ToolCallingChatModel, opts ...GeneratorOption) (*ToolBasedPatchGenerator[T], error)

func (*ToolBasedPatchGenerator[T]) GeneratePatch

func (g *ToolBasedPatchGenerator[T]) GeneratePatch(ctx context.Context, req *types.ToolRequest[T]) (*UpdateFormArgs, error)

type UpdateFormArgs

type UpdateFormArgs struct {
	Ops []Operation `json:"ops" jsonschema:"description=Array of RFC6902 JSON Patch operations to update the form"`
}

Jump to

Keyboard shortcuts

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