package types
type FileType string
const (
FileTypeImage FileType = "image"
FileTypeAudio FileType = "audio"
FileTypeVideo FileType = "video"
FileTypeFile FileType = "file"
)
type TokenType string
const (
TokenTypeTextNumber TokenType = "text_number"
TokenTypeTokenizer TokenType = "tokenizer"
TokenTypeImage TokenType = "image"
)
type TokenCountMeta struct {
TokenType TokenType `json:"token_type,omitempty"`
CombineText string `json:"combine_text,omitempty"`
ToolsCount int `json:"tools_count,omitempty"`
NameCount int `json:"name_count,omitempty"`
MessagesCount int `json:"messages_count,omitempty"`
Files []*FileMeta `json:"files,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
ImagePriceRatio float64 `json:"image_ratio,omitempty"`
}
type FileMeta struct {
FileType
Source FileSource
Detail string
}
func NewFileMeta(fileType FileType, source FileSource) *FileMeta {
return &FileMeta{
FileType: fileType,
Source: source,
}
}
func NewImageFileMeta(source FileSource, detail string) *FileMeta {
return &FileMeta{
FileType: FileTypeImage,
Source: source,
Detail: detail,
}
}
func (f *FileMeta) GetIdentifier() string {
if f.Source != nil {
return f.Source.GetIdentifier()
}
return "unknown"
}
func (f *FileMeta) IsURL() bool {
return f.Source != nil && f.Source.IsURL()
}
func (f *FileMeta) GetRawData() string {
if f.Source != nil {
return f.Source.GetRawData()
}
return ""
}
type RequestMeta struct {
OriginalModelName string `json:"original_model_name"`
UserUsingGroup string `json:"user_using_group"`
PromptTokens int `json:"prompt_tokens"`
PreConsumedQuota int `json:"pre_consumed_quota"`
}