1111import com .embabel .agent .core .AgentPlatform ;
1212import com .embabel .agent .core .CoreToolGroups ;
1313import com .embabel .agent .discord .DiscordUser ;
14- import com .embabel .agent .rag .tools .RagReference ;
14+ import com .embabel .agent .rag .neo .drivine .DrivineStore ;
15+ import com .embabel .agent .rag .tools .RagServiceReference ;
16+ import com .embabel .agent .rag .tools .ToolishRag ;
1517import com .embabel .chat .AssistantMessage ;
1618import com .embabel .chat .Chatbot ;
1719import com .embabel .chat .Conversation ;
@@ -46,11 +48,17 @@ public class GuideResponderAgent {
4648
4749 private final Logger logger = LoggerFactory .getLogger (GuideResponderAgent .class );
4850 private final GuideProperties guideProperties ;
51+ private final DrivineStore drivineStore ;
4952
50- public GuideResponderAgent (DataManager dataManager , DrivineGuideUserRepository guideUserRepository , GuideProperties guideProperties ) {
53+
54+ public GuideResponderAgent (DataManager dataManager ,
55+ DrivineGuideUserRepository guideUserRepository ,
56+ DrivineStore drivineStore ,
57+ GuideProperties guideProperties ) {
5158 this .dataManager = dataManager ;
5259 this .guideUserRepository = guideUserRepository ;
5360 this .guideProperties = guideProperties ;
61+ this .drivineStore = drivineStore ;
5462 }
5563
5664 static final String LAST_EVENT_WAS_USER_MESSAGE = "user_last" ;
@@ -80,7 +88,7 @@ private HasGuideUserData getGuideUser(@Nullable User user) {
8088 }
8189 case GuideUserWithWebUser wu -> {
8290 return guideUserRepository .findByWebUserId (wu .getWebUser ().getId ())
83- .orElseThrow (() -> new RuntimeException ("Missing user with id: " + wu .getWebUser ().getId ()));
91+ .orElseThrow (() -> new RuntimeException ("Missing user with id: " + wu .getWebUser ().getId ()));
8492 }
8593 case HasGuideUserData gu -> {
8694 return gu ;
@@ -104,17 +112,25 @@ ConversationStatus respond(
104112 var templateModel = new HashMap <String , Object >();
105113
106114 templateModel .put ("persona" , persona );
115+ var ragReference = new RagServiceReference ("docs" ,
116+ "Embabel docs" ,
117+ guideProperties .ragOptions (dataManager .embabelContentRagServiceFor (context )),
118+ context .ai ().withLlmByRole ("summarizer" ));
119+
120+ var toolishRag = new ToolishRag (
121+ "granular_docs" ,
122+ "Embabel docs with granular retrieval" ,
123+ drivineStore
124+ );
125+
107126 var assistantMessage = context
108127 .ai ()
109128 .withLlm (guideProperties .chatLlm ())
110129 .withId ("chat_response" )
111130 .withReferences (dataManager .referencesForUser (context .user ()))
112131 .withTools (CoreToolGroups .WEB )
113- .withReference (
114- new RagReference ("docs" ,
115- "Embabel docs" ,
116- guideProperties .ragOptions (dataManager .embabelContentRagServiceFor (context )),
117- context .ai ().withLlmByRole ("summarizer" )))
132+ // .withReference(ragReference)
133+ .withReferences (toolishRag )
118134 .withTemplate ("guide_system" )
119135 .respondWithSystemPrompt (conversation , templateModel );
120136 conversation .addMessage (assistantMessage );
0 commit comments