chatgpt-retrieval-plugin icon indicating copy to clipboard operation
chatgpt-retrieval-plugin copied to clipboard

Calling /upsert-file should be setting source as type 'file'

Open p2c2e opened this issue 2 years ago • 3 comments

I believe /upsert-file should be setting the source to 'file' type. Currently it is left as null and hence results in an error during query as follows:

Error: 1 validation error for DocumentChunkWithScore metadata -> source value is not a valid enumeration member; permitted: 'email', 'file', 'chat' (type=type_error.enum; enum_values=[<Source.email: 'email'>, <Source.file: 'file'>, <Source.chat: 'chat'>])

Backend datastore is redis-stack-server

p2c2e avatar Mar 24 '23 16:03 p2c2e

You will also need to use a Filter and specify the source to search when querying with Redis else the same error occurs.

{
  "queries": [
    {
      "query": "string,
      "filter": {
        "source": "file"
      },
      "top_k": 3
    }
  ]
}

CyberAmyntas avatar Mar 25 '23 00:03 CyberAmyntas

I think https://github.com/openai/chatgpt-retrieval-plugin/issues/37#issuecomment-1483635163 is better solution. While I tested using qdrant sample document (examples/docker/qdrant/documents.json), they don't have source field and server occurs the same error.

jonghoonseo avatar Mar 25 '23 18:03 jonghoonseo

I think #37 (comment) is better solution. While I tested using qdrant sample document (examples/docker/qdrant/documents.json), they don't have source field and server occurs the same error.

Hi - The solution you are referring to is a workaround that needs to be done at each datastore implementation level. This one addresses this at the root cause - since this will happen for all datastore types.

p2c2e avatar Mar 26 '23 03:03 p2c2e

This worked for me.

jasonhuhx avatar Mar 26 '23 18:03 jasonhuhx

I reported same issue, and it worked for me.

SML0127 avatar Mar 27 '23 10:03 SML0127

Thank you all! Resolved here: https://github.com/openai/chatgpt-retrieval-plugin/commit/e07ffedb3f0365c3839b3681cc3781174634f471

isafulf avatar Mar 27 '23 15:03 isafulf