responses

package
v0.77.7 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 13 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 responses adapts one explicitly selected own endpoint to SpeechKit's existing cascaded/native conversation pipeline. The application owns account, consent, funding and current endpoint admission; this adapter never selects a model, an agent, a credential or a fallback.

Stability: Experimental

Index

Constants

View Source
const MaxContextBytes = 128 << 10

MaxContextBytes bounds the encoded conversation context.

View Source
const MaxContextMessages = 128

MaxContextMessages bounds the retained conversation length.

Variables

This section is empty.

Functions

func ValidateContext

func ValidateContext(messages []Message) error

ValidateContext checks the bounded conversation accepted by this adapter.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent streams responses for one immutable endpoint binding.

func New

func New(config Config) (*Agent, error)

New constructs an adapter for an explicitly admitted endpoint binding.

func (*Agent) Run

Run collects the answer for one cascaded conversation turn.

func (*Agent) Stream

func (a *Agent) Stream(ctx context.Context, input cascaded.AgentInput, emit func(string) error) (cascaded.AgentOutput, error)

Stream emits answer fragments for one cascaded conversation turn.

func (*Agent) StreamTurn

func (a *Agent) StreamTurn(ctx context.Context, input cascaded.AgentInput, turnID string, emit func(string) error) (cascaded.AgentOutput, error)

StreamTurn consumes the observed turn identity before its HTTP effect.

type Config

type Config struct {
	URL        string
	Connection Connection
	Messages   []Message
	Surface    string
	Headers    func(context.Context, []byte) (http.Header, error)
	Client     *http.Client
}

Config is immutable for one voice lifetime. Messages are a bounded copy of the existing client-local direct chat, not a new durable conversation store.

type Connection

type Connection struct {
	Mode       string `json:"mode"`
	EndpointID string `json:"endpointId"`
	Model      string `json:"model"`
}

Connection binds the explicitly selected endpoint and model.

type Context

type Context struct {
	Connection     Connection `json:"connection"`
	Messages       []Message  `json:"messages"`
	Surface        string     `json:"surface"`
	ConversationID string     `json:"conversationId"`
}

Context is the application-owned plain direct chat retained for this voice lifetime. ConversationID is a client correlation value, never a grant.

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

Message is one turn in the application-owned conversation.

type TurnError

type TurnError struct {
	// contains filtered or unexported fields
}

TurnError reports a denied turn without exposing upstream error details.

func (*TurnError) Code

func (e *TurnError) Code() string

Code returns the structured safe failure code.

func (*TurnError) Error

func (e *TurnError) Error() string

Error returns the public denial description.

Jump to

Keyboard shortcuts

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