Documentation
¶
Index ¶
- func AudioMIME(format string) string
- func CollectText(parts []chat.Part) string
- func DecodeBool(object map[string]jsontext.Value, key string) (*bool, error)
- func DecodeFloat(object map[string]jsontext.Value, key string) (*float64, error)
- func DecodeInt(object map[string]jsontext.Value, key string) (*int, error)
- func DecodeObject(data []byte) (map[string]jsontext.Value, error)
- func DecodeString(object map[string]jsontext.Value, key string) (string, bool, error)
- func DecodeStringSlice(object map[string]jsontext.Value, key string) ([]string, error)
- func Error(param, message string, cause error) *chat.Error
- func InputTextParts(parts []chat.Part) []map[string]any
- func MediaDataURL(media chat.Media) (string, error)
- func NamespacedExtensions(object map[string]jsontext.Value, allowed map[string]bool) map[string]jsontext.Value
- func OutputTextParts(parts []chat.Part) []map[string]any
- func ParseChatContent(raw jsontext.Value) ([]chat.Part, error)
- func ParseDataURL(value string) (chat.Media, error)
- func ParseFileData(value, param string) (chat.Media, error)
- func ParseFileMedia(object map[string]jsontext.Value, param string) (chat.Media, string, error)
- func ParseMediaURL(value, detail string) (chat.Media, error)
- func ParseStringOrContent(raw jsontext.Value, param string, ...) ([]chat.Part, error)
- func RawArray(raw jsontext.Value, param string) ([]jsontext.Value, error)
- func RawObject(raw jsontext.Value, param string) (map[string]jsontext.Value, error)
- func RejectUnknown(object map[string]jsontext.Value, allowed map[string]bool) error
- func RejectUnknownStrict(object map[string]jsontext.Value, allowed map[string]bool) error
- func RequireString(object map[string]jsontext.Value, key string) (string, error)
- func ValidateImageDetail(detail, param string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectText ¶
CollectText concatenates text and reasoning-summary parts.
func DecodeBool ¶
DecodeBool reads an optional boolean field from object.
func DecodeFloat ¶
DecodeFloat reads an optional number field from object.
func DecodeObject ¶
DecodeObject decodes exactly one JSON object. encoding/json/v2 rejects duplicate names and trailing top-level values by default.
func DecodeString ¶
DecodeString reads an optional string field from object.
func DecodeStringSlice ¶
DecodeStringSlice reads an optional string array field from object.
func InputTextParts ¶
InputTextParts converts text parts into Responses input_text objects.
func MediaDataURL ¶
MediaDataURL encodes inline media as a base64 data URL.
func NamespacedExtensions ¶
func NamespacedExtensions(object map[string]jsontext.Value, allowed map[string]bool) map[string]jsontext.Value
NamespacedExtensions collects x- prefixed and namespaced extension fields.
func OutputTextParts ¶
OutputTextParts converts text parts into Responses output_text objects.
func ParseChatContent ¶
ParseChatContent parses OpenAI Chat Completions message content into parts.
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 ParseFileMedia ¶
ParseFileMedia parses a file reference object into chat.Media and an optional filename.
func ParseMediaURL ¶
ParseMediaURL parses an HTTP(S) URL or data URL into chat.Media.
func ParseStringOrContent ¶
func ParseStringOrContent(raw jsontext.Value, param string, parser func(jsontext.Value) ([]chat.Part, error)) ([]chat.Part, error)
ParseStringOrContent accepts either a plain string or structured content via parser.
func RejectUnknown ¶
RejectUnknown rejects object keys that are not allowed or namespaced extensions.
func RejectUnknownStrict ¶
RejectUnknownStrict rejects any object key not present in allowed.
func RequireString ¶
RequireString reads a required non-empty string field from object.
func ValidateImageDetail ¶
ValidateImageDetail checks that detail is an allowed image detail value.
Types ¶
This section is empty.