Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance readability and usability of demo_basic notebook #353

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
__pycache__/
*.pyc
.DS_Store
.idea
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/discord.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/llama_parse.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 44 additions & 12 deletions examples/demo_basic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,38 @@
{
"cell_type": "markdown",
"metadata": {},
"source": "# LlamaParse Basic Usage"
},
{
"metadata": {},
"cell_type": "markdown",
"source": [
"# LlamaParse Usage"
"## Setup\n",
"\n",
"First, let's set up our environment with the necessary imports and initializations:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"metadata": {
"jupyter": {
"is_executing": true
}
},
"source": [
"%pip install llama-index llama-parse"
]
],
"outputs": [],
"execution_count": null
},
{
"metadata": {},
"cell_type": "markdown",
"source": "Now let's fetch some text content to use in our examples. We'll use the text from Attention is All You Need."
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"cell_type": "code",
"outputs": [
{
"name": "stdout",
Expand All @@ -39,15 +54,14 @@
]
}
],
"source": [
"!wget \"https://arxiv.org/pdf/1706.03762.pdf\" -O \"./attention.pdf\""
]
"execution_count": null,
"source": "!wget \"https://arxiv.org/pdf/1706.03762.pdf\" -O \"./attention.pdf\""
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"cell_type": "code",
"outputs": [],
"execution_count": null,
"source": [
"# llama-parse is async-first, running the sync code in a notebook requires the use of nest_asyncio\n",
"import nest_asyncio\n",
Expand All @@ -59,6 +73,15 @@
"os.environ[\"LLAMA_CLOUD_API_KEY\"] = \"llx-...\""
]
},
{
"metadata": {},
"cell_type": "markdown",
"source": [
"## Example 1: PDF to plain text\n",
"\n",
"Let's demonstrate Llama Parse parsing abilities from PDF to plaintext."
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -106,6 +129,15 @@
"print(documents[0].text[6000:7000])"
]
},
{
"metadata": {},
"cell_type": "markdown",
"source": [
"## Example 2: PDF to Markdown\n",
"\n",
"Let's demonstrate Llama Parse parsing abilities from PDF to plaintext."
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
Loading