by ColinEberhardt on 5/4/23, 7:33 PM with 83 comments
by fbrncci on 5/5/23, 1:36 AM
1. Have a huge dataset of documents.
2. Want to ask questions and have an LLM chat conversation based on these documents.
3. Be able to implement tools like math, wiki or Google search on top of the retrieval.
4. Implement memory management for longer conversations.
Its still a lot more straightforward to maintain it in Python. The only thing where it becomes interesting is having agents execute async, which is not that easy replicate, but at the moment agents are not that helpful. Not trying to diss Langchain too much here, because its such an awesome framework, but I can't help seeing past it other than just being a helpful tool to understand LLM's and LLM programming for now.
by rcme on 5/5/23, 1:52 AM
prompt_template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
{context}
Question: {question}
Helpful Answer:"""
My sense of wonder was instantly deflated. "Helpful Answer:". Seriously? I think LLMs are cool, but this made me realize people are just throwing darts in the dark here.by loveparade on 5/5/23, 12:34 AM
by cube2222 on 5/5/23, 12:19 AM
The magic in LangChain, though, is the ecosystem. I.e. they have integrations with tons of indexes, they have many tool implementations, etc. This is the real value of LangChain. The core ReAct loop is quite trivial (as this article demonstrates).
by adityapurwa on 5/5/23, 4:09 AM
The moment I tried it and went through the docs, the entire abstraction feels weird for me. I know a bit here and there about LLM, but Langchain make me feels like Im learning something entirely new.
How agent and tools work and how to write one wasnt straightforward from the docs, and the idea of having an AI attach itself to an eval or writing its own error/hallucination-prone API request based on a docs doesnt give me a lot of confidence.
The hiring assignment specifically mentioned to use Langchain thought, so I did. But just as a glorified abstraction to call GPT and parses the NL output as JSON.
I did the actual API call, post-processing, etc. manually. Which I have granular control over it. Also cheaper in terms of token usages. You could say I ended writing my own agent/tool that doesnt exactly match Langchain specifications but it works.
I guess Langchain had its use case. But it feels pretty weird to use for me.
by lxe on 5/5/23, 1:16 AM
by okhat on 5/5/23, 1:59 AM
It’s a very different experience from the hand-holding of LangChain, but it packs reusable magic in generic constructs like annotate, compile, etc that work with arbitrary programs.
by ukuina on 5/5/23, 2:50 AM
Not affiliated, just a happy defector from LangChain.
by saulpw on 5/5/23, 5:13 AM
by KevinBenSmith on 5/5/23, 3:08 AM
And as soon as you want to slightly modify something to better accomodate your use-case, you are trapped in layers & layers of Python boiler plate code and unnecessary abstractions.
Maybe our llm applications haven’t been complex enough to warrent the use of langchain, but if that’s the case, then I wonder how many of such complex applications actually exist today.
-> Anyways, I came away feeling quite let down by the hype.
For my own personal workflow, a more “hackable” architecture would be much more valuable. Totally fine if that means it’s less “general”. As a comparison, I remember the early days of HugginfaceTransformers where they did not try to create a 100% high-level general abstraction on top of every conceivable Neural Network architecture. Instead, each model architecture was somewhat separate from one another, making it much easier to “hack” it.
by zyang on 5/5/23, 5:01 AM
AnalyzeDocumentChain[1] just wraps RecursiveCharacterTextSplitter[2]. It serves no real purpose except padding the api doc.
[1] https://js.langchain.com/docs/modules/chains/other_chains/an... [2] https://js.langchain.com/docs/modules/chains/other_chains/su...
by convexfunction on 5/5/23, 7:09 PM
If you want to develop a real LLM application, you're probably better off skipping the library completely, or at least fully understand each abstraction to make sure it does everything you want before you decide you want to incorporate it.
by d4rkp4ttern on 5/5/23, 12:10 PM
To put together a basic question/answer demo that didn't quite fit the LangChain templates, I had to hunt a bunch of doc pages and and cobble together snippets from multiple notebooks. Sure, the final result was under 30 lines of code, BUT: It uses fns/classes like `load_qa_with_sources_chain` and `ConversationalRetrievalChain`, and to know what these do under the hood, I tried stepping into the debugger, and it was a nightmare of call after call up and down the object hierarchy. They have verbose mode so you can see what prompts are being generated, but there is more to it than just the prompts. I had to spend several hours piecing together a simple flat recipe based on this object hierarchy hunting.
It very much feels like what happened with PyTorch Lightning -- sure, you can accomplish things with "just a few lines of code", but now everything is in one giant function, and you have to understand all the settings. If you ever want to do something different, good luck digging into their code -- I've been there, for example trying to implement a version of k-fold cross-validation: again, an object-hierarchy mess.
by justanotheratom on 5/5/23, 12:03 AM
Still, I would like to understand $200 million valuation of langchain.ai.
by nestorD on 5/5/23, 5:46 AM
It is great to get a prototype 80% of the way there fast in order to validate an idea or run something short lived.
I suspect that, if you want to go further (simpler code, better control message length, reliability, etc), you will be better served by implementing the functionality you need yourself.
by shri_krishna on 5/5/23, 7:51 AM
by havercosine on 5/5/23, 7:10 AM
Not to belittle the library, but most of it is a very thin wrapper classes that reek of premature abstraction, couple with hit-n-miss docs. At this point, given the hype, it is primarily optimized for cooking up demoes quickly. But not sure if the valuations or production use is justified.
by sia_m on 5/8/23, 8:37 PM
After a while of doing that, I realised like many others that it's too high of an abstraction. In the end I think you're better off just looking at their source code, and just looking at how they've implemented the stuff in normal python and then adapting it for your own needs.
by lynx23 on 5/5/23, 6:33 AM
by rahimnathwani on 5/5/23, 12:13 AM
by fchief on 5/5/23, 12:34 AM
by zbyforgotpass on 5/5/23, 9:00 AM
by valyagolev on 5/5/23, 3:09 AM
by sia_m on 5/8/23, 8:39 PM