storage icon indicating copy to clipboard operation
storage copied to clipboard

🚀 [Feature]: Support for Qdrant

Open gaby opened this issue 9 months ago • 6 comments

Feature Description

Support for Qdrant Vector Database / Cloud via their golang SDK:

https://github.com/qdrant/go-client

Additional Context (optional)

No response

Code Snippet (optional)

package main

import "github.com/gofiber/storage/%package%"

func main() {
  // Steps to reproduce
}

Checklist:

  • [x] I agree to follow Fiber's Code of Conduct.
  • [x] I have checked for existing issues that describe my suggestion prior to opening this one.
  • [x] I understand that improperly formatted feature requests may be closed without explanation.

gaby avatar Apr 11 '25 04:04 gaby

Hey @gaby. Since Qdrant is vector search engine/DB and not a key-value store, how do you see this being used?

Anush008 avatar Apr 11 '25 07:04 Anush008

@Anush008 They have a key/value backend but seems not available in the Go SDK.

gaby avatar Apr 11 '25 14:04 gaby

The Go client has it too. https://qdrant.tech/documentation/concepts/payload/#create-point-with-payload

Its arbitrary JSON associated with each vector.

Qdrant is primarily used for vector searches and not as a key-value store. So a key-value storage driver for it won't be much useful.

Anush008 avatar Apr 11 '25 14:04 Anush008

@Anush008 How about something like this:

	// Example operations using a sample key and value.
	key := "mykey"
	value := "myvalue"
	dummyVector := []float32{0.0} // Dummy vector to satisfy Qdrant's requirements.

	// ---- SET operation: Upsert a point with key "mykey" and the given value.
	point := qdrant.Point{
		Id:     key,
		Vector: dummyVector,
		Payload: map[string]interface{}{
			"value": value, // Store your actual value here.
		},
	}
	upsertResp, err := client.UpsertPoints(ctx, collectionName, []qdrant.Point{point})
	if err != nil {
		log.Fatalf("Error upserting point: %v", err)
	}
	fmt.Println("Upsert response:", upsertResp)

	// ---- GET operation: Retrieve the point and extract the value.
	getResp, err := client.GetPoint(ctx, collectionName, key)
	if err != nil {
		log.Fatalf("Error getting point: %v", err)
	}
	if payload, ok := getResp.Payload.(map[string]interface{}); ok {
		retrievedValue := payload["value"]
		fmt.Println("Retrieved value:", retrievedValue)
	} else {
		fmt.Println("No payload found for the given key")
	}

	// ---- DELETE operation: Delete the point by its key.
	deleteResp, err := client.DeletePoints(ctx, collectionName, []string{key})
	if err != nil {
		log.Fatalf("Error deleting point: %v", err)
	}
	fmt.Println("Delete response:", deleteResp)

gaby avatar Apr 15 '25 01:04 gaby

Sure. That would work. But I believe it's an an overkill since there are other dedicated key value stores available.

Anush008 avatar Apr 15 '25 04:04 Anush008

@Anush008 The point of the drivers is to use them as Key/Val and also database clients. That's why they have the Conn() method.

Although idk if its even performant to do the PoC above, but Qdrant is heavily used in the AI/LLM space.

gaby avatar Apr 15 '25 11:04 gaby