Rhetorical question: which code would you rather maintain, change, and update?
For a side by side comparison see our docs.
In this directory you'll find a set of equivalent examples. Most of the files are self-contained, and are prefixed with what they have inside them.
Files prefixed with lcel_ are LangChain examples. Files prefixed with vanilla_ are what you would write in vanilla Python. Files prefixed with hamilton_ are the Hamilton equivalent of the examples.
As you browse the files you'll see that:
Don‘t be surprised that Hamilton’s code is “longer” - that‘s by design. There is also little abstraction between you, and the underlying libraries with Hamilton. With LangChain they’re abstracted away, so you can‘t really see easily what’s going on underneath.