pinecone-rs

Crates.iopinecone-rs
lib.rspinecone-rs
version0.1.5
sourcesrc
created_at2024-01-24 22:23:11.296574
updated_at2024-01-24 23:29:31.874448
descriptionPinecone Client for Rust
homepagehttps://github.com/adri1wald/pinecone-rs
repositoryhttps://github.com/adri1wald/pinecone-rs
max_upload_size
id1113027
size62,652
Adrien Wald (adri1wald)

documentation

https://docs.rs/pinecone-rs

README

This crate allows you to connect and interact with Pinecone, the vector database. After authenticating you're api key and you're environment key, this crate facilitates the connection to a pinecone index. Once a connection has been validated this API allows you to upsert, query, and update data within Pinecone as well more unmentioned commands. More details about the different api methods can be found here

This crate currently only supports the http / rest pinecone api and does not support GRCP. GRCP will be implemented into the future as opt in. Http is currently the default

To connect, initalize a [Client] using the [Client::new] method. This is an asynchronous operation that will also validate you're credentials and will error if invalid credentials are given. You can then run operations on you're client / account using the methods on [Client] or create a new [Index] via the [Client::index] method. This index will not be validated intially, it can be validated by calling the [Index::describe] method which will attempt to get information about the index and subsequently validate the credentials if it goes through successfully.

Below is a basic client and index example.

async fn index_upsert() {

    // We create an instance of client first and firstmost. Panics if it couldn't authenticate.
    let client = Client::new(env!("PINECONE_API_KEY"), env!("PINECONE_ENV")).await.unwrap();
    // creates an index, will not authenticate.
    let mut index = client.index(env!("PINECONE_INDEX_NAME"));

    // We use describe as a form of authenticate, panicing if we couldn't authenticate.
    let _ = index.describe().await.unwrap();
    let vec = Vector{
        id: "B".to_string(),
        values: vec![0.5; 32],
        sparse_values: None,
        metadata: None
    };

    match index.upsert(String::from("odle"), vec![vec]).await {
        Ok(_) => assert!(true),
        Err(err) => panic!("unable to upsert: {:?}", err)
    }
}
Commit count: 0

cargo fmt