Our new LangChain Academy Course Deep Research with LangGraph is now live! Enroll for free.
OSS (v1-alpha)
LangChain and LangGraph
MATHPIX_API_KEY
import getpass import os if "MATHPIX_API_KEY" not in os.environ: os.environ["MATHPIX_API_KEY"] = getpass.getpass("Enter your Mathpix API key: ")
# os.environ["LANGSMITH_API_KEY"] = getpass.getpass("Enter your LangSmith API key: ") # os.environ["LANGSMITH_TRACING"] = "true"
%pip install -qU langchain-community
from langchain_community.document_loaders import MathpixPDFLoader file_path = "./example_data/layout-parser-paper.pdf" loader = MathpixPDFLoader(file_path)
docs = loader.load() docs[0]
print(docs[0].metadata)
page = [] for doc in loader.lazy_load(): page.append(doc) if len(page) >= 10: # do some paged operation, e.g. # index.upsert(page) page = []