Documentation
¶
Index ¶
- Variables
- func ValidateFile(file File, provider string) error
- type File
- func AudioFile(source string, mode ...FileMode) File
- func FromBytes(fb FileBytes, mode ...FileMode) File
- func ImageFile(source string, mode ...FileMode) File
- func NewFile(source string, mode ...FileMode) File
- func PDFFile(source string, mode ...FileMode) File
- func TextFile(source string, mode ...FileMode) File
- func VideoFile(source string, mode ...FileMode) File
- type FileBytes
- type FileMode
- type FileType
- type ProviderConstraints
- type TransmitMethod
Constants ¶
This section is empty.
Variables ¶
View Source
var Providers = map[string]ProviderConstraints{ "openai": { Provider: "openai", SupportsImage: true, SupportsPDF: true, SupportsAudio: true, SupportsVideo: false, SupportsText: true, ImageMaxBytes: 20 * 1024 * 1024, ImageMaxCount: 10, PDFMaxBytes: 32 * 1024 * 1024, PDFMaxPages: 100, AudioMaxBytes: 25 * 1024 * 1024, AudioMaxMinutes: 25, }, "anthropic": { Provider: "anthropic", SupportsImage: true, SupportsPDF: true, SupportsAudio: false, SupportsVideo: false, SupportsText: true, ImageMaxBytes: 5 * 1024 * 1024, ImageMaxCount: 100, ImageMaxWidth: 8000, ImageMaxHeight: 8000, PDFMaxBytes: 32 * 1024 * 1024, PDFMaxPages: 100, }, "gemini": { Provider: "gemini", SupportsImage: true, SupportsPDF: true, SupportsAudio: true, SupportsVideo: true, SupportsText: true, ImageMaxBytes: 100 * 1024 * 1024, PDFMaxBytes: 50 * 1024 * 1024, AudioMaxBytes: 100 * 1024 * 1024, AudioMaxMinutes: 570, VideoMaxBytes: 2 * 1024 * 1024 * 1024, VideoMaxMinutes: 60, }, "bedrock": { Provider: "bedrock", SupportsImage: true, SupportsPDF: true, SupportsAudio: false, SupportsVideo: false, SupportsText: true, ImageMaxBytes: 4608 * 1024, ImageMaxWidth: 8000, ImageMaxHeight: 8000, PDFMaxBytes: 3840 * 1024, PDFMaxPages: 100, }, }
Known provider constraints (from CrewAI Python documentation).
Functions ¶
func ValidateFile ¶
ValidateFile checks if a file is compatible with a given provider.
Types ¶
type File ¶
type File interface {
Type() FileType
Source() string
Mode() FileMode
Data() ([]byte, error)
Base64() (string, error)
MimeType() string
SizeBytes() (int64, error)
TransmitAs() TransmitMethod
}
File is the base interface for all file types.
type FileMode ¶
type FileMode string
FileMode controls how files are handled when they exceed provider limits.
type ProviderConstraints ¶
type ProviderConstraints struct {
Provider string
ImageMaxBytes int64
ImageMaxCount int
ImageMaxWidth int
ImageMaxHeight int
PDFMaxBytes int64
PDFMaxPages int
AudioMaxBytes int64
AudioMaxMinutes float64
VideoMaxBytes int64
VideoMaxMinutes float64
SupportsImage bool
SupportsPDF bool
SupportsAudio bool
SupportsVideo bool
SupportsText bool
}
ProviderConstraints defines the file size and count limits for an LLM provider.
type TransmitMethod ¶
type TransmitMethod string
TransmitMethod indicates how the file content is sent to the LLM.
const ( TransmitInlineBase64 TransmitMethod = "inline_base64" TransmitFileUpload TransmitMethod = "file_upload" TransmitURLReference TransmitMethod = "url_reference" )
Click to show internal directories.
Click to hide internal directories.