Documentation
¶
Overview ¶
Package stream provides interfaces for streaming conversations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoContent = errors.New("no content")
ErrNoContent happens when the client is returning no content.
Functions ¶
func CallTool ¶
func CallTool( id, name string, data []byte, caller func(name string, data []byte) (string, error), ) (proto.Message, proto.ToolCallStatus)
CallTool calls a tool using the provided data and caller, and returns the resulting proto.Message and proto.ToolCallStatus.
Types ¶
type Stream ¶
type Stream interface {
// returns false when no more messages, caller should run [Stream.CallTools()]
// once that happens, and then check for this again
Next() bool
// the current chunk
// implementation should accumulate chunks into a message, and keep its
// internal conversation state
Current() (proto.Chunk, error)
// closes the underlying stream
Close() error
// streaming error
Err() error
// the whole conversation
Messages() []proto.Message
// handles any pending tool calls
CallTools() []proto.ToolCallStatus
}
Stream is an ongoing stream.
Click to show internal directories.
Click to hide internal directories.