pub struct PineconeClientConfig {
pub api_key: Option<String>,
pub control_plane_host: Option<String>,
pub additional_headers: Option<HashMap<String, String>>,
pub source_tag: Option<String>,
}
Expand description
The PineconeClientConfig
struct takes in the parameters to configure the Pinecone client.
Fields§
§api_key: Option<String>
Pinecone API key
control_plane_host: Option<String>
The Pinecone controller host
additional_headers: Option<HashMap<String, String>>
Additional headers to be included in all requests
source_tag: Option<String>
The source tag
Implementations§
Source§impl PineconeClientConfig
impl PineconeClientConfig
Sourcepub fn client(self) -> Result<PineconeClient, PineconeError>
pub fn client(self) -> Result<PineconeClient, PineconeError>
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 using the provided configuration.
§Arguments
api_key: Option<&str>
- The API key used for authentication.control_plane_host: Option<&str>
- The Pinecone controller host. Default ishttps://api.pinecone.io
.additional_headers: Option<HashMap<String, String>>
- Additional headers to be included in all requests. Expects a HashMap. If no api version header is provided, it will be added.source_tag: Option<&str>
- A tag to identify the source of the request.
§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 ishttps://api.pinecone.io
.PINECONE_ADDITIONAL_HEADERS
: Additional headers to be included in all requests. Expects JSON.
§Example
use pinecone_sdk::pinecone::{PineconeClient, PineconeClientConfig};
// Create a Pinecone client with the API key and controller host.
let config = PineconeClientConfig {
api_key: Some("INSERT_API_KEY".to_string()),
control_plane_host: Some("INSERT_CONTROLLER_HOST".to_string()),
..Default::default()
};
let pinecone: PineconeClient = config.client().expect("Failed to create Pinecone instance");
Trait Implementations§
Source§impl Default for PineconeClientConfig
impl Default for PineconeClientConfig
Source§fn default() -> PineconeClientConfig
fn default() -> PineconeClientConfig
Returns the “default value” for a type. Read more
Source§impl TryFrom<PineconeClientConfig> for PineconeClient
impl TryFrom<PineconeClientConfig> for PineconeClient
Source§type Error = PineconeError
type Error = PineconeError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for PineconeClientConfig
impl RefUnwindSafe for PineconeClientConfig
impl Send for PineconeClientConfig
impl Sync for PineconeClientConfig
impl Unpin for PineconeClientConfig
impl UnwindSafe for PineconeClientConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request