Help us shape the future of Go! Take the 2026 Go Developer Survey

modelcall

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package modelcall supplies neutral request and response metadata to decorators around model-adapter calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecordResponse

func RecordResponse(ctx context.Context, modelID, responseID string)

RecordResponse supplies service-reported identifiers without changing response updates. Empty values do not clear metadata from earlier streaming events.

func WithDecorator

func WithDecorator(ctx context.Context, decorate Decorator) context.Context

WithDecorator enables decoration for the current agent only. A nested agent must enable its own decorator rather than inheriting its caller's settings.

func Wrap

func Wrap(run agent.RunFunc, requestModel func([]agent.Option) string) agent.RunFunc

Wrap adds the adapter's neutral metadata when a decorator is enabled. Uninstrumented calls retain the adapter's original execution behavior.

Types

type Decorator

type Decorator func(agent.RunFunc, *Metadata) agent.RunFunc

Decorator wraps one adapter invocation without changing its public contract.

type Metadata

type Metadata struct {
	RequestModelID  string
	ResponseModelID string
	ResponseID      string
}

Metadata belongs to one adapter invocation. RequestModelID is resolved before the decorator runs; RecordResponse supplies service-reported identifiers.

Jump to

Keyboard shortcuts

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