utils

package
v0.83.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneParams added in v0.28.0

func CloneParams(params map[string]interface{}) map[string]interface{}

CloneParams creates a deep copy of a parameter map.

func ConvertLegacyOutputsToTyped added in v0.52.0

func ConvertLegacyOutputsToTyped[T any](outputs map[string]any) (T, error)

ConvertLegacyOutputsToTyped converts map[string]any to a typed struct.

func ConvertTypedInputsToLegacy added in v0.52.0

func ConvertTypedInputsToLegacy(inputs any) (map[string]any, error)

ConvertTypedInputsToLegacy converts a typed struct to map[string]any.

func DedupeStrings added in v0.80.0

func DedupeStrings(items []string, limit int) []string

DedupeStrings trims, de-duplicates, and preserves first-seen order. If limit is positive, the returned slice is capped at that many items.

func Max added in v0.28.0

func Max(a, b int) int

Max returns the maximum of two integers.

func ParseJSONResponse

func ParseJSONResponse(response string) (map[string]interface{}, error)

ParseJSONResponse attempts to parse a string response as JSON. It handles common LLM response formats including: - Raw JSON. - JSON wrapped in markdown code blocks (```json ... ```).

func PopulateStructFromMap added in v0.52.0

func PopulateStructFromMap(structValue reflect.Value, structType reflect.Type, data map[string]any) error

PopulateStructFromMap fills a struct with values from a map.

func SetFieldValue added in v0.52.0

func SetFieldValue(fieldValue reflect.Value, value any) error

SetFieldValue sets a struct field value with type conversion.

func TruncateString added in v0.75.2

func TruncateString(s string, maxLen int) string

TruncateString truncates a string to maxLen characters and appends "..." if truncated.

Types

This section is empty.

Jump to

Keyboard shortcuts

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