aiutil

package
v0.13.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckModelPrefix

func CheckModelPrefix(model string, prefix string) bool

func CheckModelSubPrefix

func CheckModelSubPrefix(model string, prefix string) bool

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 CreateToolUseData

func CreateToolUseData(toolCallID, toolName string, arguments string, chatOpts uctypes.WaveChatOpts) uctypes.UIMessageDataToolUse

CreateToolUseData creates a UIMessageDataToolUse from tool call information

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 GeminiSupportsImageToolResults

func GeminiSupportsImageToolResults(model string) bool

GeminiSupportsImageToolResults returns true if the model supports multimodal function responses (images in tool results) This is only supported by Gemini 3 Pro and later models

func GenerateDeterministicSuffix

func GenerateDeterministicSuffix(inputs ...string) string

GenerateDeterministicSuffix creates an 8-character hash from input strings

func IsOpenAIReasoningModel

func IsOpenAIReasoningModel(model string) bool

func JsonEncodeRequestBody

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

func SendToolProgress

func SendToolProgress(toolCallID, toolName string, jsonData []byte, chatOpts uctypes.WaveChatOpts, sseHandler *sse.SSEHandlerCh, usePartialParse bool)

SendToolProgress sends tool progress updates via SSE if the tool has a progress descriptor

Types

This section is empty.

Jump to

Keyboard shortcuts

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