aiutil

package
v0.12.4-beta.2 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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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