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, version 4.1.1 or higher
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

Built Distribution

File details

Details for the file pinecone_plugin_inference-2.0.0.dev20241112200340.tar.gz.

File metadata

File hashes

Hashes for pinecone_plugin_inference-2.0.0.dev20241112200340.tar.gz
Algorithm Hash digest
SHA256 1fa2dccc5f585e61fc58b4d688995d2597ae4503c2764cabb8656de487401710
MD5 6ca1505a4363c9e435463c342a4ad5c3
BLAKE2b-256 b346248eb8142d2bb7d8bf3d8a3bc7f2e2ca0aaf9b47978b6ea3946bccc46836

See more details on using hashes here.

File details

Details for the file pinecone_plugin_inference-2.0.0.dev20241112200340-py3-none-any.whl.

File metadata

File hashes

Hashes for pinecone_plugin_inference-2.0.0.dev20241112200340-py3-none-any.whl
Algorithm Hash digest
SHA256 d1149289a625e5d197b363d923afb76711edfb8567071fc7c815b1715142361b
MD5 4bea4adbf6f4fa5f6a458b886946cbf3
BLAKE2b-256 ec9a4ce62dd287fd4a9678b9259491cbfe33e3f4e79ad8bac63c461bd82a33e9

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