completions

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAdapter

func NewAdapter() internalprotocol.Adapter

NewAdapter returns the Chat Completions protocol adapter.

func ParseRequest

func ParseRequest(data []byte) (parsedRequest, error)

ParseRequest decodes a Chat Completions request directly from its body. Returned strings, slices, maps, and raw JSON own their data independently of body after this function returns.

Types

type Adapter

type Adapter struct{}

Adapter encodes canonical events as OpenAI Chat Completions.

func (Adapter) Response

func (Adapter) Response(req chat.Request, result execution.Result, meta responseMeta) (any, error)

func (Adapter) Stream

func (Adapter) Stream(w http.ResponseWriter, parsed parsedRequest, meta *responseMeta, limits chat.Limits) streamEncoder

Stream returns an SSE encoder for Chat Completions streaming chunks.

func (Adapter) ValidateEvent

func (Adapter) ValidateEvent(event chat.Event) error

ValidateEvent checks whether event can be encoded for Chat Completions.

Jump to

Keyboard shortcuts

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