wire

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package wire detects the wire format of an LLM request body.

squoze speaks three dialects out of the box: OpenAI Chat Completions, Anthropic Messages and the OpenAI Responses API. Detection is a cheap structural probe — no full unmarshal, no reflection — because it runs on every request in front of every mutation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format int

Format identifies a supported request shape.

const (
	FormatUnknown Format = iota
	FormatOpenAIChat
	FormatAnthropicMessages
	FormatOpenAIResponses
)

func Detect

func Detect(body []byte) Format

Detect classifies a request body. Invalid JSON is FormatUnknown: callers must treat unknown as pass-through (fail-open contract).

Priority matters: `system` exists only in Anthropic Messages, while both chat and Anthropic carry `messages`; Responses is identified by its dedicated `instructions`/`input` fields.

func (Format) String

func (f Format) String() string

Jump to

Keyboard shortcuts

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