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 NewRetrievalAgent(ctx context.Context, chatModel model.ToolCallingChatModel, pipeline *rag.RAGPipeline) adk.Agent { agent, _ := adk.NewChatModelAgent(ctx, &adk.ChatModelAgentConfig{ Name: "RetrievalAgent", Description: "Searches the knowledge base to find relevant notes. Use for information retrieval and discovery.", Instruction: `You are a knowledge retrieval expert. Your job is to find the most relevant notes from the user's knowledge base. Use semantic_search for conceptual or fuzzy queries where the user describes something by meaning. Use keyword_search when the user provides specific terms, titles, or exact keywords. Always return the most relevant results with enough context for the user to understand what was found.`, Model: chatModel, ToolsConfig: adk.ToolsConfig{ ToolsNodeConfig: compose.ToolsNodeConfig{ Tools: []tool.BaseTool{ tools.NewSemanticSearchTool(pipeline), tools.NewKeywordSearchTool(pipeline), }, }, }, MaxIterations: 10, }) return agent }