Hello, Looking for some hints or guidance on the following error when executing a simple query (see code below). This error only appears if I query by id. Thanks!
pinecone.core.client.exceptions.PineconeApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({‘content-type’: ‘text/plain’, ‘content-length’: ‘50’, ‘date’: ‘Tue, 16 Apr 2024 02:43:13 GMT’, ‘server’: ‘envoy’, ‘connection’: ‘close’})
HTTP response body: : Proto field is not repeating, cannot start list.
Here is my sample Python code:
#!/usr/bin/env python3
import os
from config import set_environment
from pinecone import Pinecone, PodSpec
from langchain_community.embeddings import HuggingFaceInferenceAPIEmbeddings
set_environment()
model_name = "BAAI/bge-m3"
index_name = "coachai-poc-" + model_name[model_name.find("/")+1:].lower()
pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
spec = PodSpec(
environment='us-east-1-aws',
pod_type='p1.x1'
)
embeddings = HuggingFaceInferenceAPIEmbeddings(
api_key=os.environ["HUGGINGFACEHUB_API_TOKEN"], model_name=model_name
)
index = pc.Index(index_name)
# Create index if it doesn't already exist
if index_name not in pc.list_indexes().names():
pc.create_index(
name=index_name,
dimension=len(embeddings.embed_documents(["hello world"][0])),
metric="dotproduct",
spec=spec
)
# Upsert a simple vector
values = embeddings.embed_documents(["hello world"])
vectors = [{
"id": "doc1#abc",
"values": values[0]
}]
index.upsert(vectors=vectors)
# Query based on id
index.query(
id=['doc2#abc'],
top_k=1
)