{"id":19797854,"url":"https://github.com/pinecone-io/pinecone-rust-client","last_synced_at":"2026-03-05T20:03:19.821Z","repository":{"id":252140152,"uuid":"808251303","full_name":"pinecone-io/pinecone-rust-client","owner":"pinecone-io","description":"The official Rust client for the Pinecone vector database","archived":false,"fork":false,"pushed_at":"2025-07-02T01:36:46.000Z","size":421,"stargazers_count":13,"open_issues_count":8,"forks_count":2,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-07-02T02:27:30.463Z","etag":null,"topics":["llm","pinecone","semantic-search","similarity-search","vector-database"],"latest_commit_sha":null,"homepage":"https://www.pinecone.io/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pinecone-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-05-30T17:25:09.000Z","updated_at":"2025-06-28T13:28:50.000Z","dependencies_parsed_at":"2024-08-07T23:58:17.536Z","dependency_job_id":"06f5be97-a626-4c11-aae3-43754f333ca6","html_url":"https://github.com/pinecone-io/pinecone-rust-client","commit_stats":null,"previous_names":["pinecone-io/pinecone-rust-client"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/pinecone-io/pinecone-rust-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinecone-io%2Fpinecone-rust-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinecone-io%2Fpinecone-rust-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinecone-io%2Fpinecone-rust-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinecone-io%2Fpinecone-rust-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pinecone-io","download_url":"https://codeload.github.com/pinecone-io/pinecone-rust-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pinecone-io%2Fpinecone-rust-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267496057,"owners_count":24097098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["llm","pinecone","semantic-search","similarity-search","vector-database"],"created_at":"2024-11-12T07:27:06.697Z","updated_at":"2026-03-05T20:03:19.726Z","avatar_url":"https://github.com/pinecone-io.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pinecone Rust SDK\n\n\u003ca href=\"https://docs.rs/pinecone-sdk\"\u003e\u003cimg src=\"https://docs.rs/pinecone-sdk/badge.svg\"\u003e\u003c/a\u003e\n\n\u003e ⚠️ **Warning:** This SDK is still in an alpha state. While it is mostly built out and functional, it may undergo changes as we continue to improve the UX. Please try it out and give us your feedback, but be aware that updates may introduce breaking changes.\n\n## Documentation\n\nThe documentation can be found [here](https://docs.rs/pinecone-sdk/latest/pinecone_sdk/).\n\n## Prerequisites\n\nRust version: tested with Rust version 1.78.0\n\nBefore you can use the Pinecone SDK, you must sign up for an account and find your API key in the Pinecone console dashboard at [https://app.pinecone.io](https://app.pinecone.io).\n\n## Installation\n\nRun `cargo add pinecone-sdk` to add the crate as a dependency, or add the line `pinecone-sdk = \"0.1.2\"` to your Cargo.toml file under `[dependencies]`. More on the crate can be found [here](https://crates.io/crates/pinecone-sdk).\n\n## Usage\n\nThe `PineconeClient` class is the main point of entry into the Rust SDK. Parameters may either be directly passed in as `Options`, or read through environment variables as follows. More detail:\n\n- The API key must be passed in either as an argument or as an environment variable called `PINECONE_API_KEY`. If passed in as `None`, the client will attempt to read in an environment variable value.\n- The control plane host, if passed in as `None`, will attempt to read in an environment variable called `PINECONE_CONTROLLER_HOST`. If it is not an environment variable, it will default to `https://api.pinecone.io`.\n\nThere are a couple of ways to instantiate the client, detailed below:\n\n### PineconeClientConfig\n\nInitialize a `PineconeClientConfig` struct with parameters, and call `config` using the struct.\n\n```rust\nuse pinecone_sdk::pinecone::{PineconeClient, PineconeClientConfig};\n\nlet config = PineconeClientConfig {\n    api_key: Some(\"INSERT_API_KEY\".to_string()),\n    control_plane_host: Some(\"INSERT_CONTROLLER_HOST\".to_string()),\n    ..Default::default()\n};\n\nlet pinecone: PineconeClient = config.client().expect(\"Failed to create Pinecone instance\");\n```\n\n### Default client\n\nUse the `default_client()` function, which is the equivalent of constructing a `PineconeClientConfig` struct with all fields set to `None`. The API key and control plane host (optional) will be read from environment variables.\n\n```rust\nlet pinecone: PineconeClient = pinecone_sdk::pinecone::default_client().expect(\"Failed to create Pinecone instance\");\n```\n\n# Indexes\n\n## Create Index\n\n### Create serverless index\n\nThe following example creates a serverless index in the `us-east-1` region of AWS. For more information on serverless and regional availability, see [Understanding indexes](https://docs.pinecone.io/guides/indexes/understanding-indexes#serverless-indexes)\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::{Metric, Cloud, WaitPolicy, IndexModel};\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet index_description: IndexModel = pinecone.create_serverless_index(\n    \"index-name\",       // Name of the index\n    10,                 // Dimension of the vectors\n    Metric::Cosine,     // Distance metric\n    Cloud::Aws,         // Cloud provider\n    \"us-east-1\",        // Region\n    WaitPolicy::NoWait  // Timeout\n).await?;\n```\n\n### Create pod index\n\nThe following example creates a pod index in the `us-east-1` region of AWS.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::{Metric, Cloud, WaitPolicy, IndexModel};\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet index_description: IndexModel = pinecone.create_pod_index(\n    \"index-name\",       // Index name\n    10,                 // Dimension\n    Metric::Cosine,     // Distance metric\n    \"us-east-1\",        // Region\n    \"p1.x1\",            // Pod type\n    1,                  // Number of pods\n    None,               // Number of replicas\n    None,               // Number of shards\n    None,               // Metadata to index\n    None,               // Source collection\n    WaitPolicy::NoWait  // Wait policy\n).await?;\n```\n\nPod indexes support several optional configuration fields. The following example constructs a pod index with some specification for these fields.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::{Metric, Cloud, WaitPolicy, IndexModel};\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet index_description: IndexModel = pinecone.create_pod_index(\n    \"index-name\",       // Index name\n    10,                 // Dimension\n    Metric::Cosine,     // Distance metric\n    \"us-east-1\",        // Region\n    \"p1.x1\",            // Pod type\n    1,                  // Number of pods\n    Some(1),            // Number of replicas\n    Some(1),            // Number of shards\n    Some(               // Metadata fields to index\n        \u0026vec![\"genre\",\n            \"title\",\n            \"imdb_rating\"]),\n    Some(\"collection\"), // Source collection\n    WaitPolicy::NoWait  // Wait policy\n).await?;\n```\n\n## List indexes\n\nThe following example lists all indexes in your project.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::IndexList;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet index_list: IndexList = pinecone.list_indexes().await?;\n```\n\n## Describe index\n\nThe following example returns information about the index `index-name`.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::IndexModel;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet index_description: IndexModel = pinecone.describe_index(\"index-name\").await?;\n```\n\n## Configure index\n\nConfiguring an index takes in three optional parameters -- a DeletionProtection enum, the number of replicas, and the pod type. The deletion protection can be updated for any index type, while the number of replicas and the pod type can only be updated for pod indexes.\n\nThe following example disables deletion protection for the index `index-name`.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::IndexModel;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet index_description: IndexModel = pinecone.configure_index(\"index-name\", Some(DeletionProtection::Disabled), None, None).await?;\n```\n\nThe following example changes the index `index-name` to have 6 replicas and pod type `s1`. The deletion protection type will not be changed in this case.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::IndexModel;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet index_description: IndexModel = pinecone.configure_index(\"index-name\", None, Some(6), Some(\"s1\")).await?;\n```\n\n## Delete index\n\nThe following example deletes the index `index-name`.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\npinecone.delete_index(\"index-name\").await?;\n```\n\n## Describe index statistics\n\nThe following example returns statistics about the index with host `index-host`.\nWithout filter\n\n```rust\nuse std::collections::BTreeMap;\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::DescribeIndexStatsResponse;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet mut index = pinecone.index(\"index-host\").await?;\n\nlet response: DescribeIndexStatsResponse = index.describe_index_stats(None).await?;\n```\n\nWith filter\n\n```rust\nuse std::collections::BTreeMap;\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::{Value, Kind, Metadata, DescribeIndexStatsResponse};\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet mut index = pinecone.index(\"index-host\").await?;\n\nlet mut fields = BTreeMap::new();\nlet kind = Some(Kind::StringValue(\"value\".to_string()));\nfields.insert(\"field\".to_string(), Value { kind });\n\nlet response: DescribeIndexStatsResponse = index.describe_index_stats(Some(Metadata { fields })).await?;\n```\n\n## Upsert vectors\n\nThe following example upserts two vectors into the index with host `index-host`.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::{Vector, UpsertResponse};\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet mut index = pinecone.index(\"index-host\").await?;\n\nlet vectors = [Vector {\n    id: \"id1\".to_string(),\n    values: vec![1.0, 2.0, 3.0, 4.0],\n    sparse_values: None,\n    metadata: None,\n}, Vector {\n    id: \"id2\".to_string(),\n    values: vec![2.0, 3.0, 4.0, 5.0],\n    sparse_values: None,\n    metadata: None,\n}];\n\nlet response: UpsertResponse = index.upsert(\u0026vectors, \u0026\"namespace\".into()).await?;\n```\n\n## Query vectors\n\nThere are two supported ways of querying an index.\n\n### Query by index\n\nThe following example queries the index with host `index-host` for the vector with ID `vector-id`, and returns the top 10 matches.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::{Namespace, QueryResponse};\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\n// Connect to index at host \"index-host\"\nlet mut index = pinecone.index(\"index-host\").await?;\n\n// Query the vector with id \"vector-id\" in the namespace \"namespace\"\nlet response: QueryResponse = index.query_by_id(\n    \"vector-id\".to_string(),\n    10,\n    \u0026Namespace::default(),\n    None,\n    None,\n    None\n).await?;\n```\n\n### Query by value\n\nThe following example queries the index with host `index-host` for the vector with values `[1.0, 2.0, 3.0, 4.0]`, and returns the top 10 matches.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::{Namespace, QueryResponse};\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet mut index = pinecone.index(\"index-host\").await?;\n\nlet vector = vec![1.0, 2.0, 3.0, 4.0];\n\nlet response: QueryResponse = index.query_by_value(\n    vector,\n    None,\n    10,\n    \u0026Namespace::default(),\n    None,\n    None,\n    None\n).await?;\n```\n\n## Delete vectors\n\nThere are three supported ways of deleting vectors.\n\n### Delete by ID\n\nThe following example deletes the vector with ID `vector-id` in the namespace `namespace`.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet mut index = pinecone.index(\"index-host\").await?;\n\nlet ids = [\"vector-id\"]\n\nindex.delete_by_id(\u0026ids, \u0026\"namespace\".into()).await?;\n```\n\n### Delete by filter:\n\nThe following example deletes vectors that satisfy the filter in the namespace `namespace`.\n\n```rust\nuse std::collections::BTreeMap;\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::{Metadata, Value, Kind, Namespace};\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet mut fields = BTreeMap::new();\nlet kind = Some(Kind::StringValue(\"value\".to_string()));\nfields.insert(\"field\".to_string(), Value { kind });\n\nindex.delete_by_filter(Metadata { fields }, \u0026\"namespace\".into()).await?;\n```\n\n### Delete all:\n\nThe following example deletes all vectors in the namespace `namespace`.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet mut index = pinecone.index(\"index-host\").await?;\n\nindex.delete_all(\u0026\"namespace\".into()).await?;\n```\n\n## Fetch vectors\n\nThe following example fetches the vectors with IDs `1` and `2` from the default namespace.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::FetchResponse;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet mut index = pinecone.index(\"index-host\").await?;\n\nlet vectors = \u0026[\"1\", \"2\"];\n\nlet response: FetchResponse = index.fetch(vectors, \u0026Default::default()).await?;\n```\n\n## Update vectors\n\nThe following example updates the vector with ID `vector-id` in the namespace `namespace` to have values `[1.0, 2.0, 3.0, 4.0]`.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::UpdateResponse;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet mut index = pinecone.index(\"index-host\").await?;\n\nlet response: UpdateResponse = index.update(\"vector-id\", vec![1.0, 2.0, 3.0, 4.0], None, None, \u0026\"namespace\".into()).await?;\n```\n\n## List vectors\n\nThe following example lists vectors in the namespace `namespace`.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::{Namespace, ListResponse};\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet mut index = pinecone.index(\"index-host\").await?;\n\nlet response: ListResponse = index.list(\u0026\"namespace\".into(), None, None, None).await?;\n```\n\n# Collections\n\n## Create collection\n\nThe following example creates a collection `collection-name` in the index `index-name`.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::CollectionModel;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet collection: CollectionModel = pinecone.create_collection(\"collection-name\", \"index-name\").await?;\n```\n\n## List collections\n\nThe following example lists all collections in a project.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::CollectionList;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet collection_list: CollectionList = pinecone.list_collections().await?;\n```\n\n## Describe collection\n\nThe following example describes the collection `collection-name`.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\nuse pinecone_sdk::models::CollectionModel;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\nlet collection: CollectionModel = pinecone.describe_collection(\"collection-name\").await?;\n```\n\n## Delete collection\n\nThe following example deletes the collection `collection-name`.\n\n```rust\nuse pinecone_sdk::pinecone::PineconeClientConfig;\n\nlet config = PineconeClientConfig {\n    api_key: Some('\u003c\u003cPINECONE_API_KEY\u003e\u003e'),\n    ..Default::default()\n};\nlet pinecone = config.client()?;\n\npinecone.delete_collection(\"collection-name\").await?;\n```\n\n# Contributing\n\nIf you'd like to make a contribution, or get setup locally to develop the Pinecone Rust client, please see our [contributing guide](https://github.com/pinecone-io/pinecone-rust-client/blob/emily/update-readme/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinecone-io%2Fpinecone-rust-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpinecone-io%2Fpinecone-rust-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpinecone-io%2Fpinecone-rust-client/lists"}