Any LangChain equivalent in Elixir?

LangChain (a Python library to augment LLMs) has become quite popular among people building some cool AI tools. Agents and Memory are probably it’s most useful tools. Anybody building something similar in Elixir land?

8 Likes

It would be cool to have such an initiative but it seems like a lot of work to have feature parity.
Do you have any ideas how it could be achieved faster and efficiently?

1 Like

I think it would be fine to take the python library as a dependency and provide basic interop by copying the API. I know Google used some kind of code generation to create their Elixir deps for the massive Google API - not sure how they went about it, but in theory one could use codegen to do this.

Or put ChatGPT on the job; use AutoGPT to generate an Elixir library. (Though in my experience ChatGPT isn’t the best with Elixir.)

2 Likes

It’s awful for elixir in my experience as well. So what do we do here? Elixir purging interop not the best but elixir is too good to not have open access to langchain. What are you guys gonna do instead? Just use python?

I recently completed the langchain course on deepLearning.ai - while to me, the API seemed unnecessarily tedious and complex, but use-cases it solves are essential. In fact, I have been asked for a few similar things in a product I’m building on top of openai.

What is the community’s take on a library like langchain and what’s Elixir’s way of implementing the API?

(I did see langchainex project on github - it seems promising, however, I felt it to be very Pythonish)

2 Likes

I had spent a few weeks/months learning Elixir in 2022. After the release of ChatGPT, I started developing Large Language Model (LLM) based AI applications. Given that my knowledge of Elixir was limited, I chose to use a Python based library called LangChain.

LangChain is a reasonably well-designed wrapper or abstraction around existing Python libraries that makes developing LLM based applications easier. The difficult/tricky part of creating LangChain is the various prompts baked into its various functions.

I believe creating/releasing a port of LangChain in Elixir could greatly help the ecosystem.

Any thoughts?

1 Like

OpenAI released function calls a couple days ago, it solves most of the probelms LangChain was solving, but more elegantly. You can call external functions/API from within your app using this. This allows you to call OpenAI recursively as well. Here are some examples:

https://twitter.com/maccaw/status/1669367224694607875

Jose Valim tweeted about live streaming this. I really hope he covers this:
https://twitter.com/josevalim/status/1668726716947222528?s=20

1 Like

LangChain also works with Llama.cpp and other OpenAI alternatives or self-hosted LLMs. so I think it makes sense to have something similar for elixir. If we can make it easy to work with other LLMs and be more performant than LangChain, that would be very attractive indeed!

1 Like

I came across an interesting library called Train that implements some of the core concepts from LangChain in Elixir.

3 Likes

also see: Langchain - An Elixir LangChain-like library for integrating with LLMs like ChatGPT

1 Like