Issues with using API with C#

I am trying to use the API to create and query vectors. I have succeeded in creating embeddings and saving those to pinecone.
Now I am trying to query these vector embeddings but keep on getting the following error message: “{“code”:3,“message”:“No query provided”,“details”:}”
I have followed the PineCone docs but to no avail.

I am using C# and have tried building the JSON both like this

         var jsonObj = new
            {
                query = new[]
                {
                    new{
                        values = vector,
                        topK = 3.ToString(),
                        }
                },
                includeValues = false.ToString(),
                includeMetadata = true.ToString()
            };

and like this (format as described in the docs)

        var jsonObj = new
        {
            includeValues = false.ToString(),
            includeMetadata = true.ToString(),
            values = vector,
            topK = 3.ToString()
        };

Any ideas ?

Hi!

I am using the API in c# without problem, but have a bit different jsonobject.

Try changing

values = vector,

to

vector = vector,

(as per documentation on Query)

Hope this helps

Hi Jasper
Thanks for your input and spotting my mistake. Now it works :grinning:

1 Like