LangChain 推出 ModelRouterMiddleware:按首条消息自动选模型
LangChain 出了个 ModelRouterMiddleware,读你第一条消息就自动挑模型,还能每次工具返回后换模型,15分钟就能搭出来。
LangChain 的 ModelRouterMiddleware 借助 Jev 读取对话的第一条消息,据此挑选合适的模型,并由该模型完成整个运行流程。
Jev 成本足够低,开发者还能在每次工具调用结果返回后通过自定义 hook 重新选模型。Drew Breunig 用 DSPy 和 Jev 做了一个模型路由示例,约 15 分钟搭建完成。
文档已发布在 docs.langchain.
com。
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: docs.langchain.com/oss/python/int… x.com/dbreunig/statu… 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! gist.github.com/dbreunig/949b4… 🔗 View Quoted Tweet📊 4 ⚡
This report is categorized under AITOP's "Products" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include LangChain, DSPy, MCP and tools, model routing.
Source attribution: curated from Harrison Chase (@hwchase17).