MCPcopy Index your code
hub / github.com/google/ax / createLocalAgent

Function createLocalAgent

internal/multi_test.go:147–181  ·  view source on GitHub ↗
(transform func(string) string)

Source from the content-addressed store, hash-verified

145}
146
147func createLocalAgent(transform func(string) string) (*agent.LocalAgent, error) {
148 processFunc := func(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e agent.Executor, handler agent.OutputHandler) error {
149 for _, msg := range start.Messages {
150 content := msg.GetContent()
151 if content == nil {
152 continue
153 }
154 textContent := content.GetText()
155 if textContent == nil {
156 continue
157 }
158 if err := handler(&proto.AgentOutputs{
159 Messages: []*proto.Message{
160 {
161 Role: "assistant",
162 Content: &proto.Content{
163 Type: &proto.Content_Text{
164 Text: &proto.TextContent{
165 Text: transform(textContent.Text),
166 },
167 },
168 },
169 },
170 },
171 }); err != nil {
172 return err
173 }
174 }
175 return nil
176 }
177
178 return agent.NewLocalAgent(agent.LocalAgentConfig{
179 ProcessFunc: processFunc,
180 })
181}
182
183type mockPlanner struct{}
184

Callers 1

TestMultiFunction · 0.85

Calls 3

NewLocalAgentFunction · 0.92
GetContentMethod · 0.80
GetTextMethod · 0.45

Tested by

no test coverage detected