当我使用PineconeClient for nodejs将向量upsert到PineCone时出错
代码是
const index = pinecone.Index("imagesindex");
const upsertRequest = {
vectors: [
{
id: "vec1",
values: [0.1, 0.2, 0.3, 0.4],
metadata: {
genre: "drama",
},
},
{
id: "vec2",
values: [0.2, 0.3, 0.4, 0.5],
metadata: {
genre: "action",
},
},
],
namespace: "example-namespace",
};
try {
const upsertResponse = await index.upsert(upsertRequest);
} catch (error) {
console.log(error);
}
index.upsert return“RequiredError:调用upsert时,所需参数requestParameters.upsertRequest为null或未定义”
什么是正确的index.upsert?
1条答案
按热度按时间wpx232ag1#
从PineconeClient的GitHub repo中得到:
我认为你应该试试这个:
您传入的参数的字段
upsertRequest
为空。当您应该将upsertRequest作为requestParameters.upsertRequest
传递时,您将其作为requestParameters
传递