langchaingo icon indicating copy to clipboard operation
langchaingo copied to clipboard

openai 调用出错了

Open yhuaminghui opened this issue 10 months ago • 5 comments

这个是错误消息 error decoding streaming response: invalid character ':' looking for beginning of value 经过排查文件是在llms/openai/internal/openaiclient/chat.go的parseStreamingChatResponse方法,在协程里解析响应数据出错了

yhuaminghui avatar Feb 26 '25 10:02 yhuaminghui

经过排查,比如使用 openrouter 那么第一条消息是:openrouter 如果是其他的平台,可能前缀不一样,这里没有兼容这种情况,希望可以处理一下

yhuaminghui avatar Feb 26 '25 10:02 yhuaminghui

Is this a duplicate of #942 ?

corani avatar Feb 27 '25 01:02 corani

应该是同一个类型的问题

yhuaminghui avatar Feb 27 '25 01:02 yhuaminghui

Image

通过打印输出,可以看到,确实是这里的问题

yhuaminghui avatar Feb 27 '25 02:02 yhuaminghui

这个问题解决的还是有点片面,只兼容了一种情况 https://github.com/tmc/langchaingo/issues/942

针对这个问题 我提了一个 PR 。 https://github.com/tmc/langchaingo/pull/1173

yhuaminghui avatar Feb 27 '25 03:02 yhuaminghui