openai / chatgpt-retrieval-plugin

The ChatGPT Retrieval Plugin lets you easily find personal or work documents by asking questions in natural language.
MIT License
21.02k stars 3.69k forks source link

[Bugfix]: pinecone response to construct DocumentChunkWithScore #395

Closed rufimelo99 closed 9 months ago

rufimelo99 commented 10 months ago

When dealing with Pinecone occurs sporadically situations where metadata["text"] contains a datetime object somehow.

This raises an Internal Error since Pydantic is unable to create a DocumentChunkWithScore object.

We force the typing to str to fix this.

Example:

{'matches': [{'id': '68_1',
              'metadata': {'document_id': '68',
                           'text': datetime.date(2265, 12, 1)},
              'score': 0.760368824,
              'values': []},