AWS Builder Center
Building a Campus Study Assistant with Amazon Bedrock (Part 2: Multi-Format Document Parsing & Automated Summarization)

Building a Campus Study Assistant with Amazon Bedrock (Part 2: Multi-Format Document Parsing & Automated Summarization)

Part 2 of building a private AI study assistant with Amazon Bedrock: focusing on local document parsing, privacy-first text extraction, and automated study guide generation.

Series: Building a Campus Study Assistant with Amazon Bedrock (3 articles)

  1. 2
    Building a Campus Study Assistant with Amazon Bedrock (Part 2: Multi-Format Document Parsing & Automated Summarization) This article
In Part 1, we set up Python and verified our connection to Amazon Bedrock using boto3 and Anthropic Claude Haiku. But a real study tool needs to handle actual coursework; like long PDF slides and Word document notes.
In Part 2, we will update our Python script to automatically read .pdf and .docx files on your computer and send that text to Bedrock to create instant study guides.

Step 1: Understanding Local Parsing & Privacy

Instead of uploading entire files to third-party servers, our code extracts the text locally on your machine. Only the extracted text string is sent to Amazon Bedrock, keeping your files private. Place your test notes inside a dedicated folder named my_coursework_docs/ in your project folder.
  1. Input File ( .pdf  or  .docx ) └── Phase 1 (Local Extraction): Python reads the file on your machine and extracts the plain text locally.
  1. Plain Text String └── Phase 2 (Cloud Request):  boto3  transmits the text payload + academic prompt to Amazon Bedrock.
  1. Amazon Bedrock (Claude Haiku) └── Phase 3 (Output Generation): Claude processes the notes and generates a formatted study guide.
  1. Structured Study Guide Output

Step 2: Preparing Study Materials & Install Requirements

To get your environment ready for multi-format processing, install the required parsing packages for your project environment:
pip install pypdf python-docx boto3
  • pypdf: Opens PDF files and reads text page-by-page.
  • python-docx: Iterates through structured paragraphs in Microsoft Word (.docx) documents.

Step 3: Building the Document Analyzer Create a script named summarize_doc.py in your project folder. It uses a helper function named extract_text() to inspect the file extension, run the matching reader (pypdf or python-docx), and pass the raw text to Bedrock with a low temperature (0.2) for accurate, factual summarization.

The complete multi-format parsing script, prompt template, and project structure are available in the open-source [GitHub Repository] linked at the end of this article.

Step 4: Results & Key Lessons Learned

Running the document analyzer script against a sample lecture document extracted the text locally and sent the payload to Amazon Bedrock. Claude Haiku processed the full text and printed a structured, three-part study guide directly to the terminal: an Executive Summary, Key Concepts & Definitions, and Potential Exam Questions.
Terminal output showing the local PDF text extraction and Claude Haiku generating the Executive Summary and Key Concepts.

Terminal output showing Functional Units of a Computer and AI-generated Practice Exam Questions with expected answers.

Building this local parsing and summarization pipeline highlighted three valuable takeaways along the way:
  • Local Parsing Preserves Document Privacy: Reading files on your local machine using tools like  pypdf  and  python-docx  means raw PDF slides and Word documents are never uploaded to external storage or third-party web servers; only the extracted plain text is passed to Bedrock.
  • Modular Code Keeps Workflows Scalable: Moving the document parsing into a dedicated  extract_text()  helper function separates document reading from API invocation. This keeps the script clean and makes it simple to extend support to additional file types down the line without breaking the core logic.
  • Temperature Tuning Prevents Hallucinations: Keeping  temperature: 0.2  in the model payload restricts Claude Haiku from generating off-topic explanations. It forces the output to remain strictly grounded in the extracted lecture notes, ensuring accurate definitions and relevant exam review questions.

What's Next?

Our command-line backend can now convert multi-format coursework files into structured study guides. In Part 3, we will turn this backend script into a web application by building a user-friendly interface with Streamlit.
🔗 Relevant Resources & Further Reading

Series: Building a Campus Study Assistant with Amazon Bedrock (3 articles)

  1. 2
    Building a Campus Study Assistant with Amazon Bedrock (Part 2: Multi-Format Document Parsing & Automated Summarization) This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article