tmc / langchaingo

LangChain for Go, the easiest way to write LLM-based programs in Go
https://tmc.github.io/langchaingo/
MIT License
3.75k stars 521 forks source link

failed to decode stream payload: unexpected EOF #859

Open androidsr opened 1 month ago

androidsr commented 1 month ago

/github.com/tmc/langchaingo@v0.1.10/llms/openai/internal/openaiclient/chat.go:389: failed to decode stream payload: unexpected EOF sse 通讯协议相当于一个长连接,长连接的情况下接收一个JSON。在网络传输过程中可能不是一个完整的json。按tcp中的处理需要对数据进行缓冲处理。参考tcp长连接处理方式。在次建议,不要在代码中使用log.Failf 中断整个程序。

douglarek commented 1 month ago

see 4c509c08e8c8c452c1234c4a53a38737509d335a