Skip to content
View original post on X: Harrison Chase
Published

LangChain's ModelRouterMiddleware routes runs to models using Jev

AILangChain's ModelRouterMiddleware uses Jev to read the first message and select a model that handles the entire run. Because Jev is cheap, developers can also re-select a model after each tool result using a custom hook.
@hwchase17
View on X

cool project by @dbreunig

in langchain this is ModelRouterMiddleware - jev reads the first message, picks the model, and that model handles the whole run

jev is cheap enough that you can also re-pick after each tool result with a custom hook

docs: https://docs.langchain.com/oss/python/integrations/providers/typesafe#model-routing

https://x.com/dbreunig/status/2106456056042025235

Drew Breunig@dbreunig
A quick example of a model router, using DSPy and Jev, based on your initial prompt. Sketched this out in ~15 min, by request, and am surprised at how well it works! https://gist.github.com/dbreunig/949b42c7202508881d7c5a64ccd0fb9b
View quoted post on X
Source details

Harrison Chase · x.comPublished · added here

Original title: cool project by @dbreunig