Quantcast
Channel: Pinecone Community - Latest topics
Viewing all articles
Browse latest Browse all 736

Expecting an exact match when querying a vector. (QUERY)

$
0
0

I just upserted a vector, but when querying the same vector, it is not in the results. can someone explains what’s happening plz? code:

import pinecone
import os

# pinecone
PINECONE_API_KEY = os.environ.get("PINECONE_API_KEY", "redacted")
PINECONE_ENVIRONMENT = os.environ.get("PINECONE_ENVIRONMENT", "us-west4-gcp")
PINECONE_INDEX_NAME = os.environ.get("PINECONE_INDEX_NAME", "redacted")

pinecone.init(api_key=PINECONE_API_KEY, environment=PINECONE_ENVIRONMENT)
index = pinecone.Index(PINECONE_INDEX_NAME)

# upsert a vector with id "test" and [1, 1, ..., 1] as the vector and {"source": "test"} as the metadata
index.upsert(
    [
        (
            "test",
            [1] * 1536,
            {"source": "test"},
        ),
    ]
)

# {'upserted_count': 1}

when querying the same vector [1,1,…, 1], i expect to see it in matches with score near 1, but it’s not there.

index.query(vector=[1] * 1536, top_k=10, include_metadata=True, include_values=False)

results:

{'matches': [{'id': '52cbd3717847f20c38a49fc6b80797c5',
              'metadata': {'expiry_date': 1701648000.0},
              'score': -0.021078214,
              'values': []},
             {'id': '7329c30cd02d5b74723203255c3746e1',
              'metadata': {'expiry_date': 1702771200.0},
              'score': -0.021426104,
              'values': []},
...

2 posts - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 736

Trending Articles