2424import io .sentrius .agent .analysis .agents .agents .AgentConfig ;
2525import io .sentrius .agent .analysis .agents .agents .PromptBuilder ;
2626import io .sentrius .agent .analysis .agents .agents .VerbRegistry ;
27- import io .sentrius .agent .analysis .agents .interpreters .AgentContextInterpreter ;
2827import io .sentrius .agent .analysis .agents .interpreters .AsessmentListInterpreter ;
2928import io .sentrius .agent .analysis .agents .interpreters .ObjectListInterpreter ;
3029import io .sentrius .agent .analysis .agents .interpreters .ObjectNodeInterpreter ;
31- import io .sentrius .agent .analysis .agents .interpreters .StringInterpreter ;
3230import io .sentrius .agent .analysis .agents .interpreters .ZtatOutputInterpreter ;
3331import io .sentrius .agent .analysis .model .AssessedTerminal ;
3432import io .sentrius .agent .analysis .model .Assessment ;
35- import io .sentrius .agent .analysis .model .TerminalResponse ;
36- import io .sentrius .agent .analysis .model .WebSocky ;
3733import io .sentrius .agent .analysis .model .ZtatAsessment ;
3834import io .sentrius .agent .analysis .model .ZtatResponse ;
3935import io .sentrius .sso .core .dto .AgentCommunicationDTO ;
4541import io .sentrius .sso .core .dto .ztat .AtatRequest ;
4642import io .sentrius .sso .core .dto .ztat .ZtatRequestDTO ;
4743import io .sentrius .sso .core .exceptions .ZtatException ;
48- import io .sentrius .sso .core .model .verbs .DefaultInterpreter ;
4944import io .sentrius .sso .core .model .verbs .Verb ;
5045import io .sentrius .sso .core .services .agents .AgentClientService ;
5146import io .sentrius .sso .core .services .agents .LLMService ;
5449import io .sentrius .sso .genai .Message ;
5550import io .sentrius .sso .genai .Response ;
5651import io .sentrius .sso .genai .model .LLMRequest ;
57- import lombok .NonNull ;
5852import lombok .extern .slf4j .Slf4j ;
5953import org .springframework .beans .factory .annotation .Value ;
6054import org .springframework .stereotype .Service ;
6660 */
6761@ Service
6862@ Slf4j
69- public class AgentVerbs {
63+ public class AgentVerbs extends VerbBase {
7064
7165 final ZeroTrustClientService zeroTrustClientService ;
7266 final LLMService llmService ;
7367 final VerbRegistry verbRegistry ;
74- final AgentClientService agentClientService ;
7568
7669
77- @ Value ("${agent.ai.config}" )
78- private String agentConfigFile ;
70+
7971
8072 final ObjectMapper mapper = new ObjectMapper (new YAMLFactory ()); // Jackson ObjectMapper for YAML parsing
8173
@@ -88,14 +80,14 @@ public class AgentVerbs {
8880 * @throws JsonProcessingException If there is an error processing JSON during initialization.
8981 */
9082 public AgentVerbs ( @ Value ("${agent.ai.config}" ) String agentConfigFile ,
83+ @ Value ("${agent.ai.context.db.id:none}" ) String agentDatabaseContext ,
9184 ZeroTrustClientService zeroTrustClientService , LLMService llmService , VerbRegistry verbRegistry ,
9285 AgentClientService agentService
9386 ) throws JsonProcessingException {
87+ super (agentConfigFile , agentDatabaseContext , agentService );
9488 this .zeroTrustClientService = zeroTrustClientService ;
9589 this .llmService = llmService ;
9690 this .verbRegistry = verbRegistry ;
97- this .agentClientService = agentService ;
98- this .agentConfigFile = agentConfigFile ;
9991
10092 log .info ("Loading agent config from {}" , agentConfigFile );
10193 }
@@ -112,11 +104,8 @@ public AgentVerbs( @Value("${agent.ai.config}") String agentConfigFile,
112104 isAiCallable = false , requiresTokenManagement = true )
113105 public ArrayNode promptAgent (AgentExecution execution , Map <String , Object > args ) throws ZtatException ,
114106 IOException {
115- InputStream is = getClass ().getClassLoader ().getResourceAsStream (agentConfigFile );
116- if (is == null ) {
117- throw new RuntimeException (agentConfigFile + " not found on classpath" );
118- }
119- AgentConfig config = new ObjectMapper (new YAMLFactory ()).readValue (is , AgentConfig .class );
107+
108+ AgentConfig config = getAgentConfig (execution );
120109
121110 log .info ("Agent config loaded: {}" , config );
122111 PromptBuilder promptBuilder = new PromptBuilder (verbRegistry , config );
@@ -125,7 +114,7 @@ public ArrayNode promptAgent(AgentExecution execution, Map<String, Object> args)
125114
126115 messages .add (Message .builder ().role ("system" ).content (prompt ).build ());
127116
128- LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o" ).messages (messages ).build ();
117+ LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o-mini " ).messages (messages ).build ();
129118 var resp = llmService .askQuestion (execution , chatRequest );
130119 execution .addMessages ( messages );
131120 Response response = JsonUtil .MAPPER .readValue (resp , Response .class );
@@ -232,7 +221,7 @@ public String justifyAgent(AgentExecution execution, ZtatRequestDTO ztatRequest,
232221 messages .add (Message .builder ().role ("system" ).content ("please respond in the following json " +
233222 "format: " + respondZtat ).build ());
234223
235- LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o" ).messages (messages ).build ();
224+ LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o-mini " ).messages (messages ).build ();
236225 execution .addMessages ( messages );
237226 var resp = llmService .askQuestion (execution , chatRequest );
238227 Response response = JsonUtil .MAPPER .readValue (resp , Response .class );
@@ -290,11 +279,7 @@ public String justifyAgent(AgentExecution execution, ZtatRequestDTO ztatRequest,
290279 inputInterpreter =
291280 ObjectListInterpreter .class , requiresTokenManagement = true )
292281 public List <AssessedTerminal > assessData (AgentExecution execution , List <?> objectList ) throws ZtatException , IOException {
293- InputStream is = getClass ().getClassLoader ().getResourceAsStream (agentConfigFile );
294- if (is == null ) {
295- throw new RuntimeException (agentConfigFile + " not found on classpath" );
296- }
297- AgentConfig config = new ObjectMapper (new YAMLFactory ()).readValue (is , AgentConfig .class );
282+ AgentConfig config = getAgentConfig (execution );
298283
299284 log .info ("Agent config loaded: {}" , config );
300285
@@ -311,7 +296,7 @@ public List<AssessedTerminal> assessData(AgentExecution execution, List<?> objec
311296
312297
313298
314- LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o" ).messages (messages ).build ();
299+ LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o-mini " ).messages (messages ).build ();
315300
316301 var resp = llmService .askQuestion (execution , chatRequest );
317302 Response response = JsonUtil .MAPPER .readValue (resp , Response .class );
@@ -346,7 +331,7 @@ public List<AssessedTerminal> assessData(AgentExecution execution, List<?> objec
346331 execution .addMessages (assistantMessage );
347332
348333
349- LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o" ).messages (messages ).build ();
334+ LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o-mini " ).messages (messages ).build ();
350335 execution .addMessages (messages );
351336 var resp = llmService .askQuestion (execution , chatRequest );
352337 Response response = JsonUtil .MAPPER .readValue (resp , Response .class );
@@ -431,11 +416,6 @@ public List<ZtatAsessment> analyzeAtatRequests(AgentExecution execution, List<At
431416 throws ZtatException ,
432417 IOException , TimeoutException {
433418 // set up context
434- InputStream is = getClass ().getClassLoader ().getResourceAsStream (agentConfigFile );
435- if (is == null ) {
436- throw new RuntimeException ("assessor-config.yaml not found on classpath" );
437-
438- }
439419
440420 InputStream assessZtatStream = getClass ().getClassLoader ().getResourceAsStream ("assess-ztat.json" );
441421 if (assessZtatStream == null ) {
@@ -444,7 +424,7 @@ public List<ZtatAsessment> analyzeAtatRequests(AgentExecution execution, List<At
444424 }
445425 String assessZtat = new String (assessZtatStream .readAllBytes ());
446426
447- AgentConfig config = new ObjectMapper ( new YAMLFactory ()). readValue ( is , AgentConfig . class );
427+ AgentConfig config = getAgentConfig ( execution );
448428 log .info ("Agent config loaded: {}" , config );
449429 List <ZtatAsessment > responses = new ArrayList <>();
450430 log .info ("Size of requests {}" , requests .size ());
@@ -466,7 +446,7 @@ public List<ZtatAsessment> analyzeAtatRequests(AgentExecution execution, List<At
466446
467447 log .info ("Messages is {}" , messages );
468448
469- LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o-mini" ).messages (messages ).build ();
449+ LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o-mini-mini " ).messages (messages ).build ();
470450 var resp = llmService .askQuestion (execution , chatRequest );
471451 Response response = JsonUtil .MAPPER .readValue (resp , Response .class );
472452 log .info ("Assess Response is {}" , resp );
@@ -530,7 +510,7 @@ public List<ZtatAsessment> analyzeAtatRequests(AgentExecution execution, List<At
530510
531511 log .info ("Messages is {}" , messages );
532512
533- chatRequest = LLMRequest .builder ().model ("gpt-4o-mini" ).messages (messages ).build ();
513+ chatRequest = LLMRequest .builder ().model ("gpt-4o-mini-mini " ).messages (messages ).build ();
534514 resp = llmService .askQuestion (execution , chatRequest );
535515 response = JsonUtil .MAPPER .readValue (resp , Response .class );
536516 if (response .getChoices ().isEmpty ()) {
@@ -644,7 +624,7 @@ public ObjectNode getEndpointsLike(AgentExecution execution, ObjectNode queryInp
644624 List <Message > messages = new ArrayList <>();
645625 messages .add ( listedEndpoints );
646626 execution .addMessages (Message .builder ().role ("user" ).content (queryInput .toString ()).build ());
647- LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o" ).messages (messages ).build ();
627+ LLMRequest chatRequest = LLMRequest .builder ().model ("gpt-4o-mini " ).messages (messages ).build ();
648628 var resp = llmService .askQuestion (execution , chatRequest );
649629
650630 Response response = JsonUtil .MAPPER .readValue (resp , Response .class );
0 commit comments