Speech Streaming
Stream
`shared/speech.Stream` iterator and messaging protocol.
Core methods
func (s *Stream) SendAudio(pcm []byte) error
func (s *Stream) Flush() error
func (s *Stream) Next() bool
func (s *Stream) Current() StreamResponse
func (s *Stream) Text() string
func (s *Stream) Err() error
func (s *Stream) Close() errorResponse envelope
type StreamResponse struct {
Type ResponseType `json:"type"`
Data json.RawMessage `json:"data"`
}ResponseType values
dataerrorevents
Decoding payload
var d speech.StreamData
if err := resp.UnmarshalData(&d); err != nil {
panic(err)
}Related payload types
StreamDataErrorDataEventData