本页还没有译文
本页 17 段还没译成日本語,下面显示的是英文原文。Pinecone integrations
还没翻译译自英文(docs.langchain.com)本页 17 段都还没译
Pinecone is a vector database with broad functionality.
Installation and setup
Install the Python SDK:
pipuv
pip install langchain-pineconeuv add langchain-pineconeVector store
There exists a wrapper around Pinecone indexes, allowing you to use it as a vectorstore, whether for semantic search or example selection.
from langchain_pinecone import PineconeVectorStoreFor a more detailed walkthrough of the Pinecone vectorstore, see this notebook
Sparse vector store
LangChain's PineconeSparseVectorStore enables sparse retrieval using Pinecone's sparse English model. It maps text to sparse vectors and supports adding documents and similarity search.
from langchain_pinecone import PineconeSparseVectorStore
# Initialize sparse vector store
vector_store = PineconeSparseVectorStore(
index=my_index,
embedding_model="pinecone-sparse-english-v0"
)
# Add documents
vector_store.add_documents(documents)
# Query
results = vector_store.similarity_search("your query", k=3)For a more detailed walkthrough, see the Pinecone Sparse Vector Store notebook.
Sparse embedding
LangChain's PineconeSparseEmbeddings provides sparse embedding generation using Pinecone's pinecone-sparse-english-v0 model.
from langchain_pinecone.embeddings import PineconeSparseEmbeddings
# Initialize sparse embeddings
sparse_embeddings = PineconeSparseEmbeddings(
model="pinecone-sparse-english-v0"
)
# Embed a single query (returns SparseValues)
query_embedding = sparse_embeddings.embed_query("sample text")
# Embed multiple documents (returns list of SparseValues)
docs = ["Document 1 content", "Document 2 content"]
doc_embeddings = sparse_embeddings.embed_documents(docs)For more detailed usage, see the Pinecone Sparse Embeddings notebook.
Retrievers
Self query retriever
Pinecone vector store can be used as a retriever for self-querying.