From the course: Introduction to AI Orchestration with LangChain and LlamaIndex

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

Solution: Document summarization

Solution: Document summarization

Welcome back. How did you find that challenge? I hope that starter file got you off to a good start. Let's look at the code that I came up with. For my prompt, I kept it simple. I just had given the following documents, summarize them so that each section contains only the most important information and relevant facts. And then I left in place the document heading here, because this is the system prompt, and the user prompt will get put in after this. So we don't even need a prompt template here. And then to combine the documents, I used a good old-fashioned list comprehension inside the Python join method, and I used two new lines to separate things. And if you want to see the output of this, it's captured in the file 0206 summary.text. So you can see for each section, it did capture the main facts of each section. This might be a little bit too much of compression for something that we would feed back into a RAG process, but if you just were actually looking for a summary, this…

Contents