patchtoolcalls

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package patchtoolcalls provides a middleware that patches dangling tool calls in the message history.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New creates a new patch tool calls middleware with the given configuration.

The middleware scans the message history before each model invocation and inserts placeholder tool messages for any tool calls that don't have corresponding responses.

func NewTyped added in v0.9.0

NewTyped creates a new generic patch tool calls middleware.

The middleware scans the message history before each model invocation and inserts placeholder tool messages for any tool calls that don't have corresponding responses.

Types

type Config

type Config struct {
	// PatchedContentGenerator is an optional custom function to generate the content
	// of patched tool messages. If not provided, a default message will be used.
	//
	// Parameters:
	//   - ctx: the context for the operation
	//   - toolName: the name of the tool that was called
	//   - toolCallID: the id of the tool call
	//
	// Returns:
	//   - string: the content to use for the patched tool message
	//   - error: any error that occurred during generation
	PatchedContentGenerator func(ctx context.Context, toolName, toolCallID string) (string, error)
}

Config defines the configuration options for the patch tool calls middleware.

Jump to

Keyboard shortcuts

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