mirror of
https://github.com/run-llama/llama_cloud_services.git
synced 2026-07-21 12:05:23 -04:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7010a46905 | |||
| af1f61186a | |||
| 13dea6ae1a | |||
| fa9698a681 | |||
| 4bed7c7895 | |||
| a3954f3dda | |||
| b779e231bf | |||
| de12de1437 | |||
| 5274ea5277 | |||
| 398d775122 | |||
| aca18e12ef | |||
| 270c2ed0aa | |||
| 2cf960196f |
@@ -1,4 +1,4 @@
|
||||
# LlamaParse (Preview)
|
||||
# LlamaParse
|
||||
|
||||
LlamaParse is an API created by LlamaIndex to efficiently parse and represent files for efficient retrieval and context augmentation using LlamaIndex frameworks.
|
||||
|
||||
@@ -12,11 +12,20 @@ Currently available in preview mode for **free**. Try it out today!
|
||||
|
||||
First, login and get an api-key from `https://cloud.llamaindex.ai`.
|
||||
|
||||
Install the package:
|
||||
Then, make sure you have the latest LlamaIndex version installed.
|
||||
|
||||
**NOTE:** If you are upgrading from v0.9.X, we recommend following our [migration guide](https://pretty-sodium-5e0.notion.site/v0-10-0-Migration-Guide-6ede431dcb8841b09ea171e7f133bd77), as well as uninstalling your previous version first.
|
||||
|
||||
```
|
||||
pip uninstall llama-index # run this if upgrading from v0.9.x or older
|
||||
pip install -U llama-index --upgrade --no-cache-dir --force-reinstall
|
||||
```
|
||||
|
||||
Lastly, install the package:
|
||||
|
||||
`pip install llama-parse`
|
||||
|
||||
Then, you can run the following to parse your first PDF file:
|
||||
Now you can run the following to parse your first PDF file:
|
||||
|
||||
```python
|
||||
import nest_asyncio
|
||||
@@ -27,14 +36,21 @@ from llama_parse import LlamaParse
|
||||
parser = LlamaParse(
|
||||
api_key="llx-...", # can also be set in your env as LLAMA_CLOUD_API_KEY
|
||||
result_type="markdown", # "markdown" and "text" are available
|
||||
num_workers=4, # if multiple files passed, split in `num_workers` API calls
|
||||
verbose=True
|
||||
)
|
||||
|
||||
# sync
|
||||
documents = parser.load_data("./my_file.pdf")
|
||||
|
||||
# sync batch
|
||||
documents = parser.load_data(["./my_file1.pdf", "./my_file2.pdf"])
|
||||
|
||||
# async
|
||||
documents = await parser.aload_data("./my_file.pdf")
|
||||
|
||||
# async batch
|
||||
documents = await parser.aload_data(["./my_file1.pdf", "./my_file2.pdf"])
|
||||
```
|
||||
|
||||
## Using with `SimpleDirectoryReader`
|
||||
|
||||
+65
-135
@@ -18,6 +18,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!pip install llama-index\n",
|
||||
"!pip install llama-index-core==0.10.6.post1\n",
|
||||
"!pip install llama-index-embeddings-openai\n",
|
||||
"!pip install llama-index-postprocessor-flag-embedding-reranker\n",
|
||||
"!pip install git+https://github.com/FlagOpen/FlagEmbedding.git\n",
|
||||
@@ -42,25 +43,25 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# llama-parse is async-first, running the sync code in a notebook requires the use of nest_asyncio\n",
|
||||
"# llama-parse is async-first, running the async code in a notebook requires the use of nest_asyncio\n",
|
||||
"import nest_asyncio\n",
|
||||
"nest_asyncio.apply()\n",
|
||||
"\n",
|
||||
"import os\n",
|
||||
"# API access to llama-cloud\n",
|
||||
"os.environ[\"LLAMA_CLOUD_API_KEY\"] = \"llx-...\"\n",
|
||||
"os.environ[\"LLAMA_CLOUD_API_KEY\"] = \"llx-\"\n",
|
||||
"\n",
|
||||
"# Using OpenAI API for embeddings/llms\n",
|
||||
"os.environ[\"OPENAI_API_KEY\"] = \"sk-...\""
|
||||
"os.environ[\"OPENAI_API_KEY\"] = \"sk-\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -89,14 +90,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Started parsing the file under job_id fc4f99d7-664f-4e95-b3dc-2a5c952e05bc\n"
|
||||
"Started parsing the file under job_id edbcecf3-5379-40de-9c52-0d97985dccf5\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -108,7 +109,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -148,7 +149,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -159,7 +160,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -173,8 +174,8 @@
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"80it [00:00, 71059.79it/s]\n",
|
||||
"100%|██████████| 80/80 [00:18<00:00, 4.27it/s]\n"
|
||||
"80it [00:00, 77744.28it/s]\n",
|
||||
"100%|██████████| 80/80 [00:21<00:00, 3.66it/s]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -184,7 +185,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -193,7 +194,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -203,18 +204,9 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/Users/loganmarkewich/Library/Caches/pypoetry/virtualenvs/llama-parse-aNC435Vv-py3.11/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
||||
" from .autonotebook import tqdm as notebook_tqdm\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from llama_index.postprocessor.flag_embedding_reranker import FlagEmbeddingReranker\n",
|
||||
"\n",
|
||||
@@ -234,7 +226,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -253,49 +245,8 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Using old `PDFReader` from LLamaHub as baseline PDF parser\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from pathlib import Path\n",
|
||||
"from llama_index.core import Document\n",
|
||||
"from llama_index.readers.file import PDFReader\n",
|
||||
"\n",
|
||||
"docs0 = PDFReader().load_data(file=Path('./uber_10q_march_2022.pdf'))\n",
|
||||
"doc_text = \"\\n\\n\".join([d.get_content() for d in docs0])\n",
|
||||
"baseline_docs = [Document(text=doc_text)]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Build Vector Index for the nodes parsed from `PdfReader` and run basic query engine as a baseline approach"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"baseline_index = VectorStoreIndex.from_documents(baseline_docs)\n",
|
||||
"baseline_pdf_query_engine = baseline_index.as_query_engine(\n",
|
||||
" similarity_top_k=15\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Comparing `new LlamaParse vs old PdfReader` as pdf data parsing methods\n",
|
||||
"we also compare base query engine vs recursive query engine with tables"
|
||||
"## Using `new LlamaParse` as pdf data parsing methods and retrieve tables with two different methods\n",
|
||||
"we compare base query engine vs recursive query engine with tables"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -307,45 +258,37 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": 14,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"***********Baseline PDF Query Engine***********\n",
|
||||
"The cash paid for income taxes, net of refunds, is not explicitly provided in the supplemental disclosures of cash flow information in the context information.\n",
|
||||
"\n",
|
||||
"***********New LlamaParse+ Basic Query Engine***********\n",
|
||||
"The cash paid for income taxes, net of refunds, is not explicitly provided in the context information.\n",
|
||||
"\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_44_table: TextNode\n",
|
||||
"Cash paid for income taxes, net of refunds, is not explicitly provided in the context information.\n",
|
||||
"\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_44_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query how is the Cash paid for Income taxes, net of refunds from Supplemental disclosures of cash flow information?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_40_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_42_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query how is the Cash paid for Income taxes, net of refunds from Supplemental disclosures of cash flow information?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_42_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_40_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query how is the Cash paid for Income taxes, net of refunds from Supplemental disclosures of cash flow information?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_38_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_320_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query how is the Cash paid for Income taxes, net of refunds from Supplemental disclosures of cash flow information?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_320_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_38_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query how is the Cash paid for Income taxes, net of refunds from Supplemental disclosures of cash flow information?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_324_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query how is the Cash paid for Income taxes, net of refunds from Supplemental disclosures of cash flow information?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_120_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_324_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query how is the Cash paid for Income taxes, net of refunds from Supplemental disclosures of cash flow information?\n",
|
||||
"\u001b[0m\n",
|
||||
"***********New LlamaParse+ Recursive Retriever Query Engine***********\n",
|
||||
"$41\n"
|
||||
"$22 for the period ended March 31, 2021 and $41 for the period ended March 31, 2022.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"query = \"how is the Cash paid for Income taxes, net of refunds from Supplemental disclosures of cash flow information?\"\n",
|
||||
"\n",
|
||||
"response_0 = baseline_pdf_query_engine.query(query)\n",
|
||||
"print(\"***********Baseline PDF Query Engine***********\")\n",
|
||||
"print(response_0)\n",
|
||||
"\n",
|
||||
"response_1 = raw_query_engine.query(query)\n",
|
||||
"print(\"\\n***********New LlamaParse+ Basic Query Engine***********\")\n",
|
||||
"print(response_1)\n",
|
||||
@@ -369,46 +312,43 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 20,
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"***********Baseline PDF Query Engine***********\n",
|
||||
"The change in free cash flow from the financial and operational highlights is a decrease of $635 million, from $(682) million in 2021 to $(47) million in 2022. This represents a significant improvement in free cash flow performance from one period to the next.\n",
|
||||
"\n",
|
||||
"***********New LlamaParse+ Basic Query Engine***********\n",
|
||||
"The change in free cash flow from the financial and operational highlights is a decrease from $(682) million in 2021 to $(47) million in 2022. This represents a significant improvement in free cash flow performance from one period to the next.\n",
|
||||
"\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_320_table: TextNode\n",
|
||||
"\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_320_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the change of free cash flow and what is the rate from the financial and operational highlights?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_38_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_38_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the change of free cash flow and what is the rate from the financial and operational highlights?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_44_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_44_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the change of free cash flow and what is the rate from the financial and operational highlights?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_324_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_324_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the change of free cash flow and what is the rate from the financial and operational highlights?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_40_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_40_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the change of free cash flow and what is the rate from the financial and operational highlights?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_242_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_280_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the change of free cash flow and what is the rate from the financial and operational highlights?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_280_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_42_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the change of free cash flow and what is the rate from the financial and operational highlights?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_124_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the change of free cash flow and what is the rate from the financial and operational highlights?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_240_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the change of free cash flow and what is the rate from the financial and operational highlights?\n",
|
||||
"\u001b[0m\n",
|
||||
"***********New LlamaParse+ Recursive Retriever Query Engine***********\n",
|
||||
"The change in free cash flow from the financial and operational highlights is an improvement of $635 million, with the rate being a significant increase from a negative $682 million in the same period in 2021 to a negative $47 million in the current period.\n"
|
||||
"The change in free cash flow from the financial and operational highlights is an improvement of $635 million, with the rate being a significant increase compared to the same period in the prior year.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"query = \"what is the change of free cash flow and what is the rate from the financial and operational highlights?\"\n",
|
||||
"\n",
|
||||
"response_0 = baseline_pdf_query_engine.query(query)\n",
|
||||
"print(\"***********Baseline PDF Query Engine***********\")\n",
|
||||
"print(response_0)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"response_1 = raw_query_engine.query(query)\n",
|
||||
"print(\"\\n***********New LlamaParse+ Basic Query Engine***********\")\n",
|
||||
"print(response_1)\n",
|
||||
@@ -432,46 +372,39 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 24,
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"***********Baseline PDF Query Engine***********\n",
|
||||
"The net loss attributable to Uber Technologies, Inc. for the first quarter of 2022 was $5,930 million, compared to a net loss of $108 million for the same period in 2021.\n",
|
||||
"\n",
|
||||
"***********New LlamaParse+ Basic Query Engine***********\n",
|
||||
"The net loss value attributable to Uber for the current period is $5.9 billion, which is an increase compared to the net loss of $108 million in the same period last year.\n",
|
||||
"\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_26_table: TextNode\n",
|
||||
"\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_22_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the net loss value attributable to Uber compared to last year?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_22_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_316_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the net loss value attributable to Uber compared to last year?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_316_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_230_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the net loss value attributable to Uber compared to last year?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_230_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_26_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the net loss value attributable to Uber compared to last year?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_234_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_234_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the net loss value attributable to Uber compared to last year?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_24_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_24_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the net loss value attributable to Uber compared to last year?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_196_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_196_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query what is the net loss value attributable to Uber compared to last year?\n",
|
||||
"\u001b[0m\n",
|
||||
"***********New LlamaParse+ Recursive Retriever Query Engine***********\n",
|
||||
"The net loss attributable to Uber Technologies, Inc. for the first quarter of 2022 was $5.930 billion, which is significantly higher compared to the net loss of $108 million for the same period in 2021.\n"
|
||||
"The net loss value attributable to Uber Technologies, Inc. for the first quarter of 2022 was $5,930 million, which is significantly higher compared to the net loss of $108 million for the same period in 2021.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"query = \"what is the net loss value attributable to Uber compared to last year?\"\n",
|
||||
"\n",
|
||||
"response_0 = baseline_pdf_query_engine.query(query)\n",
|
||||
"print(\"***********Baseline PDF Query Engine***********\")\n",
|
||||
"print(response_0)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"response_1 = raw_query_engine.query(query)\n",
|
||||
"print(\"\\n***********New LlamaParse+ Basic Query Engine***********\")\n",
|
||||
"print(response_1)\n",
|
||||
@@ -495,46 +428,43 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"***********Baseline PDF Query Engine***********\n",
|
||||
"Cash flows from investing activities for the three months ended March 31, 2021 were a net cash outflow of $250 million, primarily driven by purchases of property and equipment, purchases of marketable and non-marketable equity securities, and acquisitions of businesses.\n",
|
||||
"\n",
|
||||
"***********New LlamaParse+ Basic Query Engine***********\n",
|
||||
"Cash flows from investing activities were primarily negative in both periods. In the three months ended March 31, 2022, net cash used in investing activities was $135 million, driven by purchases of property and equipment and acquisition of business. Similarly, in the three months ended March 31, 2021, net cash used in investing activities amounted to $250 million, mainly due to purchases of non-marketable equity securities, marketable securities, and a note receivable, partially offset by proceeds from maturities and sales of marketable securities and proceeds from the sale of non-marketable equity securities.\n",
|
||||
"\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_44_table: TextNode\n",
|
||||
"Cash flows from investing activities were as follows:\n",
|
||||
"- For the three months ended March 31, 2022, net cash used in investing activities was $135 million, primarily driven by $62 million in purchases of property and equipment and $59 million in acquisition of business, net of cash acquired.\n",
|
||||
"- For the three months ended March 31, 2021, net cash used in investing activities was $250 million, mainly consisting of $803 million in purchases of non-marketable equity securities, $336 million in purchases of marketable securities, and $216 million in purchases of a note receivable, partially offset by proceeds from maturities and sales of marketable securities of $696 million and $500 million in proceeds from the sale of non-marketable equity securities.\n",
|
||||
"\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_44_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query What were cash flows like from investing activities?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_38_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_38_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query What were cash flows like from investing activities?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_324_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_324_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query What were cash flows like from investing activities?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_40_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_40_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query What were cash flows like from investing activities?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_320_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_320_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query What were cash flows like from investing activities?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_270_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_42_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query What were cash flows like from investing activities?\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_35a1c1c6-370e-451d-aa36-e5e8a2e41e58_66_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;11;159;203mRetrieval entering id_b656577b-91de-47ca-981e-8b1d63e20c20_270_table: TextNode\n",
|
||||
"\u001b[0m\u001b[1;3;38;2;237;90;200mRetrieving from object TextNode with query What were cash flows like from investing activities?\n",
|
||||
"\u001b[0m\n",
|
||||
"***********New LlamaParse+ Recursive Retriever Query Engine***********\n",
|
||||
"Cash flows from investing activities were negative in both periods, with net cash used in investing activities decreasing from $250 million in the three months ended March 31, 2021 to $135 million in the three months ended March 31, 2022. The cash flows from investing activities primarily consisted of purchases of property and equipment, acquisitions of businesses, and purchases of securities, partially offset by proceeds from sales of securities.\n"
|
||||
"Cash flows from investing activities were as follows:\n",
|
||||
"- For the three months ended March 31, 2021, net cash used in investing activities was $250 million.\n",
|
||||
"- For the three months ended March 31, 2022, net cash used in investing activities was $135 million.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"query = \"What were cash flows like from investing activities?\"\n",
|
||||
"\n",
|
||||
"response_0 = baseline_pdf_query_engine.query(query)\n",
|
||||
"print(\"***********Baseline PDF Query Engine***********\")\n",
|
||||
"print(response_0)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"response_1 = raw_query_engine.query(query)\n",
|
||||
"print(\"\\n***********New LlamaParse+ Basic Query Engine***********\")\n",
|
||||
"print(response_1)\n",
|
||||
|
||||
@@ -0,0 +1,321 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Using llama-parse with AstraDB"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"In this notebook, we show a basic RAG-style example that uses `llama-parse` to parse a PDF document, store the corresponding document into a vector store (`AstraDB`) and finally, perform some basic queries against that store. The notebook is modeled after the quick start notebooks and hence is meant as a way of getting started with `llama-parse`, backed by a vector database."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Requirements"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# First, install the required dependencies\n",
|
||||
"!pip install --quiet llama-index llama-parse llama-index-vector-stores-astra astrapy"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Configuration"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"import openai\n",
|
||||
"\n",
|
||||
"from getpass import getpass\n",
|
||||
"\n",
|
||||
"# Get all required API keys and parameters\n",
|
||||
"llama_cloud_api_key = getpass(\"Enter your Llama Index Cloud API Key: \")\n",
|
||||
"api_endpoint = input(\"Enter you Astra DB API Endpoint: \")\n",
|
||||
"token = getpass(\"Enter your Astra DB Token: \")\n",
|
||||
"openai_api_key = getpass(\"Enter your OpenAI API Key: \")\n",
|
||||
"\n",
|
||||
"os.environ[\"LLAMA_CLOUD_API_KEY\"] = llama_cloud_api_key\n",
|
||||
"openai.api_key = openai_api_key"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# llama-parse is async-first, running the sync code in a notebook requires the use of nest_asyncio\n",
|
||||
"import nest_asyncio\n",
|
||||
"\n",
|
||||
"nest_asyncio.apply()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Using llama-parse to parse a PDF"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Download complete.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Grab a PDF from Arxiv for indexing\n",
|
||||
"import requests \n",
|
||||
"\n",
|
||||
"# The URL of the file you want to download\n",
|
||||
"url = \"https://arxiv.org/pdf/1706.03762.pdf\"\n",
|
||||
"# The local path where you want to save the file\n",
|
||||
"file_path = \"./attention.pdf\"\n",
|
||||
"\n",
|
||||
"# Perform the HTTP request\n",
|
||||
"response = requests.get(url)\n",
|
||||
"\n",
|
||||
"# Check if the request was successful\n",
|
||||
"if response.status_code == 200:\n",
|
||||
" # Open the file in binary write mode and save the content\n",
|
||||
" with open(file_path, \"wb\") as file:\n",
|
||||
" file.write(response.content)\n",
|
||||
" print(\"Download complete.\")\n",
|
||||
"else:\n",
|
||||
" print(\"Error downloading the file.\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Started parsing the file under job_id ba637beb-157c-4082-9f83-621d97fec6f8\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from llama_parse import LlamaParse\n",
|
||||
"\n",
|
||||
"documents = LlamaParse(result_type=\"text\").load_data(file_path)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"' (shifted right)\\n Figure 1: The Transformer - model architecture.\\nThe Transformer follows this overall architecture using stacked self-attention and point-wise, fully\\nconnected layers for both the encoder and decoder, shown in the left and right halves of Figure 1,\\nrespectively.\\n3.1 Encoder and Decoder Stacks\\nEncoder: The encoder is composed of a stack of N = 6 identical layers. Each layer has two\\nsub-layers. The first is a multi-head self-attention mechanism, and the second is a simple, position-\\nwise fully connected feed-forward network. We employ a residual connection [11] around each of\\nthe two sub-layers, followed by layer normalization [1]. That is, the output of each sub-layer is\\nLayerNorm(x + Sublayer(x)), where Sublayer(x) is the function implemented by the sub-layer\\nitself. To facilitate these residual connections, all sub-layers in the model, as well as the embedding\\nlayers, produce outputs of'"
|
||||
]
|
||||
},
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Take a quick look at some of the parsed text from the document:\n",
|
||||
"documents[0].get_content()[10000:11000]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Storing into Astra DB"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from llama_index.vector_stores.astra import AstraDBVectorStore\n",
|
||||
"\n",
|
||||
"astra_db_store = AstraDBVectorStore(\n",
|
||||
" token=token,\n",
|
||||
" api_endpoint=api_endpoint,\n",
|
||||
" collection_name=\"astra_v_table_llamaparse\",\n",
|
||||
" embedding_dimension=1536\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from llama_index.core.node_parser import SimpleNodeParser\n",
|
||||
"from llama_index.llms.openai import OpenAI\n",
|
||||
"\n",
|
||||
"node_parser = SimpleNodeParser()\n",
|
||||
"\n",
|
||||
"nodes = node_parser.get_nodes_from_documents(documents)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from llama_index.embeddings.openai import OpenAIEmbedding\n",
|
||||
"from llama_index.core import VectorStoreIndex, StorageContext, ServiceContext\n",
|
||||
"\n",
|
||||
"storage_context = StorageContext.from_defaults(vector_store=astra_db_store)\n",
|
||||
"\n",
|
||||
"service_context = ServiceContext.from_defaults(\n",
|
||||
" llm=OpenAI(model=\"gpt-4\"), \n",
|
||||
" embed_model=OpenAIEmbedding(), \n",
|
||||
" chunk_size=512,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"index = VectorStoreIndex(nodes=nodes, storage_context=storage_context)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Simple RAG Example"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"query_engine = index.as_query_engine(similarity_top_k=15, service_context=service_context)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 15,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\n",
|
||||
"***********New LlamaParse+ Basic Query Engine***********\n",
|
||||
"Multi-Head Attention is also known as an attention function that linearly projects the queries, keys and values multiple times with different, learned linear projections to different dimensions. This allows the attention function to be performed in parallel on each of these projected versions of queries, keys and values.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"query = \"What is Multi-Head Attention also known as?\"\n",
|
||||
"\n",
|
||||
"response_1 = query_engine.query(query)\n",
|
||||
"print(\"\\n***********New LlamaParse+ Basic Query Engine***********\")\n",
|
||||
"print(response_1)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'We used beam search as described in the previous section, but no\\ncheckpoint averaging. We present these results in Table 3.\\nIn Table 3 rows (A), we vary the number of attention heads and the attention key and value dimensions,\\nkeeping the amount of computation constant, as described in Section 3.2.2. While single-head\\nattention is 0.9 BLEU worse than the best setting, quality also drops off with too many heads.\\nIn Table 3 rows (B), we observe that reducing the attention key size dk hurts model quality. This\\nsuggests that determining compatibility is not easy and that a more sophisticated compatibility\\nfunction than dot product may be beneficial. We further observe in rows (C) and (D) that, as expected,\\nbigger models are better, and dropout is very helpful in avoiding over-fitting. In row (E) we replace our\\nsinusoidal positional encoding with learned positional embeddings [9], and observe nearly identical\\nresults to the base model.\\n6.3 English Constituency Parsing\\nTo evaluate if the Transformer can generalize to other tasks we performed experiments on English\\nconstituency parsing. This task presents specific challenges: the output is subject to strong structural\\nconstraints and is significantly longer than the input. Furthermore, RNN sequence-to-sequence\\nmodels have not been able to attain state-of-the-art results in small-data regimes [37].\\nWe trained a 4-layer transformer with dmodel = 1024 on the Wall Street Journal (WSJ) portion of the\\nPenn Treebank [25], about 40K training sentences. We also trained it in a semi-supervised setting,\\nusing the larger high-confidence and BerkleyParser corpora from with approximately 17M sentences\\n[37]. We used a vocabulary of 16K tokens for the WSJ only setting and a vocabulary of 32K tokens\\nfor the semi-supervised setting.\\nWe performed only a small number of experiments to select the dropout, both attention and residual\\n(section 5.4), learning rates and beam size on the Section 22 development set, all other parameters\\nremained unchanged from the English-to-German base translation model. During inference, we\\n 9\\n---\\nTable 4: The Transformer generalizes well to English constituency parsing (Results are on Section 23\\nof WSJ)\\n Parser Training WSJ 23 F1\\n Vinyals & Kaiser el al. (2014) [37] WSJ only, discriminative 88.3\\n Petrov et al. (2006) [29] WSJ only, discriminative 90.4\\n Zhu et al. (2013) [40] WSJ only, discriminative 90.4\\n Dyer et al. (2016) [8] WSJ only, discriminative 91.7\\n Transformer (4 layers) WSJ only, discriminative 91.3\\n Zhu et al. (2013) [40] semi-supervised 91.3\\n Huang & Harper (2009) [14] semi-supervised 91.3\\n McClosky et al. (2006) [26] semi-supervised 92.1\\n Vinyals & Kaiser el al. (2014) [37] semi-supervised 92.1\\n Transformer (4 layers) semi-supervised 92.7\\n Luong et al. (2015) [23] multi-task 93.0\\n Dyer et al. (2016) [8] generative 93.3\\nincreased the maximum output length to input length + 300. We used a beam size of 21 and α = 0.3\\nfor both WSJ only and the semi-supervised setting.\\nOur results in Table 4 show that despite the lack of task-specific tuning our model performs sur-\\nprisingly well, yielding better results than all previously reported models with the exception of the\\nRecurrent Neural Network Grammar [8].\\nIn contrast to RNN sequence-to-sequence models [37], the Transformer outperforms the Berkeley-\\nParser [29] even when training only on the WSJ training set of 40K sentences.\\n7 Conclusion\\nIn this work, we presented the Transformer, the first sequence transduction model based entirely on\\nattention, replacing the recurrent layers most commonly used in encoder-decoder architectures with\\nmulti-headed self-attention.\\nFor translation tasks, the Transformer can be trained significantly faster than architectures based\\non recurrent or convolutional layers.'"
|
||||
]
|
||||
},
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Take a look at one of the source nodes from the response\n",
|
||||
"response_1.source_nodes[0].get_content()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 18,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\n",
|
||||
"***********New LlamaParse+ Basic Query Engine***********\n",
|
||||
"The context does not provide information about the color of the sky.\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Query fails to be answered due to lack of context in Astra DB\n",
|
||||
"query = \"What is the color of the sky?\"\n",
|
||||
"\n",
|
||||
"response_1 = query_engine.query(query)\n",
|
||||
"print(\"\\n***********New LlamaParse+ Basic Query Engine***********\")\n",
|
||||
"print(response_1)"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.10.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
+91
-52
@@ -4,13 +4,16 @@ import httpx
|
||||
import mimetypes
|
||||
import time
|
||||
from enum import Enum
|
||||
from typing import List, Optional
|
||||
from typing import List, Optional, Union
|
||||
|
||||
from llama_index.core.async_utils import run_jobs
|
||||
from llama_index.core.bridge.pydantic import Field, validator
|
||||
from llama_index.core.constants import DEFAULT_BASE_URL
|
||||
from llama_index.core.readers.base import BasePydanticReader
|
||||
from llama_index.core.schema import Document
|
||||
|
||||
nest_asyncio_err = "cannot be called from a running event loop"
|
||||
nest_asyncio_msg = "The event loop is already running. Add `import nest_asyncio; nest_asyncio.apply()` to your code to fix this issue."
|
||||
|
||||
class ResultType(str, Enum):
|
||||
"""The result type for the parser."""
|
||||
@@ -30,6 +33,12 @@ class LlamaParse(BasePydanticReader):
|
||||
result_type: ResultType = Field(
|
||||
default=ResultType.TXT, description="The result type for the parser."
|
||||
)
|
||||
num_workers: int = Field(
|
||||
default=4,
|
||||
gt=0,
|
||||
lt=10,
|
||||
description="The number of workers to use sending API requests for parsing."
|
||||
)
|
||||
check_interval: int = Field(
|
||||
default=1,
|
||||
description="The interval in seconds to check if the parsing is done.",
|
||||
@@ -60,65 +69,95 @@ class LlamaParse(BasePydanticReader):
|
||||
url = os.getenv("LLAMA_CLOUD_BASE_URL", None)
|
||||
return url or v or DEFAULT_BASE_URL
|
||||
|
||||
def load_data(self, file_path: str, extra_info: Optional[dict] = None) -> List[Document]:
|
||||
async def _aload_data(self, file_path: str, extra_info: Optional[dict] = None) -> List[Document]:
|
||||
"""Load data from the input path."""
|
||||
return asyncio.run(self.aload_data(file_path, extra_info))
|
||||
try:
|
||||
file_path = str(file_path)
|
||||
if not file_path.endswith(".pdf"):
|
||||
raise Exception("Currently, only PDF files are supported.")
|
||||
|
||||
async def aload_data(self, file_path: str, extra_info: Optional[dict] = None) -> List[Document]:
|
||||
"""Load data from the input path."""
|
||||
file_path = str(file_path)
|
||||
if not file_path.endswith(".pdf"):
|
||||
raise Exception("Currently, only PDF files are supported.")
|
||||
extra_info = extra_info or {}
|
||||
extra_info["file_path"] = file_path
|
||||
|
||||
extra_info = extra_info or {}
|
||||
extra_info["file_path"] = file_path
|
||||
headers = {"Authorization": f"Bearer {self.api_key}"}
|
||||
|
||||
headers = {"Authorization": f"Bearer {self.api_key}"}
|
||||
# load data, set the mime type
|
||||
with open(file_path, "rb") as f:
|
||||
mime_type = mimetypes.guess_type(file_path)[0]
|
||||
files = {"file": (f.name, f, mime_type)}
|
||||
|
||||
# load data, set the mime type
|
||||
with open(file_path, "rb") as f:
|
||||
mime_type = mimetypes.guess_type(file_path)[0]
|
||||
files = {"file": (f.name, f, mime_type)}
|
||||
# send the request, start job
|
||||
url = f"{self.base_url}/api/parsing/upload"
|
||||
async with httpx.AsyncClient(timeout=self.max_timeout) as client:
|
||||
response = await client.post(url, files=files, headers=headers)
|
||||
if not response.is_success:
|
||||
raise Exception(f"Failed to parse the PDF file: {response.text}")
|
||||
|
||||
# send the request, start job
|
||||
url = f"{self.base_url}/api/parsing/upload"
|
||||
async with httpx.AsyncClient(timeout=self.max_timeout) as client:
|
||||
response = await client.post(url, files=files, headers=headers)
|
||||
if not response.is_success:
|
||||
raise Exception(f"Failed to parse the PDF file: {response.text}")
|
||||
# check the status of the job, return when done
|
||||
job_id = response.json()["id"]
|
||||
if self.verbose:
|
||||
print("Started parsing the file under job_id %s" % job_id)
|
||||
|
||||
result_url = f"{self.base_url}/api/parsing/job/{job_id}/result/{self.result_type.value}"
|
||||
|
||||
# check the status of the job, return when done
|
||||
job_id = response.json()["id"]
|
||||
if self.verbose:
|
||||
print("Started parsing the file under job_id %s" % job_id)
|
||||
|
||||
result_url = f"{self.base_url}/api/parsing/job/{job_id}/result/{self.result_type.value}"
|
||||
start = time.time()
|
||||
tries = 0
|
||||
while True:
|
||||
await asyncio.sleep(self.check_interval)
|
||||
async with httpx.AsyncClient(timeout=self.max_timeout) as client:
|
||||
tries += 1
|
||||
|
||||
result = await client.get(result_url, headers=headers)
|
||||
|
||||
start = time.time()
|
||||
tries = 0
|
||||
while True:
|
||||
await asyncio.sleep(self.check_interval)
|
||||
async with httpx.AsyncClient(timeout=self.max_timeout) as client:
|
||||
result = await client.get(result_url, headers=headers)
|
||||
if result.status_code == 404:
|
||||
end = time.time()
|
||||
if end - start > self.max_timeout:
|
||||
raise Exception(
|
||||
f"Timeout while parsing the PDF file: {response.text}"
|
||||
)
|
||||
if self.verbose and tries % 10 == 0:
|
||||
print(".", end="", flush=True)
|
||||
continue
|
||||
|
||||
if result.status_code == 404:
|
||||
end = time.time()
|
||||
if end - start > self.max_timeout:
|
||||
raise Exception(
|
||||
f"Timeout while parsing the PDF file: {response.text}"
|
||||
if result.status_code == 400:
|
||||
detail = result.json().get("detail", "Unknown error")
|
||||
raise Exception(f"Failed to parse the PDF file: {detail}")
|
||||
|
||||
return [
|
||||
Document(
|
||||
text=result.json()[self.result_type.value],
|
||||
metadata=extra_info,
|
||||
)
|
||||
if self.verbose and tries % 10 == 0:
|
||||
print(".", end="", flush=True)
|
||||
continue
|
||||
]
|
||||
except Exception as e:
|
||||
print("Error while parsing the PDF file: ", e)
|
||||
return []
|
||||
|
||||
async def aload_data(self, file_path: Union[List[str], str], extra_info: Optional[dict] = None) -> List[Document]:
|
||||
"""Load data from the input path."""
|
||||
if isinstance(file_path, str):
|
||||
return await self._aload_data(file_path, extra_info=extra_info)
|
||||
elif isinstance(file_path, list):
|
||||
jobs = [self._aload_data(f, extra_info=extra_info) for f in file_path]
|
||||
try:
|
||||
results = await run_jobs(jobs, workers=self.num_workers)
|
||||
|
||||
# return flattened results
|
||||
return [item for sublist in results for item in sublist]
|
||||
except RuntimeError as e:
|
||||
if nest_asyncio_err in str(e):
|
||||
raise RuntimeError(nest_asyncio_msg)
|
||||
else:
|
||||
raise e
|
||||
else:
|
||||
raise ValueError("The input file_path must be a string or a list of strings.")
|
||||
|
||||
if result.status_code == 400:
|
||||
detail = result.json().get("detail", "Unknown error")
|
||||
raise Exception(f"Failed to parse the PDF file: {detail}")
|
||||
|
||||
return [
|
||||
Document(
|
||||
text=result.json()[self.result_type.value],
|
||||
metadata=extra_info,
|
||||
)
|
||||
]
|
||||
tries += 1
|
||||
def load_data(self, file_path: Union[List[str], str], extra_info: Optional[dict] = None) -> List[Document]:
|
||||
"""Load data from the input path."""
|
||||
try:
|
||||
return asyncio.run(self.aload_data(file_path, extra_info))
|
||||
except RuntimeError as e:
|
||||
if nest_asyncio_err in str(e):
|
||||
raise RuntimeError(nest_asyncio_msg)
|
||||
else:
|
||||
raise e
|
||||
Generated
+13
-24
@@ -1,4 +1,4 @@
|
||||
# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
|
||||
# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "aiohttp"
|
||||
@@ -126,13 +126,13 @@ typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""}
|
||||
|
||||
[[package]]
|
||||
name = "anyio"
|
||||
version = "4.2.0"
|
||||
version = "4.3.0"
|
||||
description = "High level compatibility layer for multiple asynchronous event loop implementations"
|
||||
optional = false
|
||||
python-versions = ">=3.8"
|
||||
files = [
|
||||
{file = "anyio-4.2.0-py3-none-any.whl", hash = "sha256:745843b39e829e108e518c489b31dc757de7d2131d53fac32bd8df268227bfee"},
|
||||
{file = "anyio-4.2.0.tar.gz", hash = "sha256:e1875bb4b4e2de1669f4bc7869b6d3f54231cdced71605e6e64c9be77e3be50f"},
|
||||
{file = "anyio-4.3.0-py3-none-any.whl", hash = "sha256:048e05d0f6caeed70d731f3db756d35dcc1f35747c8c403364a8332c630441b8"},
|
||||
{file = "anyio-4.3.0.tar.gz", hash = "sha256:f75253795a87df48568485fd18cdd2a3fa5c4f7c5be8e5e36637733fce06fed6"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -992,13 +992,13 @@ test = ["ipykernel", "pre-commit", "pytest", "pytest-cov", "pytest-timeout"]
|
||||
|
||||
[[package]]
|
||||
name = "llama-index-core"
|
||||
version = "0.10.6.post1"
|
||||
version = "0.10.7"
|
||||
description = "Interface between LLMs and your data"
|
||||
optional = false
|
||||
python-versions = ">=3.8.1,<4.0"
|
||||
files = [
|
||||
{file = "llama_index_core-0.10.6.post1-py3-none-any.whl", hash = "sha256:22c24c3c6d3deae280cadf6785b35a2565bbd23e1eb7cb53d73c6b9e6fae624a"},
|
||||
{file = "llama_index_core-0.10.6.post1.tar.gz", hash = "sha256:8ac99640e85da303933ca862d3846e1d400087e109749042357be355f5931fb6"},
|
||||
{file = "llama_index_core-0.10.7-py3-none-any.whl", hash = "sha256:0dd1ec2878451d75d4644757cc24c8533d83a6c62ffa2ac0a4f1745a31cbb1ad"},
|
||||
{file = "llama_index_core-0.10.7.tar.gz", hash = "sha256:d02f92128ce285110e953ed116a3db1ba02eec508d11ccdca14a851ece5eaead"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -1008,7 +1008,7 @@ deprecated = ">=1.2.9.3"
|
||||
dirtyjson = ">=1.0.8,<2.0.0"
|
||||
fsspec = ">=2023.5.0"
|
||||
httpx = "*"
|
||||
llamaindex-py-client = ">=0.1.12"
|
||||
llamaindex-py-client = ">=0.1.13,<0.2.0"
|
||||
nest-asyncio = ">=1.5.8,<2.0.0"
|
||||
networkx = ">=3.0"
|
||||
nltk = ">=3.8.1,<4.0.0"
|
||||
@@ -1035,13 +1035,13 @@ query-tools = ["guidance (>=0.0.64,<0.0.65)", "jsonpath-ng (>=1.6.0,<2.0.0)", "l
|
||||
|
||||
[[package]]
|
||||
name = "llamaindex-py-client"
|
||||
version = "0.1.12"
|
||||
version = "0.1.13"
|
||||
description = ""
|
||||
optional = false
|
||||
python-versions = ">=3.8,<4.0"
|
||||
files = [
|
||||
{file = "llamaindex_py_client-0.1.12-py3-none-any.whl", hash = "sha256:7e6008cf9dad6548340be579bbacf3177119a7a971bc60ce20a68c1a1f3242c7"},
|
||||
{file = "llamaindex_py_client-0.1.12.tar.gz", hash = "sha256:32e025240553f31a968c075d518f81879d05c9e44986003c37502024bb95d035"},
|
||||
{file = "llamaindex_py_client-0.1.13-py3-none-any.whl", hash = "sha256:02400c90655da80ae373e0455c829465208607d72462f1898fd383fdfe8dabce"},
|
||||
{file = "llamaindex_py_client-0.1.13.tar.gz", hash = "sha256:3bd9b435ee0a78171eba412dea5674d813eb5bf36e577d3c7c7e90edc54900d9"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@@ -1837,6 +1837,7 @@ files = [
|
||||
{file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"},
|
||||
{file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"},
|
||||
{file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"},
|
||||
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"},
|
||||
{file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"},
|
||||
{file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"},
|
||||
{file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"},
|
||||
@@ -2130,48 +2131,36 @@ python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "SQLAlchemy-2.0.27-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d04e579e911562f1055d26dab1868d3e0bb905db3bccf664ee8ad109f035618a"},
|
||||
{file = "SQLAlchemy-2.0.27-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fa67d821c1fd268a5a87922ef4940442513b4e6c377553506b9db3b83beebbd8"},
|
||||
{file = "SQLAlchemy-2.0.27-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6c7a596d0be71b7baa037f4ac10d5e057d276f65a9a611c46970f012752ebf2d"},
|
||||
{file = "SQLAlchemy-2.0.27-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:954d9735ee9c3fa74874c830d089a815b7b48df6f6b6e357a74130e478dbd951"},
|
||||
{file = "SQLAlchemy-2.0.27-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:5cd20f58c29bbf2680039ff9f569fa6d21453fbd2fa84dbdb4092f006424c2e6"},
|
||||
{file = "SQLAlchemy-2.0.27-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:03f448ffb731b48323bda68bcc93152f751436ad6037f18a42b7e16af9e91c07"},
|
||||
{file = "SQLAlchemy-2.0.27-cp310-cp310-win32.whl", hash = "sha256:d997c5938a08b5e172c30583ba6b8aad657ed9901fc24caf3a7152eeccb2f1b4"},
|
||||
{file = "SQLAlchemy-2.0.27-cp310-cp310-win_amd64.whl", hash = "sha256:eb15ef40b833f5b2f19eeae65d65e191f039e71790dd565c2af2a3783f72262f"},
|
||||
{file = "SQLAlchemy-2.0.27-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6c5bad7c60a392850d2f0fee8f355953abaec878c483dd7c3836e0089f046bf6"},
|
||||
{file = "SQLAlchemy-2.0.27-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a3012ab65ea42de1be81fff5fb28d6db893ef978950afc8130ba707179b4284a"},
|
||||
{file = "SQLAlchemy-2.0.27-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dbcd77c4d94b23e0753c5ed8deba8c69f331d4fd83f68bfc9db58bc8983f49cd"},
|
||||
{file = "SQLAlchemy-2.0.27-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d177b7e82f6dd5e1aebd24d9c3297c70ce09cd1d5d37b43e53f39514379c029c"},
|
||||
{file = "SQLAlchemy-2.0.27-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:680b9a36029b30cf063698755d277885d4a0eab70a2c7c6e71aab601323cba45"},
|
||||
{file = "SQLAlchemy-2.0.27-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1306102f6d9e625cebaca3d4c9c8f10588735ef877f0360b5cdb4fdfd3fd7131"},
|
||||
{file = "SQLAlchemy-2.0.27-cp311-cp311-win32.whl", hash = "sha256:5b78aa9f4f68212248aaf8943d84c0ff0f74efc65a661c2fc68b82d498311fd5"},
|
||||
{file = "SQLAlchemy-2.0.27-cp311-cp311-win_amd64.whl", hash = "sha256:15e19a84b84528f52a68143439d0c7a3a69befcd4f50b8ef9b7b69d2628ae7c4"},
|
||||
{file = "SQLAlchemy-2.0.27-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:0de1263aac858f288a80b2071990f02082c51d88335a1db0d589237a3435fe71"},
|
||||
{file = "SQLAlchemy-2.0.27-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ce850db091bf7d2a1f2fdb615220b968aeff3849007b1204bf6e3e50a57b3d32"},
|
||||
{file = "SQLAlchemy-2.0.27-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8dfc936870507da96aebb43e664ae3a71a7b96278382bcfe84d277b88e379b18"},
|
||||
{file = "SQLAlchemy-2.0.27-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c4fbe6a766301f2e8a4519f4500fe74ef0a8509a59e07a4085458f26228cd7cc"},
|
||||
{file = "SQLAlchemy-2.0.27-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:4535c49d961fe9a77392e3a630a626af5baa967172d42732b7a43496c8b28876"},
|
||||
{file = "SQLAlchemy-2.0.27-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:0fb3bffc0ced37e5aa4ac2416f56d6d858f46d4da70c09bb731a246e70bff4d5"},
|
||||
{file = "SQLAlchemy-2.0.27-cp312-cp312-win32.whl", hash = "sha256:7f470327d06400a0aa7926b375b8e8c3c31d335e0884f509fe272b3c700a7254"},
|
||||
{file = "SQLAlchemy-2.0.27-cp312-cp312-win_amd64.whl", hash = "sha256:f9374e270e2553653d710ece397df67db9d19c60d2647bcd35bfc616f1622dcd"},
|
||||
{file = "SQLAlchemy-2.0.27-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e97cf143d74a7a5a0f143aa34039b4fecf11343eed66538610debc438685db4a"},
|
||||
{file = "SQLAlchemy-2.0.27-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7b5a3e2120982b8b6bd1d5d99e3025339f7fb8b8267551c679afb39e9c7c7f1"},
|
||||
{file = "SQLAlchemy-2.0.27-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e36aa62b765cf9f43a003233a8c2d7ffdeb55bc62eaa0a0380475b228663a38f"},
|
||||
{file = "SQLAlchemy-2.0.27-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:5ada0438f5b74c3952d916c199367c29ee4d6858edff18eab783b3978d0db16d"},
|
||||
{file = "SQLAlchemy-2.0.27-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:b1d9d1bfd96eef3c3faedb73f486c89e44e64e40e5bfec304ee163de01cf996f"},
|
||||
{file = "SQLAlchemy-2.0.27-cp37-cp37m-win32.whl", hash = "sha256:ca891af9f3289d24a490a5fde664ea04fe2f4984cd97e26de7442a4251bd4b7c"},
|
||||
{file = "SQLAlchemy-2.0.27-cp37-cp37m-win_amd64.whl", hash = "sha256:fd8aafda7cdff03b905d4426b714601c0978725a19efc39f5f207b86d188ba01"},
|
||||
{file = "SQLAlchemy-2.0.27-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ec1f5a328464daf7a1e4e385e4f5652dd9b1d12405075ccba1df842f7774b4fc"},
|
||||
{file = "SQLAlchemy-2.0.27-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ad862295ad3f644e3c2c0d8b10a988e1600d3123ecb48702d2c0f26771f1c396"},
|
||||
{file = "SQLAlchemy-2.0.27-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:48217be1de7d29a5600b5c513f3f7664b21d32e596d69582be0a94e36b8309cb"},
|
||||
{file = "SQLAlchemy-2.0.27-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e56afce6431450442f3ab5973156289bd5ec33dd618941283847c9fd5ff06bf"},
|
||||
{file = "SQLAlchemy-2.0.27-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:611068511b5531304137bcd7fe8117c985d1b828eb86043bd944cebb7fae3910"},
|
||||
{file = "SQLAlchemy-2.0.27-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:b86abba762ecfeea359112b2bb4490802b340850bbee1948f785141a5e020de8"},
|
||||
{file = "SQLAlchemy-2.0.27-cp38-cp38-win32.whl", hash = "sha256:30d81cc1192dc693d49d5671cd40cdec596b885b0ce3b72f323888ab1c3863d5"},
|
||||
{file = "SQLAlchemy-2.0.27-cp38-cp38-win_amd64.whl", hash = "sha256:120af1e49d614d2525ac247f6123841589b029c318b9afbfc9e2b70e22e1827d"},
|
||||
{file = "SQLAlchemy-2.0.27-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d07ee7793f2aeb9b80ec8ceb96bc8cc08a2aec8a1b152da1955d64e4825fcbac"},
|
||||
{file = "SQLAlchemy-2.0.27-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:cb0845e934647232b6ff5150df37ceffd0b67b754b9fdbb095233deebcddbd4a"},
|
||||
{file = "SQLAlchemy-2.0.27-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fc19ae2e07a067663dd24fca55f8ed06a288384f0e6e3910420bf4b1270cc51"},
|
||||
{file = "SQLAlchemy-2.0.27-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b90053be91973a6fb6020a6e44382c97739736a5a9d74e08cc29b196639eb979"},
|
||||
{file = "SQLAlchemy-2.0.27-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:2f5c9dfb0b9ab5e3a8a00249534bdd838d943ec4cfb9abe176a6c33408430230"},
|
||||
{file = "SQLAlchemy-2.0.27-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:33e8bde8fff203de50399b9039c4e14e42d4d227759155c21f8da4a47fc8053c"},
|
||||
{file = "SQLAlchemy-2.0.27-cp39-cp39-win32.whl", hash = "sha256:d873c21b356bfaf1589b89090a4011e6532582b3a8ea568a00e0c3aab09399dd"},
|
||||
{file = "SQLAlchemy-2.0.27-cp39-cp39-win_amd64.whl", hash = "sha256:ff2f1b7c963961d41403b650842dc2039175b906ab2093635d8319bef0b7d620"},
|
||||
@@ -2624,4 +2613,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = ">=3.8.1,<4.0"
|
||||
content-hash = "94a0497c23840fd8172d55c9a60f382ff7392a9c4866e60fa411f221ed7af653"
|
||||
content-hash = "f31d084fb327ab8b1e6211692d11cab2f007ff1092277278ce7a7ac693961ee4"
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "llama-parse"
|
||||
version = "0.3.1"
|
||||
version = "0.3.3"
|
||||
description = "Parse files into RAG-Optimized formats."
|
||||
authors = ["Logan Markewich <logan@llamaindex.ai>"]
|
||||
license = "MIT"
|
||||
@@ -9,7 +9,7 @@ packages = [{include = "llama_parse"}]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = ">=3.8.1,<4.0"
|
||||
llama-index-core = ">=0.10.6.post1"
|
||||
llama-index-core = ">=0.10.7"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
pytest = "^8.0.0"
|
||||
|
||||
Reference in New Issue
Block a user