Skip to main content

Embeddings plugin for Pinecone SDK

Project description

Inference API plugin for python SDK

Installation

The plugin is distributed separately from the core python sdk.

# Install the base python SDK
pip install pinecone-client

# And also the plugin functionality
pip install pinecone-plugin-inference

Usage

Interact with Pinecone's Inference APIs, e.g. create embeddings (currently in preview).

Models currently supported:

Generate embeddings

The following example highlights how to use an embedding model to generate embeddings for a list of documents and a user query, with the ultimate goal of retrieving similar documents from a Pinecone index.

from pinecone import Pinecone

pc = Pinecone(api_key="<<PINECONE_API_KEY>>")
model = "multilingual-e5-large"

# Embed documents
text = [
    "Turkey is a classic meat to eat at American Thanksgiving.",
    "Many people enjoy the beautiful mosques in Turkey.",
]
text_embeddings = pc.inference.embed(
    model=model,
    inputs=text,
    parameters={"input_type": "passage", "truncate": "END"},
)

# <<Upsert documents into Pinecone index>>

# Embed query
query = ["How should I prepare my turkey?"]
query_embeddings = pc.inference.embed(
    model=model,
    inputs=query,
    parameters={"input_type": "query", "truncate": "END"},
)

# <<Send query to Pinecone index to retrieve similar documents>>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pinecone_plugin_inference-0.2.1.tar.gz (56.7 kB view details)

Uploaded Source

Built Distribution

pinecone_plugin_inference-0.2.1-py3-none-any.whl (129.2 kB view details)

Uploaded Python 3

File details

Details for the file pinecone_plugin_inference-0.2.1.tar.gz.

File metadata

  • Download URL: pinecone_plugin_inference-0.2.1.tar.gz
  • Upload date:
  • Size: 56.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.5.0-1021-azure

File hashes

Hashes for pinecone_plugin_inference-0.2.1.tar.gz
Algorithm Hash digest
SHA256 71bf8dfc926223241c16f7c860e803c741cfa5097ee379e225f8eada1a4e8f59
MD5 a1b7218faa8df7ab876e69ac2df84570
BLAKE2b-256 f8c08bbcf362b44c8be3f165296092af4272e3180203f7aa67f5bc731c850fb0

See more details on using hashes here.

File details

Details for the file pinecone_plugin_inference-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pinecone_plugin_inference-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 391db5edb077e99ac149a0609f7fdd5c0b03ed206612ed2f29ee5ca5fafd0590
MD5 71e5399143ee1cd92ece274afa668595
BLAKE2b-256 48211d6a2c228300d9f5b707e9caed8034e245b625f79a70e46ad1dee631a783

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page