aiutil

package
v0.12.4-beta.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertDataUserFile

func ConvertDataUserFile(blockText string) (bool, *uctypes.UIMessagePart)

ConvertDataUserFile converts OpenAI attached file/directory blocks to UIMessagePart Returns (found, part) where found indicates if the prefix was matched, and part is the converted UIMessagePart (can be nil if parsing failed)

func ExtractImageUrl

func ExtractImageUrl(data []byte, url, mimeType string) (string, error)

ExtractImageUrl extracts an image URL from either URL field (http/https/data) or raw Data

func ExtractTextData

func ExtractTextData(data []byte, url string) ([]byte, error)

ExtractTextData extracts text data from either Data field or URL field (data: URLs only)

func ExtractXmlAttribute

func ExtractXmlAttribute(tag, attrName string) (string, bool)

ExtractXmlAttribute extracts an attribute value from an XML-like tag. Expects double-quoted strings where internal quotes are encoded as ". Returns the unquoted value and true if found, or empty string and false if not found or invalid.

func FormatAttachedDirectoryListing

func FormatAttachedDirectoryListing(directoryName, jsonContent string) string

FormatAttachedDirectoryListing formats a directory listing attachment with proper encoding and deterministic suffix

func FormatAttachedTextFile

func FormatAttachedTextFile(fileName string, textContent []byte) string

FormatAttachedTextFile formats a text file attachment with proper encoding and deterministic suffix

func GenerateDeterministicSuffix

func GenerateDeterministicSuffix(inputs ...string) string

GenerateDeterministicSuffix creates an 8-character hash from input strings

func JsonEncodeRequestBody

func JsonEncodeRequestBody(reqBody any) (bytes.Buffer, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL