StackExchange / NRediSearch

Other
31 stars 9 forks source link

[Question] Vectorstore #32

Open giuliohome opened 1 year ago

giuliohome commented 1 year ago

Follow up from https://github.com/StackExchange/StackExchange.Redis/issues/2470

Is there a way to create a vector space here?

My goal:

127.0.0.1:6379> FT.CREATE openai-langchain-redis-aks SCHEMA content_vector VECTOR FLAT 6 TYPE FLOAT32 DIM 1536 DISTANCE_METRIC COSINE metadata TEXT content TEXT
OK

This is what I have tried to do

    let schema = 
        Schema()
            .AddTextField("metadata") 
            .AddTextField("content") 
            .AddNumericField("content_vector")
    client.CreateIndex(schema, Client.ConfiguredIndexOptions()) |> check |> printfn "create index %s"
shacharPash commented 1 year ago

@giuliohome, I recommend you to use NRedisStack. There is an option to use vectors in a more convenient and structured way.

Here is a link to an example of using vectors: https://github.com/redis/NRedisStack/blob/master/Examples/AdvancedQueryOperations.md#vss

If you have any further questions about using NRedisStack, feel free to contact me

giuliohome commented 1 year ago

Thank you very much, starred, will try that asap, no later than tomorrow.