util.go
1package ai
2
3import (
4 "github.com/go-viper/mapstructure/v2"
5)
6
7func ParseOptions[T any](options map[string]any, m *T) error {
8 return mapstructure.Decode(options, m)
9}
10
11func FloatOption(f float64) *float64 {
12 return &f
13}
14
15func BoolOption(b bool) *bool {
16 return &b
17}
18
19func StringOption(s string) *string {
20 return &s
21}
22
23func IntOption(i int64) *int64 {
24 return &i
25}