MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / UnmarshalVectorResp

Function UnmarshalVectorResp

dgraphapi/vector.go:78–95  ·  view source on GitHub ↗
(resp *api.Response)

Source from the content-addressed store, hash-verified

76}
77
78func UnmarshalVectorResp(resp *api.Response) ([][]float32, error) {
79 type Data struct {
80 Vector []struct {
81 UID string `json:"uid"`
82 ProjectDescriptionV []float32 `json:"project_description_v"`
83 } `json:"vector"`
84 }
85 var data Data
86 if err := json.Unmarshal(resp.Json, &data); err != nil {
87 return nil, err
88 }
89
90 var vectors [][]float32
91 for _, item := range data.Vector {
92 vectors = append(vectors, item.ProjectDescriptionV)
93 }
94 return vectors, nil
95}

Calls

no outgoing calls

Tested by

no test coverage detected