Documentation
¶
Index ¶
- Variables
- func AudioMIME(format string) string
- func Bool(raw []byte, typ jsonparser.ValueType) (bool, error)
- func CollectText(parts []chat.Part) string
- func Copy(raw []byte) jsontext.Value
- func Error(param, message string, cause error) *chat.Error
- func Float(raw []byte, typ jsonparser.ValueType) (float64, error)
- func InputTextParts(parts []chat.Part) []map[string]any
- func Int(raw []byte, typ jsonparser.ValueType) (int, error)
- func MediaDataURL(media chat.Media) (string, error)
- func OutputTextParts(parts []chat.Part) []map[string]any
- func ParseDataURL(value string) (chat.Media, error)
- func ParseFileData(value, param string) (chat.Media, error)
- func ParseFileMediaValue(value Value, param string) (chat.Media, string, error)
- func ParseMediaURL(value, detail string) (chat.Media, error)
- func String(raw []byte, typ jsonparser.ValueType) (string, error)
- func Strings(raw []byte, typ jsonparser.ValueType) ([]string, error)
- func ValidateImageDetail(detail, param string) error
- func ValidateObject(data []byte) error
- type Value
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Bool ¶ added in v0.3.0
func Bool(raw []byte, typ jsonparser.ValueType) (bool, error)
Bool decodes a borrowed JSON boolean.
func CollectText ¶
CollectText concatenates text and reasoning-summary parts.
func Float ¶ added in v0.3.0
func Float(raw []byte, typ jsonparser.ValueType) (float64, error)
Float decodes a JSON number.
func InputTextParts ¶
InputTextParts converts text parts into Responses input_text objects.
func Int ¶ added in v0.3.0
func Int(raw []byte, typ jsonparser.ValueType) (int, error)
Int decodes a JSON integer using the platform int range.
func MediaDataURL ¶
MediaDataURL encodes inline media as a base64 data URL.
func OutputTextParts ¶
OutputTextParts converts text parts into Responses output_text objects.
func ParseDataURL ¶
ParseDataURL decodes a base64 data URL into inline chat.Media.
func ParseFileData ¶
ParseFileData parses base64 or data URL file data into inline chat.Media.
func ParseFileMediaValue ¶ added in v0.3.0
ParseFileMediaValue parses a borrowed file reference object without first materializing it as a map.
func ParseMediaURL ¶
ParseMediaURL parses an HTTP(S) URL or data URL into chat.Media.
func String ¶ added in v0.3.0
func String(raw []byte, typ jsonparser.ValueType) (string, error)
String decodes a borrowed JSON string. JSON null has encoding/json's zero value semantics for optional scalar fields.
func Strings ¶ added in v0.3.0
func Strings(raw []byte, typ jsonparser.ValueType) ([]string, error)
Strings decodes a JSON array of strings.
func ValidateImageDetail ¶
ValidateImageDetail checks that detail is an allowed image detail value.
func ValidateObject ¶ added in v0.3.0
ValidateObject validates one complete JSON object, including unique names, UTF-8, and nested values, before jsonparser traverses its borrowed slices.
Types ¶
type Value ¶ added in v0.3.0
type Value struct {
Raw []byte
Type jsonparser.ValueType
}
Value is a borrowed JSON value from the request body. Raw is valid until the current parse returns; parsers copy it when storing it in the result.