utils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneParams

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

CloneParams creates a deep copy of a parameter map.

func ConvertLegacyOutputsToTyped

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

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

func ConvertTypedInputsToLegacy

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

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

func Max

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

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

PopulateStructFromMap fills a struct with values from a map.

func SetFieldValue

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

SetFieldValue sets a struct field value with type conversion.

Types

This section is empty.

Jump to

Keyboard shortcuts

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