Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diagnostics ¶
type Diagnostics struct {
Name, Subject, Prefix, ContentErrorCode string
BufferBytes int
Error func(code, summary, detail string) error
DescribeError func(error) (code, message string, ok bool)
Incompatible func(code, message string) error
ForwardError func(error) error
}
Diagnostics keeps error construction and transport classification with the caller. DescribeError supplies the code and caller-facing terminal message.
type Policy ¶
type Policy struct {
Diagnostics Diagnostics
CompletionIncludesReasoning bool
ReplaySummaries bool
CloseFailedStream bool
NoHostedSearchInstruction string
CustomInputInstruction string
ExecInstruction string
FormatInstructionPrefix string
RestoreReasoning func(string) (map[string]any, error)
SealReasoning func(any) string
ResolveEffort func(string) (string, error)
}
Policy supplies capabilities resolved by the authenticated provider boundary. The codec does not select providers, inspect credentials, or retain sessions.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream retains validated native tool identities for one translated request. Endpoint framing and normalized chunks remain private to the codec.
func Translate ¶
func Translate(fields map[string]json.RawMessage, model, format string, policy Policy) (map[string]any, *Stream, error)
Translate validates shared tool identity and history, then builds the selected provider's endpoint request without an intermediate Chat request. It translates only representations with defined equivalents, never treating encrypted_content as text or silently removing unsupported history items. The caller remains responsible for executing tools. Source: internal/router/grok_protocol.go:81:477@413bbaa9b9202042199c753690febe7bc1358fa6 translateChatRequest
func (*Stream) Read ¶
func (tr *Stream) Read(reader io.Reader, emit func(map[string]any) error, failureDetail func([]byte) string) (result map[string]any, streamErr error)
Read normalizes the selected endpoint stream, validates it, and emits the Responses lifecycle. failureDetail formats provider errors at the caller's transport boundary and must be non-nil.