request_meta.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package types
  2. type FileType string
  3. const (
  4. FileTypeImage FileType = "image" // Image file type
  5. FileTypeAudio FileType = "audio" // Audio file type
  6. FileTypeVideo FileType = "video" // Video file type
  7. FileTypeFile FileType = "file" // Generic file type
  8. )
  9. type TokenType string
  10. const (
  11. TokenTypeTextNumber TokenType = "text_number" // Text or number tokens
  12. TokenTypeTokenizer TokenType = "tokenizer" // Tokenizer tokens
  13. TokenTypeImage TokenType = "image" // Image tokens
  14. )
  15. type TokenCountMeta struct {
  16. TokenType TokenType `json:"token_type,omitempty"` // Type of tokens used in the request
  17. CombineText string `json:"combine_text,omitempty"` // Combined text from all messages
  18. ToolsCount int `json:"tools_count,omitempty"` // Number of tools used
  19. NameCount int `json:"name_count,omitempty"` // Number of names in the request
  20. MessagesCount int `json:"messages_count,omitempty"` // Number of messages in the request
  21. Files []*FileMeta `json:"files,omitempty"` // List of files, each with type and content
  22. MaxTokens int `json:"max_tokens,omitempty"` // Maximum tokens allowed in the request
  23. ImagePriceRatio float64 `json:"image_ratio,omitempty"` // Ratio for image size, if applicable
  24. //IsStreaming bool `json:"is_streaming,omitempty"` // Indicates if the request is streaming
  25. }
  26. type FileMeta struct {
  27. FileType
  28. MimeType string
  29. OriginData string // url or base64 data
  30. Detail string
  31. ParsedData *LocalFileData
  32. }
  33. type RequestMeta struct {
  34. OriginalModelName string `json:"original_model_name"`
  35. UserUsingGroup string `json:"user_using_group"`
  36. PromptTokens int `json:"prompt_tokens"`
  37. PreConsumedQuota int `json:"pre_consumed_quota"`
  38. }