@@ -396,16 +396,16 @@ private void executePlanningLoop(
396396 // completedSteps to context management.
397397 // TODO should refactor the completed steps as message array format, similar to chat agent.
398398
399- Map <String , String > requestParams = new HashMap <>(allParams );
400-
399+ allParams .put ("_llm_model_id" , llm .getModelId ());
401400 if (hookRegistry != null && !completedSteps .isEmpty ()) {
402- requestParams .put ("_llm_model_id" , llm . getModelId ( ));
403- requestParams . put ( INTERACTIONS , ", " + String . join ( ", " , completedSteps ) );
401+ allParams .put (INTERACTIONS , ", " + String . join ( ", " , completedSteps ));
402+ Map < String , String > requestParams = new HashMap <>( allParams );
404403 try {
405404 AgentContextUtil .emitPreLLMHook (requestParams , completedSteps , null , memory , hookRegistry );
405+
406406 if (requestParams .get (INTERACTIONS ) != null || requestParams .get (INTERACTIONS ) != "" ) {
407- requestParams .put (COMPLETED_STEPS_FIELD , StringUtils .toJson (requestParams .get (INTERACTIONS )));
408- requestParams .put (INTERACTIONS , "" );
407+ allParams .put (COMPLETED_STEPS_FIELD , StringUtils .toJson (requestParams .get (INTERACTIONS )));
408+ allParams .put (INTERACTIONS , "" );
409409 }
410410 } catch (Exception e ) {
411411 log .error ("Failed to emit pre-LLM hook" , e );
@@ -418,7 +418,7 @@ private void executePlanningLoop(
418418 RemoteInferenceMLInput
419419 .builder ()
420420 .algorithm (FunctionName .REMOTE )
421- .inputDataset (RemoteInferenceInputDataSet .builder ().parameters (requestParams ).build ())
421+ .inputDataset (RemoteInferenceInputDataSet .builder ().parameters (allParams ).build ())
422422 .build (),
423423 null ,
424424 allParams .get (TENANT_ID_FIELD )
0 commit comments