protocolutil

package
v0.6.13 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeToolArguments

func EncodeToolArguments(arguments map[string]any) (string, error)

EncodeToolArguments serializes provider-independent tool arguments for both OpenAI wire protocols.

func ExplicitMappedEffort added in v0.6.13

func ExplicitMappedEffort(model llm.Model, level llm.ModelThinkingLevel) (string, bool)

ExplicitMappedEffort returns an effort only when the model catalog explicitly maps the level. A supported but absent mapping represents the provider's fixed default and must not be serialized as a tunable effort.

func MappedEffort

func MappedEffort(model llm.Model, level llm.ModelThinkingLevel) string

MappedEffort returns the provider-specific value for a level, falling back to the level's own name when the model omits a mapping.

func OffEffort

func OffEffort(model llm.Model) string

OffEffort returns the provider value for disabled thinking.

func OffString

func OffString(model llm.Model) (string, bool)

OffString returns the model's explicit disabled mapping, if any.

func SanitizeToolCallID

func SanitizeToolCallID(id string) string

SanitizeToolCallID replaces characters outside [a-zA-Z0-9_-] with an underscore so IDs can be replayed across OpenAI-compatible protocols.

func TruncateASCII

func TruncateASCII(id string, limit int) string

TruncateASCII caps an ASCII identifier at limit bytes.

Types

type Thinking

type Thinking struct {
	Specified bool
	Level     llm.ModelThinkingLevel
}

Thinking preserves the difference between an omitted thinking option and an explicit request to disable thinking.

func ResolveThinking

func ResolveThinking(model llm.Model, requested llm.ModelThinkingLevel) Thinking

ResolveThinking clamps an explicitly requested level to one the model supports. An empty request stays unspecified.

func (Thinking) Enabled

func (thinking Thinking) Enabled() bool

Jump to

Keyboard shortcuts

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