Skip to content

Commit bfaef6f

Browse files
authored
Update the README examples with ProcessRequest and ProcessResponse (#16)
Related to #14.
1 parent 741becd commit bfaef6f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,15 @@ import (
259259
)
260260

261261
// Define your process function using callback handler
262-
processFunc := func(ctx context.Context, sessionID string, inputs []*proto.Content, handler agent.OutputHandler) error {
263-
for _, content := range inputs {
262+
processFunc := func(ctx context.Context, sessionID string, incoming *proto.ProcessRequest, handler agent.OutputHandler) error {
263+
for _, content := range incoming.Contents {
264264
output := &proto.Content{
265265
Role: "assistant",
266266
Type: "text",
267267
Mimetype: "text/plain",
268268
Data: "Your response: " + content.Data,
269269
}
270-
if err := handler(output); err != nil {
270+
if err := handler(&proto.ProcessResponse{Contents: []*proto.Content{output}}); err != nil {
271271
return err
272272
}
273273
}
@@ -317,7 +317,7 @@ func (s *server) Process(stream proto.AgentService_ProcessServer) error {
317317
}
318318

319319
// Send response back to gar controller
320-
if err := stream.Send(output); err != nil {
320+
if err := stream.Send(&proto.ProcessResponse{Contents: []*proto.Content{output}}); err != nil {
321321
return err
322322
}
323323
}

0 commit comments

Comments
 (0)