Files
OpenCode 68a9071cf1 feat: reconcile local master with origin (exa/hot-platform hunters, leaks ledger, latest results)
Local branch had diverged from origin/master (sibling commits on the same base). Rewrote local history linearly on top of origin/master, folding in all local content: exa/hot-platform discovery hunters, leaks ledger, nightly sweep orchestrator, updated .gitignore and skill docs, plus the latest hunt output and vault state. Remote-only files (vault keys, channel scripts) were restored rather than dropped, so the resulting tree is a full union of both sides.
2026-08-07 12:53:47 +08:00

1 line
50 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{"repo": "ccai9012/ccai9012", "files": {"weekly_scripts/wip/week7/week7_t_doc_parsing.ipynb": {"662fc34200ac9973836b9f9764a11945d218efb2": {"t": 1786068252.8303277, "n": 47608, "h": "8081754fc0177a6f", "c": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"id\": \"e49d78db-154e-4576-953d-d6263dcf5a27\",\n \"metadata\": {},\n \"source\": [\n \"![banner](../../docs/figs/brand_identity/banner.png)\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 1,\n \"id\": \"8546b8f8-1819-419a-8cda-fe93f852f1c2\",\n \"metadata\": {},\n \"outputs\": [\n {\n \"name\": \"stderr\",\n \"output_type\": \"stream\",\n \"text\": [\n \"/opt/anaconda3/envs/ccai9012_check/lib/python3.12/site-packages/torch/amp/autocast_mode.py:270: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling\\n\",\n \" warnings.warn(\\n\"\n ]\n }\n ],\n \"source\": [\n \"from ccai9012 import llm_utils\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 2,\n \"id\": \"0ef5c8a1-2ee0-43b8-b7f3-cb68c7cba697\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"import pandas as pd\\n\",\n \"import os\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"1d1c3b0e-7d45-43c6-806a-2f1c5a4f80e1\",\n \"metadata\": {},\n \"source\": [\n \"## Initilize and test LLM\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 3,\n \"id\": \"1e3e75cb-e067-4361-8932-3b28996e466c\",\n \"metadata\": {},\n \"outputs\": [\n {\n \"name\": \"stdin\",\n \"output_type\": \"stream\",\n \"text\": [\n \"Enter your DEEPSEEK_API_KEY: ········\\n\"\n ]\n }\n ],\n \"source\": [\n \"# Initialize LLM\\n\",\n \"api_key = llm_utils.get_deepseek_api_key()\\n\",\n \"llm = llm_utils.initialize_llm()\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 4,\n \"id\": \"52402d4c-3df5-4b09-9f71-83152dbd22fd\",\n \"metadata\": {},\n \"outputs\": [\n {\n \"name\": \"stdout\",\n \"output_type\": \"stream\",\n \"text\": [\n \"\\n\",\n \"📌 Prompt:\\n\",\n \"['Is 9.9 or 9.11 bigger?']\\n\",\n \"\\n\",\n \"Let's compare the two numbers: \\n\",\n \"\\n\",\n \"**9.9** means \\\\( 9 + \\\\frac{9}{10} = 9.90 \\\\) \\n\",\n \"**9.11** means \\\\( 9 + \\\\frac{11}{100} = 9.11 \\\\) \\n\",\n \"\\n\",\n \"Now compare digit by digit: \\n\",\n \"- Both have 9 before the decimal. \\n\",\n \"- Tenths digit: 9.9 has **9** in the tenths place, 9.11 has **1** in the tenths place. \\n\",\n \"\\n\",\n \"Since \\\\( 9 > 1 \\\\), we don't need to check further. \\n\",\n \"\\n\",\n \"\\\\[\\n\",\n \"9.90 > 9.11\\n\",\n \"\\\\]\\n\",\n \"\\n\",\n \"**Answer:** 9.9 is bigger than 9.11.\\n\",\n \"\\n\"\n ]\n }\n ],\n \"source\": [\n \"# Test connection\\n\",\n \"test = [\\\"Is 9.9 or 9.11 bigger?\\\"]\\n\",\n \"llm_utils.ask_llm(test)\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"54946522-47be-41a5-9f98-86bbe1d16da5\",\n \"metadata\": {},\n \"source\": [\n \"## Sparse and embedding the document\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 9,\n \"id\": \"f595ee1a-0162-4e96-9505-fb3886a4e84b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"retriever = llm_utils.build_pdf_retriever(\\n\",\n \" pdf_path=\\\"../../starter_kits/2_llm_structure_output/pdf_extraction/data/1526439.pdf\\\",\\n\",\n \" embedding_model_name=\\\"BAAI/bge-base-en-v1.5\\\"\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"24a35e8e-4672-4e2e-96f2-98fc066d7c5c\",\n \"metadata\": {},\n \"source\": [\n \"## Summarize the document\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 10,\n \"id\": \"21af9628-dc00-4835-b273-51f04e1f82cf\",\n \"metadata\": {\n \"scrolled\": true\n },\n \"outputs\": [\n {\n \"name\": \"stdout\",\n \"output_type\": \"stream\",\n \"text\": [\n \"\\n\",\n \"--- Final Answer ---\\n\",\n \"Based on the provided context, here is a summary of the location, main objectives, actions, and stakeholders described in the Aniak Energy Action Plan 2019.\\n\",\n \"\\n\",\n \"**Location:**\\n\",\n \"The project is focused on the community of **Aniak, Alaska**. The plan specifically targets seven tribal buildings owned by the Aniak Traditional Council.\\n\",\n \"\\n\",\n \"**Main Objectives:**\\n\",\n \"The primary goal of the project is to create an **Energy Action Plan** for tribal buildings with the aim of making them:\\n\",\n \"* Safer\\n\",\n \"* More comfortable\\n\",\n \"* More energy-efficient\\n\",\n \"The plan is designed to serve as a foundational document to guide future building retrofit projects.\\n\",\n \"\\n\",\n \"**Key Actions (Project Steps):**\\n\",\n \"The project followed a structured procedure:\\n\",\n \"1. **Project Initiation:** Meeting with the Tribe to discuss goals and select buildings.\\n\",\n \"2. **Data Collection:** Gathering baseline energy, occupancy, and maintenance data for each building.\\n\",\n \"3. **Monitoring Plan:** Creating a plan to track building improvements over time.\\n\",\n \"4. **Energy Audits:** Conducting on-site assessments of each building to identify efficiency measures.\\n\",\n \"5. **Plan Drafting:** Preparing a draft Energy Action Plan summarizing audit findings and adding actionable steps for retrofits.\\n\",\n \"6. **Review & Revision:** Presenting the draft to the Tribe for feedback and finalizing the plan.\\n\",\n \"7. **Outreach:** Publicizing the project's goals and outcomes to the community and at conferences.\\n\",\n \"\\n\",\n \"**Stakeholders:**\\n\",\n \"* **Aniak Traditional Council:** The tribal government and primary project partner, which selected buildings, set goals, and provided feedback.\\n\",\n \"* **Cold Climate Housing Research Center (CCHRC):** The lead organization coordinating the project, assisting with grant management, data collection, and plan development.\\n\",\n \"* **Energy Audits of Alaska:** The contractor responsible for conducting the on-site energy assessments of the buildings.\\n\",\n \"* **Building Staff & Occupants:** Interviewed for baseline data and involved in creating monitoring and maintenance plans.\\n\",\n \"* **Nuvista Electric Light & Power / CEMAI (Bertha Prince):** A regional energy coordinator consulted to align with other energy projects in the area.\\n\",\n \"* **U.S. Department of Energy, Office of Indian Energy:** The funding agency for the project, which received progress reports and presentations.\\n\",\n \"* **Community of Aniak:** The broader audience for outreach materials and the ultimate beneficiaries of improved tribal buildings.\\n\",\n \"\\n\",\n \"-------------------- Document 1 --------------------\\n\",\n \"9\\n\",\n \"www.cchrc.orgAniak Energy Action Plan 2019\\n\",\n \"TABLE OF CONTENTS\\n\",\n \"Acknowledgement of federal support 04 \\n\",\n \"D i s c l a i m e r 0 5\\n\",\n \"List of acronyms 06\\n\",\n \"A b s t r a c t 0 7\\n\",\n \"Introduction 10\\n\",\n \"Tribal buildings 13 \\n\",\n \"Data monitoring plan 16\\n\",\n \"Baseline data 20\\n\",\n \"Energy audit summaries 24\\n\",\n \"Maintenance plan 30\\n\",\n \"Funding and training opportunities 36\\n\",\n \"Outreach 44\\n\",\n \"Conclusion 45\\n\",\n \"Works Cited 46\\n\",\n \"Appendix\\n\",\n \"A: Kick-off meeting flyer 48\\n\",\n \"B: Audit summaries of other buildings 51\\n\",\n \"C: Outreach materials 60\\n\",\n \"D: Contractor scope of work 67\\n\",\n \"\\n\",\n \"-------------------- Document 2 --------------------\\n\",\n \"The introductory chapter explains the project objective and procedure. Readers can find basic information on \\n\",\n \"the participating tribal buildings, and information on their baseline condition and data monitoring in the Tribal \\n\",\n \"buildings, Data monitoring plan, and Baseline data sections. The energy audits are summarized on page 24. The \\n\",\n \"Maintenance Plan chapter suggests a monthly checklist that maintenance personnel can use to help reduce \\n\",\n \"energy costs and improve building safety and comfort. Information on financing options for future retrofit \\n\",\n \"projects and details on how to fund and schedule training for maintenance personnel appears in the Funding \\n\",\n \"and training opportunities chapter. The Outreach chapter explains project activities that served to showcase \\n\",\n \"the objectives and results of the project to community members, Alaskans, and others. Finally, the Appendices \\n\",\n \"contain documents produced throughout the project, including flyers and resources to help with future energy \\n\",\n \"projects such as a scope of work for contractors and a summary of energy audits of other local buildings that \\n\",\n \"may participate in a community energy reduction project. \\n\",\n \"Residents of Aniak frequently take to the area’s water ways in the summer to fish for salmon to provide for their \\n\",\n \"subsistence lifestyle.\\n\",\n \"\\n\",\n \"-------------------- Document 3 --------------------\\n\",\n \"a copy of the full version in this packet. \\n\",\n \"• We are communicating with the Energy \\n\",\n \"Program Coordinator at Nuvista Electric \\n\",\n \"Light & Power / CEMAI, Bertha Prince, so \\n\",\n \"that we can coordinate with other energy \\n\",\n \"projects in the region. \\n\",\n \"PROJECT STEPS\\n\",\n \"The project is following these steps to \\n\",\n \"complete the Energy Action Plan. Below, \\n\",\n \"the finished steps appear in italics.\\n\",\n \"1. CCHRC, Energy Audits of Alaska, and \\n\",\n \"the Tribe met to talk about the project, \\n\",\n \"the Tribe’s goals, and the buildings to be \\n\",\n \"audited.\\n\",\n \"2. CCHRC and Energy Audits of Alaska \\n\",\n \"collected information and interviewed \\n\",\n \"building staff to find the baseline data for \\n\",\n \"each building.\\n\",\n \"3. CCHRC, building staff, and the Tribe \\n\",\n \"created a data monitoring plan for each \\n\",\n \"building to track building improvements.\\n\",\n \"4. Energy Audits of Alaska completed an \\n\",\n \"on-site assessment of each building.\\n\",\n \"5. CCHRC and Energy Audits of Alaska will \\n\",\n \"prepare a draft Energy Action Plan.\\n\",\n \"6. CCHRC and Energy Audits of Alaska will \\n\",\n \"present the draft Energy Action Plan to the \\n\",\n \"Tribe and listen to feedback.\\n\",\n \"7.CCHRC and Energy Audits of Alaska will \\n\",\n \"revise and finalize the plan.\\n\",\n \"8. CCHRC and Energy Audits of Alaska will \\n\",\n \"provide the final plan to the Tribe.\\n\",\n \"Aniak Energy Efficiency Project\\n\",\n \"Cold Climate Housing Research Center | 907 - 457 - 3454 | www.cchrc.org\\n\",\n \"May 2018\\n\",\n \"\\n\",\n \"-------------------- Document 4 --------------------\\n\",\n \"complete the Energy Action Plan.\\n\",\n \"1. CCHRC, Energy Audits of Alaska, and \\n\",\n \"the Tribe meet to talk about the project, the \\n\",\n \"Tribe’s goals, and the buildings to be audited.\\n\",\n \"2. CCHRC and Energy Audits of Alaska will \\n\",\n \"collect information and interview building \\n\",\n \"staff to find the baseline data for each \\n\",\n \"building.\\n\",\n \"3. CCHRC will work with building staff and the \\n\",\n \"Tribe to write a data monitoring plan for each \\n\",\n \"building to track building improvements.\\n\",\n \"4. Energy Audits of Alaska will complete an \\n\",\n \"on-site assessment of each building.\\n\",\n \"5. CCHRC and Energy Audits of Alaska will \\n\",\n \"prepare a draft Energy Action Plan.\\n\",\n \"6. CCHRC and Energy Audits of Alaska will \\n\",\n \"present the draft Energy Action Plan to the \\n\",\n \"Tribe and listen to feedback.\\n\",\n \"7.CCHRC and Energy Audits of Alaska will \\n\",\n \"revise and finalize the plan.\\n\",\n \"8. CCHRC and Energy Audits of Alaska will \\n\",\n \"provide the final plan to the Tribe.\\n\",\n \"Throughout the project, CCHRC can help \\n\",\n \"with meeting the grant requirements, such as \\n\",\n \"writing quarterly progress reports, preparing \\n\",\n \"the final report, and creating outreach \\n\",\n \"materials.\\n\",\n \"Aniak Energy Efficiency Project\\n\",\n \"Cold Climate Housing Research Center | 907 - 457 - 3454 | www.cchrc.org\\n\",\n \"\\n\",\n \"-------------------- Document 5 --------------------\\n\",\n \"on the building features and energy use, benchmark information comparing the building’s energy \\n\",\n \"consumption to other buildings with similar size, use, and occupancy, and most importantly, a list of energy \\n\",\n \"efficiency measures ranked by priority. The audits also suggest energy conservation measures that can be \\n\",\n \"implemented by maintenance staff with little or no cost.\\n\",\n \"Develop draft Energy Action Plan: This document, the Energy Action Plan, builds on the energy audits of \\n\",\n \"the tribal buildings. The objective of the Energy Action Plan is both to summarize the recommendations of \\n\",\n \"the energy audits and to add actionable steps to help lead to and guide future retrofit projects. To create \\n\",\n \"the Energy Action Plan, staff communicated with representatives of the Tribe and consulted with experts \\n\",\n \"throughout Alaska to identify training and financing opportunities, regional resources, and best practices \\n\",\n \"for retrofit projects.\\n\",\n \"\\n\",\n \"-------------------- Document 6 --------------------\\n\",\n \"Cold Climate Housing Research Center\\n\",\n \"12\\n\",\n \"www.cchrc.org Aniak Energy Action Plan 2019\\n\",\n \"Final project team meeting: In September 2018, the Aniak Traditional Council reviewed a draft of the \\n\",\n \"Energy Action Plan with project staff. They revisited project goals to ensure the Energy Action Plans \\n\",\n \"addressed them adequately, and suggested revisions where appropriate. The Council then considered next \\n\",\n \"steps following the conclusion of the project.\\n\",\n \"Final Energy Action Plan: Project staff incorporated suggestions of the Traditional Council and other \\n\",\n \"reviewers to create a final Energy Action Plan for the Aniak Energy Efficiency Project.\\n\",\n \"Outreach: Throughout the project, Council members, tribal administrative staff, and project team members \\n\",\n \"performed outreach activities to publicize the goals, steps, and outcomes of the project. The outreach \\n\",\n \"included a presentation at the United States Department of Energy Office of Indian Energy Program \\n\",\n \"Reviews in 2017 and 2018, as well as flyers and a video advertising the project in the community.\\n\",\n \"Document overview\\n\",\n \"This report contains the objective, procedure, and a summary of the building energy audits of the Aniak Energy \\n\",\n \"Efficiency Project. In addition, other chapters supplement the audit recommendations in order to help facilitate \\n\",\n \"audit recommendations and future energy projects to be undertaken by the Aniak Traditional Council.\\n\",\n \"The introductory chapter explains the project objective and procedure. Readers can find basic information on\\n\",\n \"\\n\",\n \"-------------------- Document 7 --------------------\\n\",\n \"Cold Climate Housing Research Center\\n\",\n \"61\\n\",\n \"www.cchrc.orgAniak Energy Action Plan 2019\\n\",\n \"PROJECT GOAL\\n\",\n \"The goal of this project is to create an \\n\",\n \"Energy Action Plan for tribal buildings, \\n\",\n \"which will give details on making buildings \\n\",\n \"safer, more comfortable, and more energy \\n\",\n \"efficient. \\n\",\n \"MAY 2018 UPDATE\\n\",\n \"This project is approximately halfway \\n\",\n \"complete. After the visit to Aniak in January \\n\",\n \"2018, CCHRC and Energy Audits of Alaska \\n\",\n \"have been working on a draft of the Energy \\n\",\n \"Action Plan. We anticipate completing a \\n\",\n \"draft of this Plan near the end of summer \\n\",\n \"and are hoping to visit to present it to the \\n\",\n \"Council in late summer or early fall.\\n\",\n \"• Daisy Phillips gave a presentation \\n\",\n \"about the project to the Department \\n\",\n \"of Energy at a conference in Denver, \\n\",\n \"Colorado in November 2017. \\n\",\n \"• Haley Nelson and Daisy Phillips \\n\",\n \"collected baseline energy data on \\n\",\n \"the buildings in the project and wrote \\n\",\n \"plans to continue to track the data. \\n\",\n \"• We submitted two quarterly reports to \\n\",\n \"the Department of Energy on the project \\n\",\n \"progress, one for October - December \\n\",\n \"2017 and one for January - March 2018. \\n\",\n \"Both of these reports are in this packet. \\n\",\n \"• Energy Audits of Alaska completed an \\n\",\n \"initial assessment of the tribal buildings \\n\",\n \"in the project. This is summarized on \\n\",\n \"the back page of this flyer and there is \\n\",\n \"a copy of the full version in this packet. \\n\",\n \"• We are communicating with the Energy \\n\",\n \"Program Coordinator at Nuvista Electric \\n\",\n \"Light & Power / CEMAI, Bertha Prince, so\\n\",\n \"\\n\",\n \"-------------------- Document 8 --------------------\\n\",\n \"Cold Climate Housing Research Center\\n\",\n \"11\\n\",\n \"www.cchrc.orgAniak Energy Action Plan 2019\\n\",\n \"and project staff could work together to create goals for the participating buildings, collect information on their \\n\",\n \"current status and energy use, and develop the Energy Action Plan. The procedure, described below, began with \\n\",\n \"a decision on which buildings would participate in the project and concluded with the finalization of the Energy \\n\",\n \"Action Plan, a document meant to serve as a starting point for future building retrofit projects.\\n\",\n \"Decide on buildings: The Aniak Traditional Council chose seven tribal buildings to receive energy audits as \\n\",\n \"part of the project and set goals for each building.\\n\",\n \"Project kickoff meeting: In January 2018, the Aniak Traditional Council met with project staff to discuss \\n\",\n \"the overall goal of the project, the procedure, the list of buildings participating in the project and their goals \\n\",\n \"for each building. Council members provided information on the specific purpose of each building as well \\n\",\n \"as broader knowledge on past retrofit projects in Aniak, and the Council’s overall energy goals. Finally, the \\n\",\n \"Council members and project staff participated in a discussion about how to act on the recommendations \\n\",\n \"from the Energy Action Plan when this project concludes, such as how retrofits might be financed, local \\n\",\n \"staff and contractors that can perform retrofits or maintenance tasks, and how to utilize other local \\n\",\n \"resources. The flyer that guided this meeting is in Appendix A.\\n\",\n \"\\n\",\n \"-------------------- Document 9 --------------------\\n\",\n \"Cold Climate Housing Research Center\\n\",\n \"49\\n\",\n \"www.cchrc.orgAniak Energy Action Plan 2019\\n\",\n \"Project goal\\n\",\n \"The goal of this project is to create an Energy \\n\",\n \"Action Plan for Tribal buildings. The Energy \\n\",\n \"Action Plan will give details on making \\n\",\n \"buildings safer, more comfortable, and more \\n\",\n \"energy efficient. \\n\",\n \"Energy action plan\\n\",\n \"The energy action plan will contain many parts \\n\",\n \"to help start an energy retrofit project. \\n\",\n \"1. Information on each building, including \\n\",\n \"a description of the building and its current \\n\",\n \"use, and the Tribe’s goals for the future of the \\n\",\n \"building.\\n\",\n \"2. Baseline energy, occupancy, comfort, and \\n\",\n \"maintenance data for each building.\\n\",\n \"3. A data monitoring plan for each building to \\n\",\n \"track the progress of the retrofit.\\n\",\n \"4. Energy audit for each building, which includes \\n\",\n \"information about the building from an on-site \\n\",\n \"building assessment and recommendations \\n\",\n \"for improvements.\\n\",\n \"5. Timeline for the implementation of the \\n\",\n \"energy retrofit for the buildings.\\n\",\n \"6. Funding opportunities for the building \\n\",\n \"retrofits.\\n\",\n \"*7. A maintenance plan for each building.\\n\",\n \"*8. Training opportunities for building owners \\n\",\n \"and/or staff.\\n\",\n \"*9. Potential training for building occupants on \\n\",\n \"energy efficient habits.\\n\",\n \"*10. Scope of work and contractor bids.\\n\",\n \"*if applicable\\n\",\n \"Project steps\\n\",\n \"The project will follow these steps to \\n\",\n \"complete the Energy Action Plan.\\n\",\n \"1. CCHRC, Energy Audits of Alaska, and \\n\",\n \"the Tribe meet to talk about the project, the \\n\",\n \"Tribe’s goals, and the buildings to be audited.\\n\",\n \"\\n\",\n \"-------------------- Document 10 --------------------\\n\",\n \"Cold Climate Housing Research Center\\n\",\n \"22\\n\",\n \"www.cchrc.org Aniak Energy Action Plan 2019\\n\",\n \"3AVCP OFFICE 4 DUPLEX 5COMMUNITY CTR\\n\",\n \"KEY\\n\",\n \"N\\n\",\n \"ANIAK\\n\",\n \"ENERGY AND SAFETY \\n\",\n \"PRIORITIES MAP \\n\",\n \"1. Tribal office\\n\",\n \"2. VPSO office\\n\",\n \"3. AVCP office\\n\",\n \"4. Duplex\\n\",\n \"5. Community Center\\n\",\n \"6. Small farm building\\n\",\n \"7. Large farm building \\n\",\n \"Medium priority\\n\",\n \"Lowest priority\\n\",\n \"Not audited\\n\",\n \"! Safety concern\\n\",\n \"6\\n\",\n \"7\\n\",\n \"!\\n\",\n \"1\\n\",\n \"2\\n\",\n \"5\\n\",\n \"3\\n\",\n \"4\\n\",\n \"Highest priority\\n\",\n \"\\n\",\n \" Answer saved to: output/summary.txt\\n\"\n ]\n }\n ],\n \"source\": [\n \"summary = llm_utils.run_qa_chain(\\n\",\n \" query=\\\"Please summarize the location, main objectives, actions, and stakeholders described in this energy plan document.\\\",\\n\",\n \" retriever=retriever,\\n\",\n \" llm=llm,\\n\",\n \" return_sources=True,\\n\",\n \" save_path=\\\"output/summary.txt\\\"\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"15ddf3b5-3b85-4907-955e-05d7d9e03738\",\n \"metadata\": {},\n \"source\": [\n \"## Ask specific question\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 45,\n \"id\": \"36d6d94e-255b-493d-bb54-59d34a682511\",\n \"metadata\": {\n \"scrolled\": true\n },\n \"outputs\": [\n {\n \"name\": \"stdout\",\n \"output_type\": \"stream\",\n \"text\": [\n \"\\n\",\n \"--- Final Answer ---\\n\",\n \"The **Cold Climate Housing Research Center (CCHRC)** plays a key role in supporting energy efficiency and renewable energy projects in cold climates, particularly in communities like Aniak, Alaska. Based on the provided context, here are the detailed responsibilities of CCHRC in the **Aniak Energy Action Plan 2019**:\\n\",\n \"\\n\",\n \"### **Primary Responsibilities:**\\n\",\n \"1. **Project Coordination & Planning** \\n\",\n \" - Collaborates with **Energy Audits of Alaska** to develop an **Energy Action Plan** for the Aniak Tribe. \\n\",\n \" - Helps the Tribe meet grant requirements (e.g., writing quarterly progress reports, final reports, and outreach materials). \\n\",\n \"\\n\",\n \"2. **Energy Audits & Assessments** \\n\",\n \" - Works with **Energy Audits of Alaska** to conduct **on-site energy assessments** of buildings in Aniak. \\n\",\n \" - Collects **baseline data** (energy use, building conditions, occupant comfort) before audits. \\n\",\n \"\\n\",\n \"3. **Data Management & Reporting** \\n\",\n \" - Stores **baseline data** on CCHRC’s server and makes it publicly available on their website. \\n\",\n \" - Assists in tracking **building improvements** and **energy efficiency measures**. \\n\",\n \" - Uses the **Invita web portal** to monitor **building and heating appliance temperatures** via wireless thermostats. \\n\",\n \"\\n\",\n \"4. **Community Engagement & Feedback** \\n\",\n \" - Presents a **draft Energy Action Plan** to the Aniak Tribe for review. \\n\",\n \" - Incorporates feedback from the Tribe before finalizing the plan. \\n\",\n \"\\n\",\n \"5. **Final Deliverables** \\n\",\n \" - Prepares and submits the **final Energy Action Plan** to the Aniak Tribe. \\n\",\n \" - Ensures compliance with **U.S. Government grant requirements** (e.g., DOE-funded projects). \\n\",\n \"\\n\",\n \"### **Additional Support Roles:**\\n\",\n \"- Provides **technical expertise** on cold-climate housing and energy efficiency. \\n\",\n \"- Assists with **outreach and education** to promote energy-saving strategies. \\n\",\n \"- Ensures transparency by **disclaiming any government endorsement** of specific products or services used in the project. \\n\",\n \"\\n\",\n \"### **Conclusion** \\n\",\n \"CCHRC acts as a **research, planning, and implementation partner**, helping rural Alaskan communities like Aniak improve energy efficiency, reduce costs, and enhance building performance in extreme climates. Their work includes **data collection, audits, reporting, and community collaboration** to create sustainable energy solutions. \\n\",\n \"\\n\",\n \"For more details, visit: [http://www.cchrc.org/doe-energy-efficiency-and-renewable-energy-projects](http://www.cchrc.org/doe-energy-efficiency-and-renewable-energy-projects)\\n\",\n \"\\n\",\n \"-------------------- Document 1 --------------------\\n\",\n \"Cold Climate Housing Research Center\\n\",\n \"8\\n\",\n \"www.cchrc.org Aniak Energy Action Plan 2019\\n\",\n \"[ This page intentionally left blank. ]\\n\",\n \"\\n\",\n \"-------------------- Document 2 --------------------\\n\",\n \"Cold Climate Housing Research Center\\n\",\n \"2\\n\",\n \"www.cchrc.org Aniak Energy Action Plan 2019\\n\",\n \"[ This page intentionally left blank. ]\\n\",\n \"\\n\",\n \"-------------------- Document 3 --------------------\\n\",\n \"building to track building improvements.\\n\",\n \"4. Energy Audits of Alaska will complete an \\n\",\n \"on-site assessment of each building.\\n\",\n \"5. CCHRC and Energy Audits of Alaska will \\n\",\n \"prepare a draft Energy Action Plan.\\n\",\n \"6. CCHRC and Energy Audits of Alaska will \\n\",\n \"present the draft Energy Action Plan to the \\n\",\n \"Tribe and listen to feedback.\\n\",\n \"7.CCHRC and Energy Audits of Alaska will \\n\",\n \"revise and finalize the plan.\\n\",\n \"8. CCHRC and Energy Audits of Alaska will \\n\",\n \"provide the final plan to the Tribe.\\n\",\n \"Throughout the project, CCHRC can help \\n\",\n \"with meeting the grant requirements, such as \\n\",\n \"writing quarterly progress reports, preparing \\n\",\n \"the final report, and creating outreach \\n\",\n \"materials.\\n\",\n \"Aniak Energy Efficiency Project\\n\",\n \"Cold Climate Housing Research Center | 907 - 457 - 3454 | www.cchrc.org\\n\",\n \"\\n\",\n \"-------------------- Document 4 --------------------\\n\",\n \"Cold Climate Housing Research Center\\n\",\n \"17\\n\",\n \"www.cchrc.orgAniak Energy Action Plan 2019\\n\",\n \"office and digital data on Quickbooks.\\n\",\n \"The building and heating appliance temperature data is stored on the Invita web portal, an online monitoring \\n\",\n \"platform that collects temperature data from registered thermostats over a wireless internet network.\\n\",\n \"The tribal finance director and tribal maintenance manager will decide where to store building condition and \\n\",\n \"occupant comfort data if they conduct additional surveys during an energy retrofit project.\\n\",\n \"Project staff also collected baseline data for this project, which consists of energy use, building condition, and \\n\",\n \"occupant comfort data for the period just prior to the energy audit. This data, shown in the Baseline data chapter \\n\",\n \"of this report is stored in a project folder on a server at the Cold Climate Housing Research Center and is also \\n\",\n \"available on CCHRC’s website at: http://www.cchrc.org/doe-energy-efficiency-and-renewable-energy-projects\\n\",\n \"\\n\",\n \"-------------------- Document 5 --------------------\\n\",\n \"Cold Climate Housing Research Center\\n\",\n \"5\\n\",\n \"www.cchrc.orgAniak Energy Action Plan 2019\\n\",\n \"DISCLAIMER\\n\",\n \"This report was prepared as an account of work sponsored by an agency of the United States Government. \\n\",\n \"Neither the United States Government nor any agency thereof, nor any of their employees, makes any warranty, \\n\",\n \"express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or usefulness \\n\",\n \"of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately \\n\",\n \"owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, \\n\",\n \"manufacturer, or otherwise does not necessarily constitute or imply its endorsement, recommendation, or \\n\",\n \"favoring by the United States Government or any agency thereof. The views and opinions of authors expressed \\n\",\n \"herein do not necessarily state or reflect those of the United States Government or any agency thereof.\\n\",\n \"\\n\",\n \" Answer saved to: output/question.txt\\n\"\n ]\n }\n ],\n \"source\": [\n \"answer = llm_utils.run_qa_chain(\\n\",\n \" query=\\\"Give detailed description of the responsibility of Cold Climate Housing Research Center (CCHRC)\\\",\\n\",\n \" retriever=retriever,\\n\",\n \" llm=llm,\\n\",\n \" return_sources=True,\\n\",\n \" save_path=\\\"output/question.txt\\\"\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"9615932c-67a6-4ab7-8a6d-e66fe6803553\",\n \"metadata\": {},\n \"source\": [\n \"## Extract information form multiple documents for comparison\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 11,\n \"id\": \"3036bf6f-edc9-4baf-9e83-29767e881894\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"from langchain.prompts import PromptTemplate\\n\",\n \"\\n\",\n \"structured_prompt = PromptTemplate.from_template(\\n\",\n \"\\\"\\\"\\\"\\n\",\n \"Given the following document text, extract key information and output a markdown table with columns:\\n\",\n \"\\n\",\n \"| Location | Main Objectives | Key Actions | Stakeholders | Timeline |\\n\",\n \"|----------|-----------------|-------------|--------------|----------|\\n\",\n \"\\n\",\n \"Use exact information from the text; if any info is missing, write \\\"N/A\\\".\\n\",\n \"\\n\",\n \"Context:\\n\",\n \"{context}\\n\",\n \"\\n\",\n \"Question:\\n\",\n \"{question}\\n\",\n \"\\\"\\\"\\\"\\n\",\n \")\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 27,\n \"id\": \"c95d9902-de31-45af-b395-026ae7617783\",\n \"metadata\": {},\n \"outputs\": [\n {\n \"name\": \"stdout\",\n \"output_type\": \"stream\",\n \"text\": [\n \"Processing data/1526439.pdf ...\\n\",\n \"\\n\",\n \"--- Final Answer ---\\n\",\n \"Based on the provided text, here is the extracted key information in the requested markdown table format.\\n\",\n \"\\n\",\n \"| Location | Main Objectives | Key Actions | Stakeholders | Timeline |\\n\",\n \"|----------|-----------------|-------------|--------------|----------|\\n\",\n \"| Aniak | Improve building condition; Decrease energy use; Determine if future retrofit projects are successful. | Check fuel and electrical use monthly; Survey buildings for layout, insulation, condition, and safety; Collect and analyze baseline data; Maintain a maintenance notebook; Monitor data related to seasonal energy use and building operation. | Contractors; Traditional Council; Project staff; Tribal finance director; Tribal building maintenance manager; Occupants; Cold Climate Housing Research Center (CCHRC) | Monthly (energy bill analysis); Period just prior to the energy audit (for baseline data); Mid-2019 (time of publication) |\\n\",\n \"Processing data/1526994.pdf ...\\n\",\n \"\\n\",\n \"--- Final Answer ---\\n\",\n \"Based on the provided text, here is the extracted key information in a markdown table.\\n\",\n \"\\n\",\n \"| Location | Main Objectives | Key Actions | Stakeholders | Timeline |\\n\",\n \"| :--- | :--- | :--- | :--- | :--- |\\n\",\n \"| Kwigillingok | Improve building condition; Decrease energy use; Provide electricity and heat via wind turbines. | Survey buildings; Analyze energy bills; Maintain a maintenance notebook; Collect and manage data (annual fuel oil use, monthly electrical energy use). | I.R.A. Council; Project staff; Tribal finance officer; Contractors; Service providers; Local utility; Emergency services; Building occupants. | N/A |\\n\",\n \"Processing data/1527001.pdf ...\\n\",\n \"\\n\",\n \"--- Final Answer ---\\n\",\n \"Based on the provided text, here is the extracted key information in the requested markdown table format.\\n\",\n \"\\n\",\n \"| Location | Main Objectives | Key Actions | Stakeholders | Timeline |\\n\",\n \"|----------|-----------------|-------------|--------------|----------|\\n\",\n \"| Atmautluak | Create a data monitoring plan for each building to track building improvements; Prepare an Energy Action Plan. | 1. Meet to discuss project goals. <br>2. Collect baseline data. <br>3. Create a data monitoring plan. <br>4. Complete on-site assessments. <br>5. Prepare a draft Energy Action Plan. <br>6. Present the draft plan for feedback. <br>7. Revise and finalize the plan. <br>8. Provide the final plan to the Tribe. | Tribe, CCHRC (Cold Climate Housing Research Center), Energy Audits of Alaska, building staff | May 2018 |\\n\",\n \"Processing data/1527003.pdf ...\\n\",\n \"\\n\",\n \"--- Final Answer ---\\n\",\n \"Based on the provided text, here is the extracted information in a markdown table. The text is fragmented and does not contain a single, coherent description of a project with all the requested details.\\n\",\n \"\\n\",\n \"| Location | Main Objectives | Key Actions | Stakeholders | Timeline |\\n\",\n \"|----------|-----------------|-------------|--------------|----------|\\n\",\n \"| N/A | - Improve building condition<br>- Decrease energy use<br>- Solicit funding for building improvements | - Survey buildings<br>- Analyze energy bills<br>- Develop a thorough project plan<br>- Create a maintenance notebook<br>- Treat and paint siding<br>- Investigate and eliminate unknown electric load<br>- Install setback thermostats<br>- Upgrade lighting to LEDs<br>- Replace bath fans | - I.R.A. Council<br>- Contractors<br>- Service providers<br>- Local utility<br>- Emergency services<br>- The Tribe<br>- Occupants<br>- Energy auditor<br>- Project staff | N/A |\\n\",\n \"\\n\",\n \" Saved results to output/multiple_comparison.csv\\n\"\n ]\n }\n ],\n \"source\": [\n \"folder_path = \\\"../../starter_kits/2_llm_structure_output/pdf_extraction/data/\\\"\\n\",\n \"save_csv_path = \\\"output/multiple_comparison.csv\\\"\\n\",\n \"query_text = \\\"Extract key information from this document.\\\"\\n\",\n \"results = []\\n\",\n \"\\n\",\n \"for fname in sorted(os.listdir(folder_path)):\\n\",\n \" if not fname.lower().endswith(\\\".pdf\\\"):\\n\",\n \" continue\\n\",\n \" pdf_path = os.path.join(folder_path, fname)\\n\",\n \" print(f\\\"Processing {pdf_path} ...\\\")\\n\",\n \"\\n\",\n \" # Build retriever for this pdf\\n\",\n \" retriever = llm_utils.build_pdf_retriever(pdf_path)\\n\",\n \"\\n\",\n \" # Run QA chain for structured extraction\\n\",\n \" extracted_text = llm_utils.run_qa_chain(\\n\",\n \" query=query_text,\\n\",\n \" retriever=retriever,\\n\",\n \" llm=llm,\\n\",\n \" prompt_template=structured_prompt,\\n\",\n \" return_sources=False\\n\",\n \" )\\n\",\n \"\\n\",\n \" results.append({\\n\",\n \" \\\"pdf_path\\\": fname,\\n\",\n \" \\\"extracted_text\\\": extracted_text,\\n\",\n \" })\\n\",\n \"save_csv_path = \\\"output/multiple_comparison.csv\\\"\\n\",\n \"query_text = \\\"Extract key information from this document.\\\"\\n\",\n \"results = []\\n\",\n \"\\n\",\n \"for fname in sorted(os.listdir(folder_path)):\\n\",\n \" if not fname.lower().endswith(\\\".pdf\\\"):\\n\",\n \" continue\\n\",\n \" pdf_path = os.path.join(folder_path, fname)\\n\",\n \" print(f\\\"Processing {pdf_path} ...\\\")\\n\",\n \"\\n\",\n \" # Build retriever for this pdf\\n\",\n \" retriever = llm_utils.build_pdf_retriever(pdf_path)\\n\",\n \"\\n\",\n \" # Run QA chain for structured extraction\\n\",\n \" extracted_text = llm_utils.run_qa_chain(\\n\",\n \" query=query_text,\\n\",\n \" retriever=retriever,\\n\",\n \" llm=llm,\\n\",\n \" prompt_template=structured_prompt,\\n\",\n \" return_sources=False\\n\",\n \" )\\n\",\n \"\\n\",\n \" results.append({\\n\",\n \" \\\"pdf_path\\\": fname,\\n\",\n \" \\\"extracted_text\\\": extracted_text,\\n\",\n \" })\\n\",\n \"\\n\",\n \"df = pd.DataFrame(results)\\n\",\n \"os.makedirs(os.path.dirname(save_csv_path), exist_ok=True)\\n\",\n \"df.to_csv(save_csv_path, index=False, encoding=\\\"utf-8-sig\\\")\\n\",\n \"print(f\\\"\\\\n Saved results to {save_csv_path}\\\")\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"2e987e8e-213b-4865-a3d3-98e2eb88e503\",\n \"metadata\": {},\n \"source\": [\n \"## Combine the result extracted from the single dcoument\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 23,\n \"id\": \"27adf069-add4-42b6-a928-06aa004aca2b\",\n \"metadata\": {},\n \"outputs\": [],\n \"source\": [\n \"merged_df_list = []\\n\",\n \"df = pd.read_csv(\\\"output/multiple_comparison.csv\\\")\\n\",\n \"\\n\",\n \"for i, md in enumerate(df[\\\"extracted_text\\\"]):\\n\",\n \" try:\\n\",\n \" parsed = llm_utils.parse_markdown_table(md)\\n\",\n \" parsed[\\\"source_doc\\\"] = df.loc[i, \\\"pdf_path\\\"] if \\\"pdf_path\\\" in df.columns else f\\\"doc_{i+1}\\\"\\n\",\n \" merged_df_list.append(parsed)\\n\",\n \" except Exception as e:\\n\",\n \" print(f\\\"Failed to parse doc {i+1}: {e}\\\")\\n\",\n \"\\n\",\n \"final_df = pd.concat(merged_df_list, ignore_index=True)\\n\",\n \"final_df.to_csv(\\\"output/merged_energy_policy.csv\\\", index=False)\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 25,\n \"id\": \"e1db2d59-ae61-4b32-9c20-a780186c5029\",\n \"metadata\": {},\n \"outputs\": [\n {\n \"data\": {\n \"text/html\": [\n \"<div>\\n\",\n \"<style scoped>\\n\",\n \" .dataframe tbody tr th:only-of-type {\\n\",\n \" vertical-align: middle;\\n\",\n \" }\\n\",\n \"\\n\",\n \" .dataframe tbody tr th {\\n\",\n \" vertical-align: top;\\n\",\n \" }\\n\",\n \"\\n\",\n \" .dataframe thead th {\\n\",\n \" text-align: right;\\n\",\n \" }\\n\",\n \"</style>\\n\",\n \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n \" <thead>\\n\",\n \" <tr style=\\\"text-align: right;\\\">\\n\",\n \" <th></th>\\n\",\n \" <th>Location</th>\\n\",\n \" <th>Main Objectives</th>\\n\",\n \" <th>Key Actions</th>\\n\",\n \" <th>Stakeholders</th>\\n\",\n \" <th>Timeline</th>\\n\",\n \" <th>source_doc</th>\\n\",\n \" </tr>\\n\",\n \" </thead>\\n\",\n \" <tbody>\\n\",\n \" <tr>\\n\",\n \" <th>0</th>\\n\",\n \" <td>Aniak</td>\\n\",\n \" <td>Improve building condition; Decrease energy us...</td>\\n\",\n \" <td>Check fuel and electrical use monthly; Survey ...</td>\\n\",\n \" <td>Contractors; Traditional Council; Project staf...</td>\\n\",\n \" <td>Monthly (energy bill analysis); Period just pr...</td>\\n\",\n \" <td>1526439.pdf</td>\\n\",\n \" </tr>\\n\",\n \" <tr>\\n\",\n \" <th>1</th>\\n\",\n \" <td>Kwigillingok</td>\\n\",\n \" <td>Improve building condition; Decrease energy us...</td>\\n\",\n \" <td>Survey buildings; Analyze energy bills; Mainta...</td>\\n\",\n \" <td>I.R.A. Council; Project staff; Tribal finance ...</td>\\n\",\n \" <td>N/A</td>\\n\",\n \" <td>1526994.pdf</td>\\n\",\n \" </tr>\\n\",\n \" <tr>\\n\",\n \" <th>2</th>\\n\",\n \" <td>Atmautluak</td>\\n\",\n \" <td>Create a data monitoring plan for each buildin...</td>\\n\",\n \" <td>1. Meet to discuss project goals. ; 2. Collect...</td>\\n\",\n \" <td>Tribe, CCHRC (Cold Climate Housing Research Ce...</td>\\n\",\n \" <td>May 2018</td>\\n\",\n \" <td>1527001.pdf</td>\\n\",\n \" </tr>\\n\",\n \" <tr>\\n\",\n \" <th>3</th>\\n\",\n \" <td>N/A</td>\\n\",\n \" <td>- Improve building condition; - Decrease energ...</td>\\n\",\n \" <td>- Survey buildings; - Analyze energy bills; - ...</td>\\n\",\n \" <td>- I.R.A. Council; - Contractors; - Service pro...</td>\\n\",\n \" <td>N/A</td>\\n\",\n \" <td>1527003.pdf</td>\\n\",\n \" </tr>\\n\",\n \" </tbody>\\n\",\n \"</table>\\n\",\n \"</div>\"\n ],\n \"text/plain\": [\n \" Location Main Objectives \\\\\\n\",\n \"0 Aniak Improve building condition; Decrease energy us... \\n\",\n \"1 Kwigillingok Improve building condition; Decrease energy us... \\n\",\n \"2 Atmautluak Create a data monitoring plan for each buildin... \\n\",\n \"3 N/A - Improve building condition; - Decrease energ... \\n\",\n \"\\n\",\n \" Key Actions \\\\\\n\",\n \"0 Check fuel and electrical use monthly; Survey ... \\n\",\n \"1 Survey buildings; Analyze energy bills; Mainta... \\n\",\n \"2 1. Meet to discuss project goals. ; 2. Collect... \\n\",\n \"3 - Survey buildings; - Analyze energy bills; - ... \\n\",\n \"\\n\",\n \" Stakeholders \\\\\\n\",\n \"0 Contractors; Traditional Council; Project staf... \\n\",\n \"1 I.R.A. Council; Project staff; Tribal finance ... \\n\",\n \"2 Tribe, CCHRC (Cold Climate Housing Research Ce... \\n\",\n \"3 - I.R.A. Council; - Contractors; - Service pro... \\n\",\n \"\\n\",\n \" Timeline source_doc \\n\",\n \"0 Monthly (energy bill analysis); Period just pr... 1526439.pdf \\n\",\n \"1 N/A 1526994.pdf \\n\",\n \"2 May 2018 1527001.pdf \\n\",\n \"3 N/A 1527003.pdf \"\n ]\n },\n \"execution_count\": 25,\n \"metadata\": {},\n \"output_type\": \"execute_result\"\n }\n ],\n \"source\": [\n \"final_df\"\n ]\n },\n {\n \"cell_type\": \"markdown\",\n \"id\": \"925a538f-7da7-4177-a268-bc8ba3a6c266\",\n \"metadata\": {},\n \"source\": [\n \"## Is LLM able to further analysis the combined summary?\"\n ]\n },\n {\n \"cell_type\": \"code\",\n \"execution_count\": 27,\n \"id\": \"8b7c3df7-6e01-48b8-8bf1-5add173296b1\",\n \"metadata\": {},\n \"outputs\": [\n {\n \"name\": \"stdout\",\n \"output_type\": \"stream\",\n \"text\": [\n \"Based on the provided policy tables for the Alaskan communities of Aniak, Kwigillingok, and Atmautluak, here is a comparative summary.\\n\",\n \"\\n\",\n \"### Common Energy Policy Goals\\n\",\n \"The communities share nearly identical primary objectives, focusing on practical, immediate improvements to building efficiency and energy management.\\n\",\n \"* **Improve Building Condition:** All plans prioritize assessing and upgrading the physical state of buildings, including insulation, siding, and safety.\\n\",\n \"* **Decrease Energy Use:** A universal goal is to reduce consumption of fuel and electricity to lower costs and increase sustainability.\\n\",\n \"* **Data-Driven Planning:** Each project emphasizes the critical role of collecting and analyzing baseline data (e.g., from energy bills and building surveys) to inform future retrofit projects and measure success.\\n\",\n \"\\n\",\n \"### Regions with the Most Comprehensive Plans\\n\",\n \"While all plans are focused, Atmautluak's project outline is the most structured and comprehensive.\\n\",\n \"* **Atmautluak** has a clearly defined, multi-step process that moves from initial meetings and data collection to creating, reviewing, and finalizing a formal Energy Action Plan. This indicates a strategic approach to long-term energy management.\\n\",\n \"* **Aniak** also demonstrates a strong, ongoing monitoring component with specific tasks like monthly energy bill analysis, making its plan operationally detailed.\\n\",\n \"\\n\",\n \"### Unique or Innovative Actions Mentioned\\n\",\n \"The actions are largely centered on foundational audits and retrofits, with one notable exception.\\n\",\n \"* **Standard Actions:** Most key actions are standard for energy efficiency projects: building surveys, energy bill analysis, LED lighting upgrades, and installing setback thermostats.\\n\",\n \"* **Innovative Action:** **Kwigillingok** mentions the unique and ambitious goal of providing electricity and heat via wind turbines, which is a significant step towards renewable energy generation rather than just efficiency.\\n\",\n \"\\n\",\n \"### Summary of Main Differences in Stakeholders and Timelines\\n\",\n \"The main differences lie in the specificity of timelines and the inclusion of technical partners.\\n\",\n \"* **Stakeholders:** All involve tribal leadership (IRA Council/Traditional Council), project staff, and occupants. The key difference is the explicit involvement of technical research partners like the **Cold Climate Housing Research Center (CCHRC)** in Aniak and Atmautluak, which adds a layer of expertise not mentioned for Kwigillingok.\\n\",\n \"* **Timelines:** This is the area of greatest variation. **Atmautluak** has a specific start point (May 2018). **Aniak** outlines ongoing, periodic tasks (monthly analysis) and a mid-2019 publication date. **Kwigillingok's** plan lacks a defined timeline altogether.\\n\"\n ]\n }\n ],\n \"source\": [\n \"summary_prompt = PromptTemplate.from_template(\\n\",\n \" \\\"\\\"\\\"\\n\",\n \" Below are extracted policy tables from multiple documents.\\n\",\n \"\\n\",\n \" Please compare and summarize:\\n\",\n \" - What are the common energy policy goals?\\n\",\n \" - Which regions have the most comprehensive plans?\\n\",\n \" - Are there unique or innovative actions mentioned?\\n\",\n \" - Summarize the main differences in stakeholders and timelines.\\n\",\n \"\\n\",\n \" Keep the answer concise and structured in paragraphs with bullet points.\\n\",\n \"\\n\",\n \" Tables:\\n\",\n \" {context}\\n\",\n \" \\\"\\\"\\\"\\n\",\n \")\\n\",\n \"\\n\",\n \"from langchain.chains import LLMChain\\n\",\n \"\\n\",\n \"all_tables = \\\"\\\\n\\\\n\\\".join(df[\\\"extracted_text\\\"].dropna().tolist())\\n\",\n \"\\n\",\n \"llm_chain = LLMChain(prompt=summary_prompt, llm=llm)\\n\",\n \"summary = llm_chain.invoke({\\\"context\\\": all_tables})\\n\",\n \"\\n\",\n \"print(summary[\\\"text\\\"])\\n\",\n \"with open(\\\"output/energy_policy_summary.txt\\\", \\\"w\\\", encoding=\\\"utf-8\\\") as f:\\n\",\n \" f.write(summary[\\\"text\\\"])\"\n ]\n }\n ],\n \"metadata\": {\n \"kernelspec\": {\n \"display_name\": \"ccai9012_check\",\n \"language\": \"python\",\n \"name\": \"ccai9012_check\"\n },\n \"language_info\": {\n \"codemirror_mode\": {\n \"name\": \"ipython\",\n \"version\": 3\n },\n \"file_extension\": \".py\",\n \"mimetype\": \"text/x-python\",\n \"name\": \"python\",\n \"nbconvert_exporter\": \"python\",\n \"pygments_lexer\": \"ipython3\",\n \"version\": \"3.12.12\"\n }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 5\n}\n"}}}}