Strings converted into datetime object

Upon executing an upsert operation on the vector provided below, I noticed that the document_id was automatically converted into a datetime.date object.

Here is the vector:
vector = {
“text”: “Some random text”,
“metadata”: {
“name”: “text_1”,
“document_id”: “16790821”,
“ref_id”: “ref_1”,
“id”: “21256”
}
}
After querying the vector, this is what was returned:
{
‘matches’: [{
‘id’: ‘21256’,
‘metadata’: {
‘document_id’: datetime.date(1679, 8, 21),
‘id’: ‘21256’,
‘name’: ‘text_1’,
‘ref_id’: ‘ref_1’,
‘text’: ‘Some random text’
},
‘score’: 1.0,
‘values’:
}],
‘namespace’: ‘’
}

Is this an unintended bug, or is it predictable behavior? I couldn’t find any relevant information about this within the official Pinecone documentation. Furthermore, is there a method to prevent numerical strings of a certain length from being converted into datetime.date objects?

1 Like

This is because the OpenAPI generated code we use for our REST client does this conversion as the spec does not clearly define all accepted OpenAPI types. While we fix this, If you use GRPCIndex, it will be fine there. More information can be found on Github this issue.

1 Like

Indeed, GRPCIndex works as expected. However, I encountered an issue while using the pinecone.GRPCIndex with the base pip3 installation of pinecone. To resolve this, I had install a couple of additional libraries and downgrade a particular one. I would strongly recommend that this anomaly be documented officially as it is a non-trivial issue and has the potential to create problems for users who might not be aware of this.

1 Like