1package ai
2
3import "github.com/go-viper/mapstructure/v2"
4
5func FloatOption(f float64) *float64 {
6 return &f
7}
8
9func BoolOption(b bool) *bool {
10 return &b
11}
12
13func StringOption(s string) *string {
14 return &s
15}
16
17func IntOption(i int64) *int64 {
18 return &i
19}
20
21func ParseOptions[T any](options map[string]any, m *T) error {
22 decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
23 TagName: "json",
24 Result: m,
25 })
26 if err != nil {
27 return err
28 }
29 return decoder.Decode(options)
30}