Load index using from_texts

Hi there! I’m starting to use Pinecone and I am unable to load an index already created.
Repro steps:

#Load a dataset
from datasets import load_dataset
MedQA_dataset = load_dataset(“GBaker/MedQA-USMLE-4-options”, split=“train+test”)
question = MedQA_dataset[‘question’]
answer = MedQA_dataset[‘answer’]
texts = [str(x) + ’ The answer is:’ + str(y) for x, y in zip(question, answer)]

#Define embedding method
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()

#Define vector store
from langchain.vectorstores import Pinecone
import pinecone

api_key=PINECONE_API_KEY, # find at app.pinecone.io
environment=PINECONE_ENV, # next to api key in console
index_name = “yyyyyy”

pinecone = Pinecone.from_texts(texts,embeddings,index_name)

TypeError Traceback (most recent call last)
in <cell line: 1>()
----> 1 tpinecone = Pinecone.from_texts(text_test,embeddings,index_name=“yyyyy”)

19 frames
/usr/lib/python3.10/http/client.py in putheader(self, header, *values)
1257 values[i] = str(one_value).encode(‘ascii’)
→ 1259 if _is_illegal_header_value(values[i]):
1260 raise ValueError(‘Invalid header value %r’ % (values[i],))

TypeError: expected string or bytes-like object

any idea what is happening?