#311: Creating Packages With uv
As I introduced project management with uv in this blog, we skipped the code part of creating our own packages. Let us end the year with closing this gap and see what it takes to make a package for PyPI.org
As I introduced project management with uv in this blog, we skipped the code part of creating our own packages. Let us end the year with closing this gap and see what it takes to make a package for PyPI.org
Last week we explored the most useful functions of the itertools module to cover some of the most common use-cases we have with lists. However, there is one case we left open for this post: combining multiple iterables that are related into a single iterable. In this post we explore how the zip() function allows us to do that.
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.
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:
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.
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.
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.
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.
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.
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.
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.