fix: add involves edge from task to agent:nomos at creation
Plus sync vendor directory for Docker build compatibility.
This commit is contained in:
30
vendor/github.com/openai/openai-go/internal/paramutil/field.go
generated
vendored
Normal file
30
vendor/github.com/openai/openai-go/internal/paramutil/field.go
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
package paramutil
|
||||
|
||||
import (
|
||||
"github.com/openai/openai-go/packages/param"
|
||||
"github.com/openai/openai-go/packages/respjson"
|
||||
)
|
||||
|
||||
func AddrIfPresent[T comparable](v param.Opt[T]) *T {
|
||||
if v.Valid() {
|
||||
return &v.Value
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ToOpt[T comparable](v T, meta respjson.Field) param.Opt[T] {
|
||||
if meta.Valid() {
|
||||
return param.NewOpt(v)
|
||||
} else if meta.Raw() == respjson.Null {
|
||||
return param.Null[T]()
|
||||
}
|
||||
return param.Opt[T]{}
|
||||
}
|
||||
|
||||
// Checks if the value is not omitted and not null
|
||||
func Valid(v param.ParamStruct) bool {
|
||||
if ovr, ok := v.Overrides(); ok {
|
||||
return ovr != nil
|
||||
}
|
||||
return !param.IsNull(v) && !param.IsOmitted(v)
|
||||
}
|
||||
48
vendor/github.com/openai/openai-go/internal/paramutil/union.go
generated
vendored
Normal file
48
vendor/github.com/openai/openai-go/internal/paramutil/union.go
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
package paramutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/openai/openai-go/packages/param"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
var paramUnionType = reflect.TypeOf(param.APIUnion{})
|
||||
|
||||
// VariantFromUnion can be used to extract the present variant from a param union type.
|
||||
// A param union type is a struct with an embedded field of [APIUnion].
|
||||
func VariantFromUnion(u reflect.Value) (any, error) {
|
||||
if u.Kind() == reflect.Ptr {
|
||||
u = u.Elem()
|
||||
}
|
||||
|
||||
if u.Kind() != reflect.Struct {
|
||||
return nil, fmt.Errorf("param: cannot extract variant from non-struct union")
|
||||
}
|
||||
|
||||
isUnion := false
|
||||
nVariants := 0
|
||||
variantIdx := -1
|
||||
for i := 0; i < u.NumField(); i++ {
|
||||
if !u.Field(i).IsZero() {
|
||||
nVariants++
|
||||
variantIdx = i
|
||||
}
|
||||
if u.Field(i).Type() == paramUnionType {
|
||||
isUnion = u.Type().Field(i).Anonymous
|
||||
}
|
||||
}
|
||||
|
||||
if !isUnion {
|
||||
return nil, fmt.Errorf("param: cannot extract variant from non-union")
|
||||
}
|
||||
|
||||
if nVariants > 1 {
|
||||
return nil, fmt.Errorf("param: cannot extract variant from union with multiple variants")
|
||||
}
|
||||
|
||||
if nVariants == 0 {
|
||||
return nil, fmt.Errorf("param: cannot extract variant from union with no variants")
|
||||
}
|
||||
|
||||
return u.Field(variantIdx).Interface(), nil
|
||||
}
|
||||
Reference in New Issue
Block a user