Building a Summarization System with LangChain - Part 3 Using ChatGPT Turbo
Key Takeaways
This video demonstrates how to use the ChatGPT Turbo API for summarization, building on concepts from previous videos. It shows how to use the API to summarize articles, extract key facts, and create triples.
Full Transcript
okay this video will be just a quick one to follow up how could you do the summarization with the chat GPT turbo API so I'm going to show you we've gone through two videos now of doing it with the standard one and just recapping there you could do it either through the summarization chains or you could actually just set up a large language model and pass it in so we've got the exact same article about coinbase that we had in the last video so you can see the facts there and doing the fact extraction we get that with the standard API so with the chechi BT API there are a couple of different things we need to think about one that this is built for chat the big difference with this is you now have different sort of prompts and different inputs based on whether it's the part of the system whether it's a user whether it's the ai's response that raises some interesting issues of that we need to think about okay how are we going to package this up so if you look at just doing a standard chat with this we just pass in a human message and that probably has a system message on top of that but just doing this this is an example from their docs we're passing a human message and you can see it does it quite nicely so just doing a normal summary the way I've done it is that you use the system message to set up the context of what the whole thing is about so in this case the system message is you're an expert at making strong factual summarizations take the article submitted by the user and produce a factual useful summary here we're not using the user to give any instructions the user is just going to be putting in the actual article So the instructions are coming in the system message here you can think of these as like placeholder tokens that tell the model different kinds of information so a system message token tells it setting up the context setting up the task often that kind of thing and then the human message is what you would expect to get from the user so we take this we're passing our article as the human message so we've got these messages this list of messages and if we're actually doing it in chat we would have system human AI response Etc and this messages list can get reasonably long doing this but here because we really just want to translate one thing and then get it back we're not actually setting this up as conversational chat so we can just pass in the article there and sure enough it gives us a really nice summary back just from doing that it's treated it like a I guess in some ways you could think of it maybe treating it like a conversation but it's eliminated the bits about the conversation because we've set the system to basically just take the article submitted by the user and produce a factual summary does it work for the bullet lists ones yeah you can use it for this ones again here you would change the system message your human message is going to be the article just like before but the system message here is you're an expert at making strong factual summarization so the same as before but now extract the key facts out of this text don't include opinions give each fact a number and keep them short sentences and we can see that it gives back pretty nice information not that different not hugely different than what we were getting before the thing to think about here though is that each of these models tensed a little bit of style or personality to itself so you want to play around with prompt sometimes you're going to have to change the prompt for the kind of article or the kind of documentation Etc that you're summarizing so that works what about making the triples so normally what I was doing to make the triples was I was passing in these facts but one of the cool things with this is that we can actually just pass in so we can do it like that but we can also just pass in the article Itself by passing in the article itself we can get triples and this is like doing it the old way with this is doing one way so here we're basically just passing these in but we can also do it like this where we've got so actually sorry that was just extracting the the facts out there and what I was playing around with was that you could pass this in but actually with the chat gbt it seems to get better response if you actually just pass in the full article so rather than pass the list of facts which would you can play with this you're just passing the responses dot content in here but what I've passed in is the whole article and you can see that it's giving us number for each triple it's given us the subject to predicate object for each of these so it would be pretty easy to even apps chat should be T to write a piece and python code that would extract these out into whatever format you wanted to use in your knowledge graph once we've got them in this kind of format it makes it very easy to do and looking at it it seems to have done quite a nice job of doing it like this which seems different than the previous one was doing it's cut off a little bit at the end this because of the number of Max tokens that I've set so that's something that you could play around with so as always if you've got any questions please put them in the comments if this was useful to you please click and subscribe and I'll see you in the next video
Original Description
Colab Code Notebook: https://drp.li/FWph5
This video looks at how to use the latest ChatGPT ('gpt-3.5-turbo') API from OpenAI for summarization. It builds on concepts from the previous 2 videos on summarization.
My Links:
Twitter - https://twitter.com/Sam_Witteveen
Linkedin - https://www.linkedin.com/in/samwitteveen/
Github:
https://github.com/samwit/langchain-tutorials
https://github.com/samwit/llm-tutorials
#LangChain #BuildingAppswithLLMs
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Sam Witteveen · Sam Witteveen · 12 of 60
1
2
3
4
5
6
7
8
9
10
11
▶
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
LangChain Basics Tutorial #1 - LLMs & PromptTemplates with Colab
Sam Witteveen
LangChain Basics Tutorial #2 Tools and Chains
Sam Witteveen
ChatGPT API Announcement & Code Walkthrough with LangChain
Sam Witteveen
Trying Out Flan 20B with UL2 - Working in Colab with 8Bit Inference
Sam Witteveen
LangChain - Conversations with Memory (explanation & code walkthrough)
Sam Witteveen
LangChain Chat with Flan20B
Sam Witteveen
LangChain - Using Hugging Face Models locally (code walkthrough)
Sam Witteveen
PAL : Program-aided Language Models with LangChain code
Sam Witteveen
Building a Summarization System with LangChain and GPT-3 - Part 1
Sam Witteveen
Building a Summarization System with LangChain and GPT-3 - Part 2
Sam Witteveen
Microsoft's Visual ChatGPT using LangChain
Sam Witteveen
Building a Summarization System with LangChain - Part 3 Using ChatGPT Turbo
Sam Witteveen
LangChain Agents - Joining Tools and Chains with Decisions
Sam Witteveen
Investigating Alpaca 7B - Finetuned LLaMa LLM
Sam Witteveen
Comparing LLMs with LangChain
Sam Witteveen
Running Alpaca7B in Colab
Sam Witteveen
How to finetune your own Alpaca 7B
Sam Witteveen
How to make a custom dataset like Alpaca7B
Sam Witteveen
Understanding Constitutional AI - the paper and key concepts
Sam Witteveen
Using Constitutional AI in LangChain
Sam Witteveen
Talking to Alpaca with LangChain - Creating an Alpaca Chatbot
Sam Witteveen
Text-to-video-synthesis with Diffusers and Colab
Sam Witteveen
Meet Dolly the new Alpaca model
Sam Witteveen
Checking out the Cerebras-GPT family of models
Sam Witteveen
A Step-by-Step Guide to Fine-Tuning Your Dolly Model (tutorial)
Sam Witteveen
Is GPT4All your new personal ChatGPT?
Sam Witteveen
Raven - RWKV-7B RNN's LLM Strikes Back
Sam Witteveen
Talk to your CSV & Excel with LangChain
Sam Witteveen
Vicuna - 90% of ChatGPT quality by using a new dataset?
Sam Witteveen
Koala Revealed: The ChatGPT Alternative You Need to Know! 🔍
Sam Witteveen
Running Koala for free in Colab. Your own personal ChatGPT? (tutorial)
Sam Witteveen
BabyAGI: Discover the Power of Task-Driven Autonomous Agents!
Sam Witteveen
Auto-GPT - How to Automate a Task Based AI with GPT-4
Sam Witteveen
Improve your BabyAGI with LangChain
Sam Witteveen
Generative Agents - Deep Dive and GPT-4 Recreation
Sam Witteveen
GPT4ALLv2: The Improvements and Drawbacks You Need to Know!
Sam Witteveen
Dolly 2.0 by Databricks: Open for Business but is it Ready to Impress!
Sam Witteveen
Red Pajama - Operation: Freeing LLaMA
Sam Witteveen
Investigating Open Assistant - Models, Datasets and Addons
Sam Witteveen
Investigating MiniGPT-4 - The Secret behind GPT-V?
Sam Witteveen
Stable LM 3B - The new tiny kid on the block.
Sam Witteveen
Bard can now code and put that code in Colab for you.
Sam Witteveen
Checking out Bark: a Text to Speech system by Suno AI
Sam Witteveen
Fine-tuning LLMs with PEFT and LoRA
Sam Witteveen
Master PDF Chat with LangChain - Your essential guide to queries on documents
Sam Witteveen
Using LangChain with DuckDuckGO Wikipedia & PythonREPL Tools
Sam Witteveen
Building Custom Tools and Agents with LangChain (gpt-3.5-turbo)
Sam Witteveen
StableVicuna: The New King of Open ChatGPTs?
Sam Witteveen
WizardLM: Evolving Instruction Datasets to Create a Better Model
Sam Witteveen
LaMini-LM - Mini Models Maxi Data!
Sam Witteveen
Finding the Best Free ChatGPT
Sam Witteveen
MPT-7B - The First Commercially Usable Fully Trained LLaMA Style Model
Sam Witteveen
LangChain Retrieval QA Over Multiple Files with ChromaDB
Sam Witteveen
LangChain Retrieval QA with Instructor Embeddings & ChromaDB for PDFs
Sam Witteveen
LangChain + Retrieval Local LLMs for Retrieval QA - No OpenAI!!!
Sam Witteveen
Transformers Agent - Is this Hugging Face's LangChain Competitor?
Sam Witteveen
StarCoder - The LLM to make you a coding star?
Sam Witteveen
Testing Starcoder for Reasoning with PAL
Sam Witteveen
The New Wizards - Unfiltered & Unaligned
Sam Witteveen
Camel + LangChain for Synthetic Data & Market Research
Sam Witteveen
More on: LLM Foundations
View skill →Related AI Lessons
⚡
⚡
⚡
⚡
Claude AI vs ChatGPT: Which One Is Actually Better in 2026?
Medium · AI
Claude AI vs ChatGPT: Which One Is Actually Better in 2026?
Medium · Programming
IntelliBooks: Classic RAG vs Graph RAG vs Agentic RAG – Choosing the Right AI Retrieval Architecture for Enterprise AI
Dev.to AI
Fluid, natural voice translation with Gemini 3.5 Live Translate
Dev.to AI
🎓
Tutor Explanation
DeepCamp AI