Skip to content

Commit

Permalink
fix: readme (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
chloedia authored Nov 1, 2024
1 parent 4b12bfa commit b3b80a3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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")
Expand Down

0 comments on commit b3b80a3

Please sign in to comment.