Files
eino-test/internal/agent/writer.go
T

38 lines
1.2 KiB
Go

package agent
import (
"context"
"eino-test/internal/rag"
"eino-test/internal/tools"
"github.com/cloudwego/eino/adk"
"github.com/cloudwego/eino/components/model"
"github.com/cloudwego/eino/components/tool"
"github.com/cloudwego/eino/compose"
)
func NewWriterAgent(ctx context.Context, chatModel model.ToolCallingChatModel, pipeline *rag.RAGPipeline) adk.Agent {
agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{
Name: "WriterAgent",
Description: "Creates new notes and generates summaries. Use for content creation and processing.",
Instruction: `You are a writing assistant. Your job is to help users create, organize, and summarize notes.
Use create_note when the user wants to save new content to their knowledge base.
Use generate_summary when the user wants a concise overview of an existing note.
Always write in clear, well-structured Markdown format.`,
Model: chatModel,
ToolsConfig: adk.ToolsConfig{
ToolsNodeConfig: compose.ToolsNodeConfig{
Tools: []tool.BaseTool{
tools.NewCreateNoteTool(pipeline),
tools.NewGenerateSummaryTool(pipeline, chatModel),
},
},
},
MaxIterations: 8,
})
return agent
}