Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:
linting:
uses: './.github/workflows/lint.yaml'

unit-tests:
uses: './.github/workflows/testing-unit.yaml'
secrets: inherit
# unit-tests:
# uses: './.github/workflows/testing-unit.yaml'
# secrets: inherit

integration-tests:
uses: './.github/workflows/testing-integration.yaml'
secrets: inherit
needs: unit-tests
# integration-tests:
# uses: './.github/workflows/testing-integration.yaml'
# secrets: inherit
# needs: unit-tests

dependency-tests:
uses: './.github/workflows/testing-dependency.yaml'
secrets: inherit
needs: unit-tests
# dependency-tests:
# uses: './.github/workflows/testing-dependency.yaml'
# secrets: inherit
# needs: unit-tests

package:
name: Check packaging
Expand All @@ -42,13 +42,13 @@ jobs:
- name: Package
run: poetry build

build-docs:
name: Build docs with pdoc
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build docs with pdoc
uses: './.github/actions/build-docs'
with:
python-version: 3.11
# build-docs:
# name: Build docs with pdoc
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Build docs with pdoc
# uses: './.github/actions/build-docs'
# with:
# python-version: 3.11
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:

- name: Verify unique release number
run: |
TAG_NAME=${{ steps.bump.outputs.VERSION_TAG }}
TAG_NAME=pinecone-client-${{ steps.bump.outputs.VERSION_TAG }}
if git rev-parse -q --verify "refs/tags/$TAG_NAME" >/dev/null; then
echo "Tag $TAG_NAME already exists."
exit 1
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:

- name: Tag version
run: |
newVersionTag="${{ steps.bump.outputs.VERSION_TAG }}"
newVersionTag="pinecone-client-${{ steps.bump.outputs.VERSION_TAG }}"
git tag -a $newVersionTag -m "Release $newVersionTag"

- name: Push tags (prerelease)
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ on:
- 'major' # breaking changes

jobs:
unit-tests:
uses: './.github/workflows/testing-unit.yaml'
secrets: inherit
integration-tests:
uses: './.github/workflows/testing-integration.yaml'
secrets: inherit
dependency-tests:
uses: './.github/workflows/testing-dependency.yaml'
secrets: inherit
# unit-tests:
# uses: './.github/workflows/testing-unit.yaml'
# secrets: inherit
# integration-tests:
# uses: './.github/workflows/testing-integration.yaml'
# secrets: inherit
# dependency-tests:
# uses: './.github/workflows/testing-dependency.yaml'
# secrets: inherit

pypi:
uses: './.github/workflows/publish-to-pypi.yaml'
needs:
- unit-tests
- integration-tests
- dependency-tests
# needs:
# - unit-tests
# - integration-tests
# - dependency-tests
with:
isPrerelease: false
ref: ${{ inputs.ref }}
Expand All @@ -45,8 +45,8 @@ jobs:
PYPI_USERNAME: __token__
PYPI_PASSWORD: ${{ secrets.PROD_PYPI_PUBLISH_TOKEN }}

docs-publish:
uses: './.github/workflows/build-and-publish-docs.yaml'
secrets: inherit
needs:
- pypi
# docs-publish:
# uses: './.github/workflows/build-and-publish-docs.yaml'
# secrets: inherit
# needs:
# - pypi
216 changes: 18 additions & 198 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,210 +1,30 @@
# Pinecone Python SDK
![License](https://img.shields.io/github/license/pinecone-io/pinecone-python-client?color=orange) [![CI](https://github.com/pinecone-io/pinecone-python-client/actions/workflows/pr.yaml/badge.svg)](https://github.com/pinecone-io/pinecone-python-client/actions/workflows/pr.yaml)
# Pinecone Python Client (DEPRECATED)

The official Pinecone Python SDK.
The official Pinecone python package has been renamed from `pinecone-client` to `pinecone`. To upgrade, please
**remove** `pinecone-client` from your project dependencies and then **add** the `pinecone` package to get the
latest updates.

For more information, see the docs at https://docs.pinecone.io

**WARNING:** Failure to remove `pinecone-client` before installing `pinecone` can lead to confusing interactions
between the two packages.

## Documentation
## Upgrade steps

- [**Reference Documentation**](https://sdk.pinecone.io/python/index.html)

### Upgrading the SDK

For notes on changes between major versions, see [Upgrading](./docs/upgrading.md)

## Prerequisites

- The Pinecone Python SDK is compatible with Python 3.9 and greater. It has been tested with CPython versions from 3.9 to 3.13.
- Before 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).

## Installation

The Pinecone Python SDK is distributed on PyPI using the package name `pinecone`. By default the `pinecone` has a minimal set of dependencies, but you can install some extras to unlock additional functionality.

Available extras:

- `pinecone[asyncio]` will add a dependency on `aiohttp` and enable usage of `PineconeAsyncio`, the asyncio-enabled version of the client for use with highly asynchronous modern web frameworks such as FastAPI.
- `pinecone[grpc]` will add dependencies on `grpcio` and related libraries needed to make pinecone data calls such as `upsert` and `query` over [GRPC](https://grpc.io/) for a modest performance improvement. See the guide on [tuning performance](https://docs.pinecone.io/docs/performance-tuning).

#### Installing with pip

```shell
# Install the latest version
pip3 install pinecone

# Install the latest version, with optional dependencies
pip3 install "pinecone[asyncio,grpc]"
```

#### Installing with uv

[uv](https://docs.astral.sh/uv/) is a modern package manager that runs 10-100x faster than pip and supports most pip syntax.

```shell
# Install the latest version
uv install pinecone

# Install the latest version, optional dependencies
uv install "pinecone[asyncio,grpc]"
```

#### Installing with [poetry](https://python-poetry.org/)

```shell
# Install the latest version
poetry add pinecone

# Install the latest version, with optional dependencies
poetry add pinecone --extras asyncio --extras grpc
```

# Quickstart

## Bringing your own vectors to Pinecone

```python
from pinecone import (
Pinecone,
ServerlessSpec,
CloudProvider,
AwsRegion,
VectorType
)

# 1. Instantiate the Pinecone client
pc = Pinecone(api_key='YOUR_API_KEY')

# 2. Create an index
index_config = pc.create_index(
name="index-name",
dimension=1536,
spec=ServerlessSpec(
cloud=CloudProvider.AWS,
region=AwsRegion.US_EAST_1
),
vector_type=VectorType.DENSE
)

# 3. Instantiate an Index client
idx = pc.Index(host=index_config.host)

# 4. Upsert embeddings
idx.upsert(
vectors=[
("id1", [0.1, 0.2, 0.3, 0.4, ...], {"metadata_key": "value1"}),
("id2", [0.2, 0.3, 0.4, 0.5, ...], {"metadata_key": "value2"}),
],
namespace="example-namespace"
)

# 5. Query your index using an embedding
query_embedding = [...] # list should have length == index dimension
idx.query(
vector=query_embedding,
top_k=10,
include_metadata=True,
filter={"metadata_key": { "$eq": "value1" }}
)
```sh
pip uninstall pinecone-client
pip install pinecone
```

## Bring your own data using Pinecone integrated inference

```python
from pinecone import (
Pinecone,
CloudProvider,
AwsRegion,
EmbedModel,
)

# 1. Instantiate the Pinecone client
pc = Pinecone(api_key="<<PINECONE_API_KEY>>")

# 2. Create an index configured for use with a particular model
index_config = pc.create_index_for_model(
name="my-model-index",
cloud=CloudProvider.AWS,
region=AwsRegion.US_EAST_1,
embed=IndexEmbed(
model=EmbedModel.Multilingual_E5_Large,
field_map={"text": "my_text_field"}
)
)
Or, if you are using grpc:

# 3. Instantiate an Index client
idx = pc.Index(host=index_config.host)

# 4. Upsert records
idx.upsert_records(
namespace="my-namespace",
records=[
{
"_id": "test1",
"my_text_field": "Apple is a popular fruit known for its sweetness and crisp texture.",
},
{
"_id": "test2",
"my_text_field": "The tech company Apple is known for its innovative products like the iPhone.",
},
{
"_id": "test3",
"my_text_field": "Many people enjoy eating apples as a healthy snack.",
},
{
"_id": "test4",
"my_text_field": "Apple Inc. has revolutionized the tech industry with its sleek designs and user-friendly interfaces.",
},
{
"_id": "test5",
"my_text_field": "An apple a day keeps the doctor away, as the saying goes.",
},
{
"_id": "test6",
"my_text_field": "Apple Computer Company was founded on April 1, 1976, by Steve Jobs, Steve Wozniak, and Ronald Wayne as a partnership.",
},
],
)

# 5. Search for similar records
from pinecone import SearchQuery, SearchRerank, RerankModel

response = index.search_records(
namespace="my-namespace",
query=SearchQuery(
inputs={
"text": "Apple corporation",
},
top_k=3
),
rerank=SearchRerank(
model=RerankModel.Bge_Reranker_V2_M3,
rank_fields=["my_text_field"],
top_n=3,
),
)
```sh
pip uninstall pinecone-client
pip install "pinecone[grpc]"
```

## More information on usage

Detailed information on specific ways of using the SDK are covered in these other pages.

- Store and query your vectors
- [Serverless Indexes](./docs/db_control/serverless-indexes.md)
- [Pod Indexes](./docs/db_control/pod-indexes.md)
- [Working with vectors](./docs/db_data/index-usage-byov.md)

- [Inference API](./docs/inference-api.md)
- [FAQ](./docs/faq.md)


# Issues & Bugs

If you notice bugs or have feedback, please [file an issue](https://github.com/pinecone-io/pinecone-python-client/issues).

You can also get help in the [Pinecone Community Forum](https://community.pinecone.io/).
For info on code changes that may impact you, see [Release Notes](https://github.com/pinecone-io/pinecone-python-client/releases) and [Upgrading](https://github.com/pinecone-io/pinecone-python-client/blob/main/docs/upgrading.md)

# Contributing
## Links

If you'd like to make a contribution, or get setup locally to develop the Pinecone Python SDK, please see our [contributing guide](https://github.com/pinecone-io/pinecone-python-client/blob/main/CONTRIBUTING.md)
- `pinecone` on [PyPI](https://pypi.org/project/pinecone/)
- [Source on Github](https://github.com/pinecone-io/pinecone-python-client)
2 changes: 1 addition & 1 deletion codegen/apis
Submodule apis updated from eb79d8 to 29ca86
22 changes: 3 additions & 19 deletions pinecone/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@
.. include:: ../README.md
"""

from .deprecated_plugins import check_for_deprecated_plugins
from .deprecation_warnings import *
from .config import *
from .exceptions import *
from .control import *
from .data import *
from .models import *
from .enums import *

from .utils import __version__

import logging

# Raise an exception if the user is attempting to use the SDK with
# deprecated plugins installed in their project.
check_for_deprecated_plugins()

# Silence annoying log messages from the plugin interface
logging.getLogger("pinecone_plugin_interface").setLevel(logging.CRITICAL)
raise Exception(
"The official Pinecone python package has been renamed from `pinecone-client` to `pinecone`. Please remove `pinecone-client` from your project dependencies and add `pinecone` instead. See the README at https://github.com/pinecone-io/pinecone-python-client for more information on using the python SDK."
)
2 changes: 1 addition & 1 deletion pinecone/__version__
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.1
6.0.0
8 changes: 0 additions & 8 deletions pinecone/config/__init__.py

This file was deleted.

Loading