- Added logging for hook start and completion in the Assistant's Stream method to improve traceability during execution. - Refactored the AgentGetterFunc to utilize the caller package, enhancing modularity and reducing circular dependencies. - Updated the CallAgent function to check for the initialized AgentGetterFunc from the caller package, ensuring proper agent loading. - Enhanced the Search handler to support an optional context parameter, improving flexibility for agent mode operations. - Refined the agentSearch function to delegate search requests to a new AgentProvider, streamlining the search process. - Updated DESIGN.md to reflect changes in search modes and the integration of the caller package, ensuring comprehensive documentation.
17 lines
743 B
Go
17 lines
743 B
Go
// Package caller provides a shared interface for calling agents
|
|
// This package is used by both content and search packages to avoid circular dependencies
|
|
package caller
|
|
|
|
import (
|
|
agentContext "github.com/yaoapp/yao/agent/context"
|
|
)
|
|
|
|
// AgentCaller interface for calling agents (to avoid circular dependency)
|
|
// Used by content handlers (vision, audio, etc.) and search handlers (agent mode)
|
|
type AgentCaller interface {
|
|
Stream(ctx *agentContext.Context, messages []agentContext.Message, options ...*agentContext.Options) (interface{}, error)
|
|
}
|
|
|
|
// AgentGetterFunc is a function type that gets an agent by ID
|
|
// This should be set by the assistant package during initialization
|
|
var AgentGetterFunc func(agentID string) (AgentCaller, error)
|