Function default_client

Source
pub fn default_client() -> Result<PineconeClient, PineconeError>
Expand description

The PineconeClient struct is the main entry point for interacting with Pinecone via this Rust SDK. It is used to create, delete, and manage your indexes and collections. This function constructs a PineconeClient struct by attempting to read in environment variables for the required parameters.

§Return

  • Result<PineconeClient, PineconeError>

§Configuration with environment variables

If arguments are not provided, the SDK will attempt to read the following environment variables:

  • PINECONE_API_KEY: The API key used for authentication. If not passed as an argument, it will be read from the environment variable.
  • PINECONE_CONTROLLER_HOST: The Pinecone controller host. Default is https://api.pinecone.io.
  • PINECONE_ADDITIONAL_HEADERS: Additional headers to be included in all requests. Expects JSON.

§Example

use pinecone_sdk::pinecone::PineconeClient;

// Create a Pinecone client with the API key and controller host read from environment variables.
let pinecone: PineconeClient = pinecone_sdk::pinecone::default_client().expect("Failed to create Pinecone instance");