mayooear / gpt4-pdf-chatbot-langchain

GPT4 & LangChain Chatbot for large PDF docs
https://www.youtube.com/watch?v=ih9PBGVVOO4
14.93k stars 3.02k forks source link

Getting an error on ingestion #3

Closed lukebyrne closed 1 year ago

lukebyrne commented 1 year ago

Hi, thanks for the amazing video and repo.

I have just cloned it to start playing around, however when I go to ingest I get the following error whcih I cant seem to debug.

error [TypeError: t.replaceAll is not a function]

Any suggestions most welcome.

lukebyrne commented 1 year ago

I wrote my own in Python and it seemed to work no probs.

from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.text_splitter import CharacterTextSplitter
from langchain.vectorstores import Pinecone
from langchain.document_loaders import PyMuPDFLoader
import pinecone

loader = PyMuPDFLoader("docs/MorseVsFrederick.pdf")
documents = loader.load()
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
docs = text_splitter.split_documents(documents)
embeddings = OpenAIEmbeddings(openai_api_key="")

# initialize pinecone
pinecone.init(
    api_key="",  # find at app.pinecone.io
    environment=""  # next to api key in console
)

index_name = "agentic-v1"

docsearch = Pinecone.from_documents(docs, embeddings, index_name=index_name)
lukebyrne commented 1 year ago

I think its my node version. Please ignore.