One of the challenges in working with an LLM API, like OpenAI’s is that you have to limit the request and the response to a certain number of tokens. This limits the amount of context you can work with. One of the most popular solutions to work with larger amounts of data is a python and Typescript library called LangChain. LangChain is a framework for apps powered by large langage models.
Langchain chains together document loaders, calls to different LLMs to create more complex prompts. These lower-level abstractions are useful on their own and can also be combined to create agents capable of performing certain tasks.
I spent some time with Langchain earlier this year, which was a fun way to learn more Python. But if you’re wondering why I haven’t updated my AI writing a plugin in a while, it’s because I tried to rewrite the backend in Python. That’s a challenging side project, especially because I only sort of know Python.
So instead, I started using the Typescript version. This post, which I will update as I learn more, is my list of links for developing with LangChain and Typescript.
Template Repo For LangChain
I made a template Github repo for LangChain development with Typescript: https://github.com/imaginarymachines/langchainjs-template
Helpful Langchian TypeScript Examples
- Example of using LangChain to load a PDF, create embeddings, and then ask the PDF questions.
- Create a Typescript CLI with Langchain
- Connect Langchain to a MySQL database and ask it questions.