Coder Social home page Coder Social logo

Comments (4)

Voveka98 avatar Voveka98 commented on June 1, 2024 1

Ok, thanks a lot!

from redisearch.

meiravgri avatar meiravgri commented on June 1, 2024

Hi @Voveka98
When passing a binary blob to the CLI, enclosing it in quotes is essential. Otherwise, each character is interpreted as one byte. You can find more information about this in the Redis documentation.

The binary blob "\x01\x01\x01\x01" you provided is only 4 bytes long, but a 16-byte blob is expected (dim * sizeof(float)).
Ensure that you're passing the correct blob size for your data.

In addition to that, we don't apply sqrt on the distance value. Therefore, the expected distance is

(sum((x_i - y_i)**2))

Good luck :)

from redisearch.

Voveka98 avatar Voveka98 commented on June 1, 2024

Hi @meiravgri!
Thanks for explanation, maybe update documentation (https://redis.io/docs/interact/search-and-query/advanced-concepts/vectors/)?
image

And another question:
I am trying to find most similar vector in type float32 dim 512.
I do next:

func embeddingToBytes(embedding []float32) []byte {
    bytes := make([]byte, 0, len(embedding)*4)

    for _, val := range embedding {
        bits := math.Float32bits(val)
        buf := make([]byte, 4)
        binary.LittleEndian.PutUint32(buf, bits)
        bytes = append(bytes, buf...)
    }

    return bytes
}

Is it right way to do this?
Thanks in advance!

from redisearch.

meiravgri avatar meiravgri commented on June 1, 2024

Regarding documentation, we acknowledge that while it might be a bit confusing, the decision to skip sqrt operation is made to save computation time during the query process.

For the second question, I'm not personally familiar with Go. it's worth noting that the Go client doesn't directly support Redisearch integration. If you're looking for an alternative method, you might consider referring to the Python client documentation, where they provide an example of converting vectors into binary blobs using the tobytes() function.

Additionally, you can explore the RedisVL repository, which offers an easy start Python client dedicated to using Redis as a vector database.

from redisearch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.