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
func NewTyped[M adk.MessageType](_ context.Context, cfg *Config) (adk.TypedChatModelAgentMiddleware[M], error)
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.