from langchain.document_loaders import PyPDFLoader
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.indexes import VectorstoreIndexCreator
from langchain_openai import OpenAI

loader = PyPDFLoader("digital_01_202107_keikaku.pdf")
embedding = OpenAIEmbeddings()

index = VectorstoreIndexCreator(embedding=embedding).from_loaders([loader])
llm = OpenAI()

print("質問を入力してください")
answer = index.query(input(), llm=llm)
print(answer)