Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Bugfix]: pinecone response to construct DocumentChunkWithScore #395

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

rufimelo99
Copy link
Contributor

@rufimelo99 rufimelo99 commented Dec 1, 2023

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': []},

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': []},
```
@rufimelo99 rufimelo99 changed the title chore: fixed pinecone response to construct DocumentChunkWithScore [Bugfix]: pinecone response to construct DocumentChunkWithScore Dec 1, 2023
Copy link
Collaborator

@isafulf isafulf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@isafulf isafulf merged commit b02139d into openai:main Dec 4, 2023
adgrajales1 added a commit to adgrajales1/chatgpt-retrieval-plugin that referenced this pull request Jan 22, 2024
adgrajales1 pushed a commit to adgrajales1/chatgpt-retrieval-plugin that referenced this pull request Jan 22, 2024
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': []},
```
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants