- Updated Stream and Run methods in the Assistant to use pointer receivers for context, enhancing performance and clarity. - Introduced stack management in context handling, including initialization and cleanup of stack references. - Enhanced the Release method in Context to ensure proper cleanup of resources, including stacks and writer references. - Added new stack status constants and validation to improve traceability and error handling in agent operations. - Removed the obsolete JavaScript API file to streamline the codebase.
20 lines
546 B
Go
20 lines
546 B
Go
package context
|
|
|
|
import "net/http"
|
|
|
|
// StreamFunc the streaming function
|
|
type StreamFunc func(data []byte) int
|
|
|
|
// Writer is an alias for http.ResponseWriter interface used by an agent to construct a response.
|
|
// A Writer may not be used after the agent execution has completed.
|
|
type Writer = http.ResponseWriter
|
|
|
|
// Agent the agent interface
|
|
type Agent interface {
|
|
|
|
// Stream stream the agent
|
|
Stream(ctx *Context, messages []Message, handler StreamFunc) error
|
|
|
|
// Run run the agent
|
|
Run(ctx *Context, messages []Message) (*Response, error)
|
|
}
|