MCPcopy
hub / github.com/cortexlabs/cortex / inferPromptFieldName

Function inferPromptFieldName

pkg/lib/configreader/reader.go:1224–1231  ·  view source on GitHub ↗
(structType reflect.Type, typeStructField string)

Source from the content-addressed store, hash-verified

1222}
1223
1224func inferPromptFieldName(structType reflect.Type, typeStructField string) string {
1225 field, _ := structType.Elem().FieldByName(typeStructField)
1226 tag, ok := getTagFieldName(field)
1227 if ok {
1228 return tag
1229 }
1230 return typeStructField
1231}
1232
1233func getTagFieldName(field reflect.StructField) (string, bool) {
1234 tag, ok := field.Tag.Lookup("json")

Callers 1

ReadPromptFunction · 0.85

Calls 1

getTagFieldNameFunction · 0.85

Tested by

no test coverage detected