Skip to content

Commit

Permalink
cr
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryjliu committed May 14, 2024
1 parent 7874b84 commit 694bba3
Showing 1 changed file with 22 additions and 29 deletions.
51 changes: 22 additions & 29 deletions examples/test_tesla_impact_report/test_gpt4o.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"\n",
"The expanded vision/audio capabilities mean that it can be used for document parsing, by treating each page as an image and performing document extraction. We support using GPT-4o natively in LlamaParse for document parsing. The notebook below walks you through an example of using GPT-4o over the Tesla impact report.\n",
"\n",
"**NOTE**: The pricing for LlamaParse + gpt4o is an order more expensive than using LlamaParse by default. Currently, every page parsed with gpt4o counts for ~20 pages in the LlamaParse usage tracker.\n"
"**NOTE**: The pricing for LlamaParse + gpt4o is an order more expensive than using LlamaParse by default. Currently, every page parsed with gpt4o counts for 200 pages in the LlamaParse usage tracker.\n"
]
},
{
Expand Down Expand Up @@ -59,7 +59,7 @@
"source": [
"### Use LlamaParse with `gpt4o_mode=True`\n",
"\n",
"By turning on gpt4o, we use GPT-4o multimodal capabilities to do document parsing per page.\n",
"By turning on gpt4o, we use GPT-4o multimodal capabilities to do document parsing per page instead of the LlamaParse default pipeline.\n",
"\n",
"We load a snippet of the [2019 Tesla impact report](https://www.tesla.com/ns_videos/2019-tesla-impact-report.pdf). To help you save tokens, we only load 4 pages of this report (which will count as 800 pages of LlamaParse pages). \n",
"\n",
Expand All @@ -68,7 +68,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 22,
"id": "f46991c1-031b-461f-b9a6-9237a821f4c8",
"metadata": {
"tags": []
Expand All @@ -79,16 +79,16 @@
"\n",
"parser_gpt4o = LlamaParse(\n",
" result_type=\"markdown\",\n",
" # base_url=\"https://api.staging.llamaindex.ai\",\n",
" # api_key=api_key,\n",
" base_url=\"https://api.staging.llamaindex.ai\",\n",
" api_key=api_key,\n",
" gpt4o_mode=True,\n",
" # gpt4o_api_key=\"<gpt4o_api_key>\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 23,
"id": "1136ba82-074b-489d-9b0a-d609ccbf02b6",
"metadata": {
"tags": []
Expand All @@ -98,17 +98,18 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Started parsing the file under job_id fddc8070-833b-408a-8593-dd8b408c6aac\n"
"Started parsing the file under job_id 03b089a3-0f1b-40e9-ab73-67fa430fb329\n",
"."
]
}
],
"source": [
"documents_gpt4o = parser_gpt4o.load_data('./2019-tesla-impact-report-short-3.pdf')"
"documents_gpt4o = parser_gpt4o.load_data('./2019-tesla-impact-report-short.pdf')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 24,
"id": "9e65c54f-3e4c-4c78-b1e8-a55ebeba1f24",
"metadata": {
"tags": []
Expand All @@ -121,9 +122,9 @@
"# Impact Report\n",
"## 2019\n",
"\n",
"hello world\n",
"![Tesla Logo](https://www.tesla.com/sites/default/files/blog_images/tesla_announcement_social.jpg)\n",
"\n",
"TESLA\n",
"![Earth and Car in Space](https://www.tesla.com/sites/default/files/blog_images/tesla_announcement_social.jpg)\n",
"---\n",
"# Introduction 03\n",
"\n",
Expand Down Expand Up @@ -177,8 +178,6 @@
"Tesla aims to continue to increase the proportion of renewable energy usage at our factories in an effort to minimize the carbon footprint for every mile traveled by our products and their components in our supply chain. All of the factories that we built from the ground-up, such as Gigafactory Nevada and Gigafactory Shanghai, and our forthcoming Gigafactories in Berlin and North America, are designed from the beginning to use energy from renewable sources.\n",
"\n",
"Making a significant and lasting impact on environmental sustainability is difficult to achieve without securing financial sustainability for the long term. We generated positive Free Cash Flow (operating cash flow less capex) of more than $1 billion for the first time in 2019. We believe the notion that a sustainable future is not economically feasible is no longer valid.\n",
"\n",
"![Tesla Cars](https://example.com/tesla-cars.jpg)\n",
"---\n",
"# Mission & Tesla Ecosystem\n",
"\n",
Expand All @@ -201,13 +200,7 @@
"\n",
"*Tesla-related sectors. Source: World Resources Institute\n",
"\n",
"According to the Global Carbon project, when fully tallied, total carbon emissions from 2019 are expected to hit another record high of over 43 gigatons for the year. Energy use through electricity and heat production (31%) and transportation (16%) are significant drivers of these GHG emissions.\n",
"---\n",
"# Mission & Tesla Ecosystem\n",
"\n",
"To create an entire sustainable energy ecosystem, Tesla also manufactures a unique set of energy products that enable homeowners, businesses and utilities to produce and manage renewable energy generation, storage and consumption. Homeowners can install solar panels or Solar Roof to power their home using 100% renewable energy and then store that energy in Powerwall, which makes electricity available during peak energy-use periods and at night, while also providing power during grid outages. Meanwhile, depending on their particular requirements and the size of the project, utilities and businesses can purchase Megapack – an infinitely scalable energy storage system that provides greater control, efficiency, and reliability across the electric grid – for their energy storage needs.\n",
"\n",
"Renewable energy generation and storage are critical components of developing microgrids — an increasingly important means of delivering reliable and sustainable electricity around the world. As the deployment of Tesla’s products continues to accelerate, we can scale the adoption of renewable energy, cost-effectively modernize our aging infrastructure (while becoming less reliant on it), and improve the resilience of the electric grid to benefit everyone.\n"
"According to the Global Carbon project, when fully tallied, total carbon emissions from 2019 are expected to hit another record high of over 43 gigatons for the year. Energy use through electricity and heat production (31%) and transportation (16%) are significant drivers of these GHG emissions.\n"
]
}
],
Expand All @@ -229,7 +222,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 25,
"id": "f624e243-1878-4d87-841d-69e57360a7d9",
"metadata": {
"tags": []
Expand All @@ -246,7 +239,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 26,
"id": "d8b7c3ad-2147-448c-bcbe-3e6fcd8d5361",
"metadata": {
"tags": []
Expand All @@ -258,7 +251,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 27,
"id": "8013351a-180d-4947-9f81-513042175c19",
"metadata": {
"tags": []
Expand All @@ -270,7 +263,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 28,
"id": "795dc5c4-e122-4ff3-94d2-747fa51d5add",
"metadata": {
"tags": []
Expand All @@ -282,7 +275,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 29,
"id": "39d2e6bd-3316-49b5-9a5d-5b4b95343e5a",
"metadata": {
"tags": []
Expand Down Expand Up @@ -310,19 +303,19 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 30,
"id": "543c8b63-5cd1-47a1-a8a1-81abbfd3e52b",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"response = query_engine.query(\"What does Tesla aim to do? \") "
"response = query_engine.query(\"What does Tesla aim to do?\") "
]
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 31,
"id": "e739eabf-732b-4f59-9628-972c4bf6c857",
"metadata": {
"tags": []
Expand All @@ -332,7 +325,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Tesla aims to accelerate the world's transition to sustainable energy by creating a complete energy and transportation ecosystem that includes solar generation, energy storage, and all-electric vehicles producing zero tailpipe emissions. They focus on developing renewable energy solutions and products to reduce emissions in the transportation and energy sectors, ultimately contributing to a more sustainable future.\n"
"Tesla aims to accelerate the world's transition to sustainable energy by creating a complete energy and transportation ecosystem that includes solar generation, energy storage, and all-electric vehicles with zero tailpipe emissions.\n"
]
}
],
Expand Down

0 comments on commit 694bba3

Please sign in to comment.