Complete code
Here is the code in its entirety:
%pip install langchain_community %pip install langchain_experimental %pip install langchain-openai %pip install langchainhub %pip install chromadb %pip install langchain %pip install beautifulsoup4
Restart the kernel before running the following code:
import os from langchain_community.document_loaders import WebBaseLoader import bs4 import openai from langchain_openai import ChatOpenAI, OpenAIEmbeddings from langchain import hub from langchain_core.output_parsers import StrOutputParser from langchain_core.runnables import RunnablePassthrough import chromadb from langchain_community.vectorstores import Chroma from langchain_experimental.text_splitter import SemanticChunker os.environ['OPENAI_API_KEY'] = 'sk-###################' openai.api_key = os.environ['OPENAI_API_KEY'] #### INDEXING #### loader = WebBaseLoader( web_paths=("https://kbourne.github.io/chapter1.html"...