Pinecone.from_texts() not working?

Hi @codingshubham.in. As the error says, there’s no from_texts() method for the Python client. You might be confusing this with the Langchain from_texts function, but that’s not part of the Pinecone Python SDK itself. It would only be used if you’re using Langchain to work with your index.

To query your index you would use index.query() and supply the vector you’re querying with. There’s an example in the Python client repo:

import os
from pinecone import Pinecone

pc = Pinecone(api_key='<<PINECONE_API_KEY>>')

# Find your index host by calling describe_index
# through the Pinecone web console
index = pc.Index(host=os.environ.get('INDEX_HOST'))

query_response = index.query(
    namespace="example-namespace",
    vector=[0.1, 0.2, 0.3, 0.4],
    top_k=10,
    include_values=True,
    include_metadata=True,
    filter={
        "genre": {"$in": ["comedy", "documentary", "drama"]}
    }
)

Thanks for Responding but i want to create vector embeddings for each text chunks of my related documents and store those vector embeddings of each chunk in Pinecone.

1 Like

The problem is only in the function… If it was defined, the problem would be solved… We hope for help in solving the problem of this function (from_text)

1 Like

Import pinecone from langchain

from langchain.vectorstores import Pinecone as PC

pinecone_index = PC.from_texts(docs_chunks, embeddings, index_name=index_name)

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.