-1

I am beginning to learn Vector databases, i am using Pinecone to make the databases, but in this code:

public static async Task SaveToDatabase(List<float> vector)
{
    string ApiKey = "pcsk_Fuhui_3Ct3UH3hQCTV3gLJKweFSMjRuKpzmM47x4djc8xwQuRVjw8DzxpJBdCLbyAqpbx";
    using var pinecone = new PineconeClient(ApiKey);
    var indexes = await pinecone.ListIndexes();
    foreach (IndexDetails i in indexes) { Console.WriteLine(i.Name); }
    Pinecone.Index<RestTransport> index = await pinecone.GetIndex("pinecone
    pdfai");
    var vectors = new[]
    {
        new Vector
        {
            Id = "vector1",
            Values = vector.ToArray(),
            Metadata = new MetadataMap
            {
                ["genre"] = "horror",
                ["duration"] = 120
            }
        }
    };
    await index.Upsert(vectors);

}

But i just get this error when i run it: System.Text.Json.JsonException: 'JSON deserialization for type 'Pinecone.Rest.UpsertResponse' was missing required properties including: 'upsertedCount'.'

I have tried looking for the 'upsertedCount' but can't find it in any documentation, and i cant figure out why the error is even happening.

Please comment if you need any more info :)

1 Answer 1

0

Because you're using await, you should be calling ListIndexesAsync instead of ListIndexes.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.