LangChain Expression Language (LCEL) | 🦜️🔗 Langchain
LangChain Expression Language:LCEL,langchain表达式语言,从设计之处就支持将原型投入生产而不用修改代码
为什么用langchain(而不直接调用LLM),官方文档给出以下的原因
1、“get the best possible time-to-first-token (time elapsed until the first chunk of output comes out)”--最低的平均首包延迟。时长少更少的围绕潜在延迟问题或缓慢响应的设计工作。
time-to-first-token:TTFT,LLM评估指标,表示收到 prompt 和返回第一个 token 的间隔时长。
参考Reproducible Performance Metrics for LLM inference
Time to first token (TTFT)
In streaming applications, the TTFT is how long before the LLM returns the first token. We are interested not just in the mean TTFT, but the distribution: the P50, P90, P95 and P99.
思考:硬件上优势,langchain框架内有哪些优化
2、良好的异步表现(处理多个并发请求的能力)
思考:web框架优点
3、可以在LCELchain的任意环节配置重试和回退(Retries and fallbacks),在没有任何延迟成本的情况下获得额外的可靠性。
4、可访问中间结果,让最终用户知道发生的过程、调试
5、输入输出模式:为每个LCELchain提供从链结构推断出的Pydantic和JSONSchema模式。这可用于验证输入和输出
6、LangSmith:已集成了日志记录、用于调试的模块
7、langServe:已集成了服务器
思考:3、4、5、6的优势是关于调试的能力