跳到正文
掘金· 桃西西呀beverlyLee·· 2 小时前AI 评分22

LangChain 之八:流式与透传

AI 导读

LangChain 源码系列第八篇解析流式与透传机制,源码基于 langchain-core 1.3.2。BaseChatModel 在 chat_models.py:710 覆写 stream,逐格吐出 AIMessageChunk,并在流尾补一个 content 为空、chunk_position 为 last 的空 token 作为终止信号。

来源:掘金 · juejin.cn