@@ -397,16 +397,16 @@ private void executePlanningLoop(
397397 // completedSteps to context management.
398398 // TODO should refactor the completed steps as message array format, similar to chat agent.
399399
400- Map <String , String > requestParams = new HashMap <>(allParams );
401-
400+ allParams .put ("_llm_model_id" , llm .getModelId ());
402401 if (hookRegistry != null && !completedSteps .isEmpty ()) {
403- requestParams .put ("_llm_model_id" , llm . getModelId ( ));
404- requestParams . put ( INTERACTIONS , ", " + String . join ( ", " , completedSteps ) );
402+ allParams .put (INTERACTIONS , ", " + String . join ( ", " , completedSteps ));
403+ Map < String , String > requestParams = new HashMap <>( allParams );
405404 try {
406405 AgentContextUtil .emitPreLLMHook (requestParams , completedSteps , null , memory , hookRegistry );
406+
407407 if (requestParams .get (INTERACTIONS ) != null || requestParams .get (INTERACTIONS ) != "" ) {
408- requestParams .put (COMPLETED_STEPS_FIELD , StringUtils .toJson (requestParams .get (INTERACTIONS )));
409- requestParams .put (INTERACTIONS , "" );
408+ allParams .put (COMPLETED_STEPS_FIELD , StringUtils .toJson (requestParams .get (INTERACTIONS )));
409+ allParams .put (INTERACTIONS , "" );
410410 }
411411 } catch (Exception e ) {
412412 log .error ("Failed to emit pre-LLM hook" , e );
@@ -419,7 +419,7 @@ private void executePlanningLoop(
419419 RemoteInferenceMLInput
420420 .builder ()
421421 .algorithm (FunctionName .REMOTE )
422- .inputDataset (RemoteInferenceInputDataSet .builder ().parameters (requestParams ).build ())
422+ .inputDataset (RemoteInferenceInputDataSet .builder ().parameters (allParams ).build ())
423423 .build (),
424424 null ,
425425 allParams .get (TENANT_ID_FIELD )
0 commit comments