import os import pickle from langchain.document_loaders import DirectoryLoader, TextLoader from langchain.embeddings import OpenAIEmbeddings from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain.vectorstores.faiss import FAISS openai_api_key= "<OPENAI API KEY を記述してください>" os.environ["OPENAI_API_KEY"] = openai_api_key def ingest_docs(dir_name): # (1) 一連の文書を取り込む。 loader =