MCPcopy Create free account
hub / github.com/cloudwego/eino-examples / printMessage

Function printMessage

flow/agent/react/memory_example/main.go:155–170  ·  view source on GitHub ↗
(idx int, m *schema.Message)

Source from the content-addressed store, hash-verified

153}
154
155func printMessage(idx int, m *schema.Message) {
156 switch m.Role {
157 case schema.Assistant:
158 if len(m.ToolCalls) > 0 {
159 for _, tc := range m.ToolCalls {
160 fmt.Printf("[Stream %d] role=%s tool_call=%s args=%s\n", idx, m.Role, tc.Function.Name, truncate(tc.Function.Arguments, 60))
161 }
162 } else {
163 fmt.Printf("[Stream %d] role=%s content=%s\n", idx, m.Role, truncate(m.Content, 80))
164 }
165 case schema.Tool:
166 fmt.Printf("[Stream %d] role=%s tool=%s result=%s\n", idx, m.Role, m.ToolName, truncate(m.Content, 80))
167 default:
168 fmt.Printf("[Stream %d] role=%s content=%s\n", idx, m.Role, truncate(m.Content, 80))
169 }
170}
171
172func verifyGobRoundTrip() {
173 msgs := []*schema.Message{

Callers 1

mainFunction · 0.70

Calls 2

truncateFunction · 0.70
PrintfMethod · 0.65

Tested by

no test coverage detected