Source : Pexels/Pixabay

LangChain

Keno Leon

--

What | is | it ?

One of the characteristics of new technologies is that sometimes the new products and services are not immediately easy to grasp, you are telling me you can sell a book online !? Why, how, where ? I think many people asked these questions at the dawn of the internet, but more relevant the tools behind the scene need some learning too.

LangChain sits somewhere between a new product type: LLMs/AIs as software components and the new set of tooling required to integrate them into your code or project, so let’s check it out.

Bring your own AI

Before we start you need API Keys for LLMs or other AIs you plan to use, that is LangChain doesn’t include the AI proper but facilitates using them, I opted for the tried and tested OpenAI API, you do need to have some credits ( $5.00 should work ).

Basic Chains

So what’s a chain anyways ? In Langchains parlance it is a sequence of operations that involve processing inputs, interacting with a language model like an LLM or other AIs, and handling the outputs.

The metaphor of a chain seems a bit forced at this point, but imagine that each process is a link in a chain.

And a simple code example of a basic chain :

--

--