PineconeEmbeddings#
- class langchain_pinecone.embeddings.PineconeEmbeddings[source]#
Bases:
BaseModel
,Embeddings
PineconeEmbeddings embedding model.
Example
from langchain_pinecone import PineconeEmbeddings from langchain_pinecone import PineconeVectorStore from langchain_core.documents import Document # Initialize embeddings with a specific model embeddings = PineconeEmbeddings(model="multilingual-e5-large") # Embed a single query query_embedding = embeddings.embed_query("What is machine learning?") # Embed multiple documents docs = ["Document 1 content", "Document 2 content"] doc_embeddings = embeddings.embed_documents(docs) # Use with PineconeVectorStore from pinecone import Pinecone pc = Pinecone(api_key="your-api-key") index = pc.Index("your-index-name") vectorstore = PineconeVectorStore( index=index, embedding=embeddings ) # Add documents to vector store vectorstore.add_documents([ Document(page_content="Hello, world!"), Document(page_content="This is a test.") ]) # Search for similar documents results = vectorstore.similarity_search("hello", k=2)
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- param batch_size: int | None = None#
Batch size for embedding documents.
- param dimension: int | None = None#
- param document_params: Dict [Optional]#
Parameters for embedding document
- param model: str [Required]#
Model to use for example โmultilingual-e5-largeโ.
- param pinecone_api_key: SecretStr [Optional] (alias 'api_key')#
Pinecone API key.
If not provided, will look for the PINECONE_API_KEY environment variable.
- param query_params: Dict [Optional]#
Parameters for embedding query.
- param show_progress_bar: bool = False#
- async aembed_documents(
- texts: List[str],
Asynchronous Embed search docs.
- Parameters:
texts (List[str]) โ List of text to embed.
- Returns:
List of embeddings.
- Return type:
List[List[float]]
- async aembed_query(
- text: str,
Asynchronously embed query text.
- Parameters:
text (str)
- Return type:
List[float]
- embed_documents(
- texts: List[str],
Embed search docs.
- Parameters:
texts (List[str])
- Return type:
List[List[float]]
- embed_query(
- text: str,
Embed query text.
- Parameters:
text (str)
- Return type:
List[float]
- property async_client: PineconeAsyncio#
Lazily initialize the async client.