cloudwego / cloudwego/eino-examples

chatwitheino/cmd/ch04/main.go中没有将工具调用上下文存入到session中

Open
#241 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
752
Forks
269
Avg merge
21h 58m
Merged PRs (30d)
4

Description

https://github.com/cloudwego/eino-examples/blob/main/quickstart/chatwitheino/cmd/ch04/main.go
示例中似乎只把userMsg、assistantMsg(最终文本)存入到了session中,丢失了工具调用的上下文——不知道之前调用过哪些工具、工具返回了什么结果。对于需要参考之前工具调用结果的多轮对话场景(比如"基于之前读的那个文件再做些修改"),模型会表现得"失忆"。
```go
userMsg := msgops.NewUser[M](line)
if err := session.Append(userMsg); err != nil {
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}

assistantMsg := msgops.NewAssistant[M](result.AssistantText, nil)
if err := session.Append(assistantMsg); err != nil {
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.