Skip to content

Lesson about using LangChain's load_summarize_chain with Ollama and long texts to summarize

License

Notifications You must be signed in to change notification settings

casedone/load-summarize-chain

Repository files navigation

load-summarize-chain

Lesson about using LangChain's load_summarize_chain with Ollama and long texts to summarize

In this repo, we explore two approaches of text summarization: map-reduce and refine.

Table of Contents

  1. Introduction
  2. Approaches
  3. Installation
  4. Usage
  5. Contributing
  6. License

Introduction

This repository demonstrates how to use LangChain's load_summarize_chain with Ollama to summarize long texts efficiently.

Approaches

Map-Reduce

The map-reduce approach involves breaking down the text into smaller chunks, summarizing each chunk, and then combining these summaries into a final summary.

Refine

The refine approach iteratively improves the summary by refining it through multiple passes over the text.

Setup environment

To install the necessary dependencies, run:

pip install -r requirements.txt

Tools you will use

  • Ollama to run local LLM API
  • Llama 3.2-3B from Meta, to use as AI brain. See on Ollama page.
  • LangChain as framework for LLM app
  • tiktoken library to estimate token counts

Sharing & Crediting

Feel free to copy and distribute, but we appreciate you giving us credits.

⛓️Connect with Us:

👍 Like | 🔗 Share | 📢 Subscribe | 💬 Comments | ❓ Questions

LinkedIn
YouTube
Facebook
TikTok
Github
SubStack

About

Lesson about using LangChain's load_summarize_chain with Ollama and long texts to summarize

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published