milvus-io / milvus-sdk-go

Go SDK for Milvus.
Apache License 2.0
351 stars 110 forks source link

[Feature]:Does search vector support float64? #799

Open JiehangXie opened 3 months ago

JiehangXie commented 3 months ago

Is there an existing issue for this?

Is your feature request related to a problem? Please describe.

I use ZhipuAI embedding for my apps. The embedding model returns a list of float64 vector and I store in Milvus with float64 type. But my app use Go SDK for search vectors, and it is only support float32. This makes me to convert float64 data to float32, and it leads to loss of accuracy seriously. So how can I use float64 data to search?

Describe the solution you'd like.

// search
v1 := make([]float32, 0, 768)
v2 := make([]float32, 0, 768)
for j := 0; j < 768; j++ {
   v1 = append(v1, rand.Float32())
   v2 = append(v2, rand.Float32())
}
sp, errSp := entity.NewIndexHNSWSearchParam(74)
if errSp != nil {
   log.Fatal("failed to new hnsw search params:", errSp.Error())
}
searchRes, errSearch := mc.Search(
   context.Background(),
   collectionName,
   []string{},
   "",
   []string{},
   []entity.Vector{entity.FloatVector(v1), entity.FloatVector(v2)},
   "vector",
   entity.COSINE,
   10,
   sp,
   client.WithSearchQueryConsistencyLevel(entity.ClBounded),
   )

Describe an alternate solution.

No

Anything else? (Additional Context)

No