Skip to content

Blog

#309: Repeating and Combining Lists With itertools

One of the things I like the most of Advent of Code is that it forces us to learn more about the language we use. This year I had to do a lot of combinations of elements in a list and for that we can either write the boring code on our own or use the itertools module that ships with Python. In this post we explore the most useful features of this hidden gem.

#308: Overwrite | to Simulate UNIX Pipes

In our LangChain posts we used this handy way to create a chain of the various parts that we need to interact with an LLM:

chain = prompt | llm

This mimics the pipelines in UNIX/LINUX, where we can chain command line tools together to create powerful operations. But how does this work behind the scenes? Let us find out how we can create such a behaviour on our own.

#307: Experimenting With a Large PDF File in LangChain

Last week we created a minimalistic bot that let us ask questions on a PDF file. As long as the PDF file and our prompt fits into the context windows of the LLM, that can be done without much infrastructure. Unfortunately, most interesting PDF files are way larger, and we do not want to ignore them. Let us find a way to split our PDF file into chunks so that the file size no longer matters.

#306: A PDF Bot With LangChain

In the last two posts we got our hands dirty with the LangChain ecosystem and build a bot that talked to a CSV file and one that connected to a database. The packages langchain_community and langchain_experimental helped us a lot with our structured data. But what about unstructured data, like in a PDF file?

Creating a bot that answers based on a PDF file is a straightforward task with LangChain. As long as the PDF is small enough to fit into the context size of our LLM, we can even skip all the overhead of vector databases. Let us see what we need to create this bot.

#305: Chat With a Database in LangChain

The CSV bot we created last week uses a lot of unsafe practices. If you are not that happy with running Python code generated by an LLM on your machine, you may want to try a different approach. One approach I find helpful is to load the CSV file into an SQLite database and then use a SQL agent to query the data. Let us find out how we can do that.

#304: Chat With CSV Files in LangChain

If you have a CSV file to explore and have no idea what is going on, asking broad questions would be a great help. By using LangChain and some additional packages we can build a chat bot that allows us to do that. Let us figure out what we need to make it happen.

#303: Use a Search Engine With LangChain

All LLMs have a knowledge cut-off point. All things that happened after that point are unknown to the LLM. What can we do if we need a bot that can answer questions on more current events? LangChain has us covered and gives us all the tools we need to ask search engines about current events (or anything else they know about). Let us see what we need to build such a chat bot.

#302: Create a LLM Client With Chat History

LLMs work state-less. That way they gain scalability, but we as users end up with a problem: The chat bot does not know anything about the answer it gave to the previous question. If we try to ask a follow-up question, we only end up with something like this:

How many entries are there?

Could you please clarify what you are referring to when you ask about the number of entries? Are you asking about entries in a list, dictionary, or some other data structure? Or perhaps you are referring to something else entirely? Providing more context will help me give you an accurate and concise response.

Let us see how we can use LangChain to add conversational memory to a chat bot.

#301: Introducing LangChain for AI Applications

There is a lot going on in the AI space. New tools and models show up in short succession, while other AI services suddenly change their behaviour and deliver poorer results. Whatever we use today is probably outdated in a few months. In such a fast-changing place it is a pain to develop software.

Over the next few weeks we explore LangChain, a tool that allows us to use an abstraction over the different products we could use. While we need to learn yet another tool, we gain the benefit of swapping out parts of our solution while the rest of our application can stay the same. Let us see how that works.