Live data from Hacker News

The Problem with LangChain

minimaxir.com

61–70 of 97 posts

Re: The Problem with LangChain

#61
People have already said that LangChain is useful to get ideas about what can be done with LLMs past the single prompt-response dynamic. Something else I thought to add is that LangChain is also useful for prototyping, so you'll be able to have a proof of concept of your idea before the weekend ends. I do agree that once you have that nailed down then you should rewrite everything from the ground up.

I do recommend prototyping; even if you think your idea is feasible, you want to see it in action before committing significant resources. Personally, my prototype showed me that a single run of my idea takes more time and money than I initially expected.

Re: The Problem with LangChain

#62

My primary use of langchain has been to turn text into a vector database with chroma and then query the vector database to return source materials to an LLM to use. I’d much prefer to move away from it because like the author I find LC’s adherence to system prompts is really bad. I can handle all of the agent side of things, I just want relevant source materials from the vector DB as strings — anyone have a better mo…

I found Chroma to be really slow. I recently switched to pgvector and I'm really happy with it. This is an example of using pgvector that might be relevant for your use case: SELECT d.id, d.doc, 1 - (embedding (SELECT embedding FROM documentation_embedding WHERE id = 1)) AS similarity FROM documentation_embedding de join documentation d on de.documentation_id = d.id ORDER BY similarity desc;

chroma is getting much faster on Monday.

be cautious with pgvector - the recall can be extremely bad (% retrieved nearest neighbors vs ground truth)

Re: The Problem with LangChain

#64

The core data structure, the Chain, is basically just a function. Combining chains is function composition, like literally it's just f(g(x)), but incompatible with _your_ f's and g's without an adapter. Read this page and mentally swap "chain" for "function": https://python.langchain.com/docs/modules/chains/foundationa... They build all these adapters and integrations and make it seem like they're helping you piece t…

> ...but in how many cases were they necessary as a middleman?

Some prefer React, somet NextJS. LangChain has its place.

Re: The Problem with LangChain

#65

I use lambda over let over lambda (lolol)[1] like this (Clojure): (def chatgpt (-> (endpoint :chat "gpt-4" auth) (chat/set-opts [:endpoint] {:stream true}) chat/retry chat/catch-unkown-commands ;; chat/history chat/string-input (chat/file-io "file.txt" :stream true) #_(chat/preserve-ctx chatgpt-ctx))) These higher-level functions take as input the next function in the chain, and return a function that is responsible…

[deleted]

Re: The Problem with LangChain

#66
post #2

Langchain is perfect to give you ideas for how to interact with LLMs, but for me it's been easier to implement everything myself than to use it.

I think I wrote pretty much the same comment here a few months ago. There's some good Langchain videos on YT to get you up to speed with the space in a day, then just go directly to the APIs you think are best suited to your problem.

Also: before using any new technology, go to hn.algolia.com and search HN for comments about it first.

Re: The Problem with LangChain

#67
Dude did ReactJS dirty in that parting shot. Say what you want about the modern ecosystem, but the core idea of declaring UI state with a virtual DOM was excellent. There is a reason why every major web framework followed suit.

Re: The Problem with LangChain

#68

I'm in the exact same spot as the author just a few days in instead of months. Frankly I could see langchain is garbage software just by looking at the code. It still helps me get shit done fast to figure out how things are supposed to work. Sort of a cookbook of AI recepies. Once I have an approach narrowed down I'll rewrite everything on top of stuff langchain is supposedly wrapping. For now it's faster than tracki…

You don't need to look at the code: I looked at the release notes and the garbage fire of unrelated nonsense getting added and got to skip even installing it. https://github.com/hwchase17/langchain/releases At this point Langchain is almost required to accept any PR. They raised money, and now their growth metric is Github stars. A simple wrapper around the APIs (I used llamaflow, which is now llm-api https://github.…

Pfft. You looked at the release notes? I knew it was garbage so fast that I got warped back in time to 2021, and stopped using LangChain before it even existed.

Re: The Problem with LangChain

#69

The core data structure, the Chain, is basically just a function. Combining chains is function composition, like literally it's just f(g(x)), but incompatible with _your_ f's and g's without an adapter. Read this page and mentally swap "chain" for "function": https://python.langchain.com/docs/modules/chains/foundationa... They build all these adapters and integrations and make it seem like they're helping you piece t…

> ...but in how many cases were they necessary as a middleman? Some prefer React, somet NextJS. LangChain has its place.

The question is: Who needs to abtract over 10 lines of code?

Re: The Problem with LangChain

#70

The core data structure, the Chain, is basically just a function. Combining chains is function composition, like literally it's just f(g(x)), but incompatible with _your_ f's and g's without an adapter. Read this page and mentally swap "chain" for "function": https://python.langchain.com/docs/modules/chains/foundationa... They build all these adapters and integrations and make it seem like they're helping you piece t…

> ...but in how many cases were they necessary as a middleman? Some prefer React, somet NextJS. LangChain has its place.

Langchain don't support basic things, like splitting a list result in single items and processing those one by one, accumulating the results further down the road.

By the time you have built custom chains, custom prompts, and custom agents to support all that, you basically are using their interface and not their code. At that point, eh, it's pointless. It's great for demos, I give you that, but every time I tried to coherce it into a product, it fell short.

Post reply on HN