From b3b80a3a599bbd4bec8ed79bb9ef44c8c7c92789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chlo=C3=A9=20Daems?= <73901882+chloedia@users.noreply.github.com> Date: Fri, 1 Nov 2024 17:48:40 +0100 Subject: [PATCH] fix: readme (#99) --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dabef2e..63132b8 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,10 @@ pip install megaparse ```python +from megaparse.core.megaparse import MegaParse +from langchain_openai import ChatOpenAI +from megaparse.core.parser.unstructured_parser import UnstructuredParser + model = ChatOpenAI(model="gpt-4o", api_key=os.getenv("OPENAI_API_KEY")) # or any langchain compatible Chat Models parser = UnstructuredParser(model=model) megaparse = MegaParse(parser) @@ -54,6 +58,9 @@ megaparse.save("./test.md") #saves the last processed doc in md format * Change the parser to MegaParseVision ```python +from megaparse.core.megaparse import MegaParse +from langchain_openai import ChatOpenAI +from megaparse.core.parser.megaparse_vision import MegaParseVision model = ChatOpenAI(model="gpt-4o", api_key=os.getenv("OPENAI_API_KEY")) # type: ignore parser = MegaParseVision(model=model) @@ -72,7 +79,10 @@ megaparse.save("./test.md") 2. Change the parser to LlamaParser ```python -from parser.llama import LlamaParser +from megaparse.core.megaparse import MegaParse +from langchain_openai import ChatOpenAI +from megaparse.core.parser.llama import LlamaParser + parser = LlamaParser(api_key = os.getenv("LLAMA_CLOUD_API_KEY")) megaparse = MegaParse(parser) response = megaparse.load("./test.pdf")