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 torrey-plugin
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
Close
Hashes for pinecone_plugin_inference-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fcda4a10b92616d2de7d94cc2959b04bb3f93d2271ba5aff5a90940b995fe226 |
|
MD5 | 81a7627fc2b11a4ded296734b20edae7 |
|
BLAKE2b-256 | b9403a63a785c01b2aeca3dff2ecf917b0ecc65016c707a4908be4039519e441 |
Close
Hashes for pinecone_plugin_inference-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3660710923d28563605db1535a088ecdacabe30dcfe4f2c7a9601f285d10ad6 |
|
MD5 | b65784570f0621389b3fd0d1b9c4eeb7 |
|
BLAKE2b-256 | 33558f4c5248e3190524ee349eb7c7f95c343e2d220ed9a90c850778b3434b60 |