langchain-ai / opengpts

MIT License
6.42k stars 845 forks source link

Retriever returning an empty list "[]" #89

Open TuTeVs opened 9 months ago

TuTeVs commented 9 months ago

Hello guys! My retriever is not fetching anything for my agent. Would really appreciate it if any of you have an idea on how to overcome this issue.

This image shows the Retriever output (an empty list). image

This is my backend server, signalling everything is running OK: image

Please let me know if any more information is required, thank you!

donatienthorez commented 9 months ago

It would help to debug if you check the redis database content (and/or post it here)

You can do that by running redis-cli and then KEYS *

Then you can get the type of a KEY: TYPE

and then you can use the correct function: For string, use GET: GET your_key For list, use LRANGE: LRANGE your_key 0 -1 For set, use SMEMBERS: SMEMBERS your_key For zset (sorted set), use ZRANGE: ZRANGE your_key 0 -1 WITHSCORES For hash, use HGETALL: HGETALL your_key

Hope this helps

TuTeVs commented 9 months ago

Hello Mr Thorez! Thanks for your response!

I am using RedisInsight to maneuver my database: image Here I selected the output key of the OpenGPT bot response.

From what I can gauge, I guess the issue is in the ingestion or the retrieval process itself? I don't seem to see any key resembling the 5 files that I uploaded to the Index. So maybe, that leaves out the ingestion itself being the issue..?

Since this is the first time I use Redis, maybe the issue lies in the way I configured the database. This is the code I used to create my index there (created with the assistance of ChatGPT):

FT.CREATE "opengpts" // Index name
    ON HASH // Indicates the type of data to index
        PREFIX 1 "opengpts:" // The prefix pattern to index
    SCHEMA
        "namespace" TAG SORTABLE // Assuming 'namespace' is a tag field that should be sortable
        "content_vector" VECTOR FLAT // For "content vector" create a Flat index.
            10 // 10 index parameters follow
            "TYPE" "FLOAT32" // only FLOAT32 is currently supported
            "DIM" 1536 // Each vector will have 1536 dimensions
            "DISTANCE_METRIC" "COSINE" // Other values could be "IP" "L2"
            "INITIAL_CAP" 5 // Pre-Allocate memory for vectors per shard
            "BLOCK_SIZE" 5 // Block size for the index

And I created a flat vector index.

Furthermore, here is the langsmith sequence from this particular response: image

Please let me know if there is anything more information I can share to debug/solve this issue.

Thank you kindly! Teodor