I am having trouble accessing Pinecone via PHP. I tried to follow the examples from the documentation, but it does not seem to work.
<?php
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
require 'vendor/autoload.php';
require 'config.php';
require 'embeddings.php';
use \Probots\Pinecone\Client as Pinecone;
$pineconeApiKey = PINECONE_API_KEY;
$pineconeIndex = 'my-index';
// Initialize clients
$pinecone = new Pinecone($pineconeApiKey);
$respons = $pinecone->index()->list();
if($response->successful()) {
var_dump($response);
}
I am getting:
_Fatal error: Uncaught ArgumentCountError: Too few arguments to function Probots\Pinecone\Client::_construct(), 1 passed in /home/.../pinecone.php on line 16 and exactly 2 expected in /home/.../probots-io/pinecone-php/src/Client.php:24
Then, I tried to pass the environment, because I saw that in the code: new Pinecone($key, "my-index"); and I had to change to remove control() from the call ($response = $pinecone->control()->index()->list()).
And now I am getting:
Fatal error: Uncaught GuzzleHttp\Exception\ConnectException: cURL error 6: Could not resolve host: controller.my-index.pinecone.io (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://controller.my-index.pinecone.io/databases
How can I adjust the code so that it will work?
1.0.0release, so I'm guessing the documentation doesn't reflect that yet.$indexHost- is that what you are referring to, when you say "environment"? What actual value did you use formy-index(I don't assume this was meant literal)? cURL apparently can't resolve the host name, so I'm guessing that yourmy-indexis either wrong, or needs to be registered with Pinecone first or something ...?controller.my-index.pinecone.ioeither. Are you sure this is a programming-related problem? Did you try to run this with cURL on the command line with any other result?