probots-io / pinecone-php

A beautiful, extendable PHP Package to communicate with your pinecone.io indices, collections and vectors.
https://probots.io
MIT License
50 stars 16 forks source link

Incorrect Query Parameter Formatting for Multiple IDs in Vector Fetching URL #3

Closed HelgeSverre closed 1 year ago

HelgeSverre commented 1 year ago

The current implementation of the pinecone-php package constructs the URL for fetching vectors in a format that is not compatible with the Pinecone API. The package generates a URL like this:

HOSTNAME/vectors/fetch?ids=vector-id-1,vector-id-2

However, the Pinecone API expects the URL to have multiple "ids" parameters, like this:

HOSTNAME/vectors/fetch?ids=vector-id-1&ids=vector-id-2

Note the ids=1&ids=2 , this is apparently valid and expected, news to me, not much we can do about it...

HelgeSverre commented 1 year ago

Workaround is to use to build the query:

GuzzleHttp\Psr7\Query::build(["ids" => $ids])
derpoho commented 1 year ago

confirmed @HelgeSverre , will fix.

derpoho commented 1 year ago

Closed with a dirty & ugly workaround by adding a guzzle middleware to the connector. Maybe @Sammyjo20 from Saloon has a better idea.

Sammyjo20 commented 1 year ago

Ah this is a really difficult one! - I'll reply in the issue that you posted on Saloon @derpoho