- Added support for converting extended types (file, data) to standard LLM types (text, image_url, input_audio) in the Stream method. - Introduced a new agentCallerWrapper to facilitate agent calls from the content package. - Implemented ThreadID management for nested agent calls to improve concurrent stream identification. - Enhanced message handling to include metadata for message_start and message_end events, allowing for better tracking of message states. - Removed deprecated vision capability checks from the Assistant initialization process, streamlining the codebase. - Added new content types (file, data) to the context types for improved message content handling.
25 lines
1 KiB
Go
25 lines
1 KiB
Go
package content
|
|
|
|
import (
|
|
"github.com/yaoapp/gou/connector/openai"
|
|
agentContext "github.com/yaoapp/yao/agent/context"
|
|
)
|
|
|
|
// Handler defines the interface for handling different content types
|
|
// Converts content (images, documents, etc.) to text or standard formats
|
|
type Handler interface {
|
|
// CanHandle checks if this handler can handle the given content type
|
|
CanHandle(contentType string, fileType FileType) bool
|
|
|
|
// Handle converts the content and returns processed result
|
|
// ctx: agent context (passed from Vision function)
|
|
// capabilities: model capabilities (for vision/audio support detection)
|
|
// uses: configuration for external tools (agents/MCP servers)
|
|
Handle(ctx *agentContext.Context, info *Info, capabilities *openai.Capabilities, uses *agentContext.Uses) (*Result, error)
|
|
}
|
|
|
|
// Fetcher defines the interface for fetching content from different sources
|
|
type Fetcher interface {
|
|
// Fetch retrieves content from a URL or file ID
|
|
Fetch(ctx *agentContext.Context, source Source, url string) (*Info, error)
|
|
}
|