@@ -554,6 +554,63 @@ func SynthesizeActionsTool2(message string, actions []map[string]string) (update
554
554
return
555
555
}
556
556
557
+ // SynthesizeActionsTool3 update action as per user instruction
558
+ // // Tags:
559
+ // - @displayName: SynthesizeActionsTool3
560
+ //
561
+ // Parameters:
562
+ // - message_1: the first message from the llm
563
+ // - message_2: the second message from the llm
564
+ // - actions: the list of actions
565
+ //
566
+ // Returns:
567
+ // - updatedActions: the list of synthesized actions
568
+ func SynthesizeActionsTool3 (message_1 string , message_2 string , actions []map [string ]string ) (updatedActions []map [string ]string ) {
569
+ ctx := & logging.ContextMap {}
570
+
571
+ // Clean up the input messages
572
+ message_1 = strings .TrimSpace (strings .Trim (message_1 , "\" " ))
573
+ message_2 = strings .TrimSpace (strings .Trim (message_2 , "\" " ))
574
+
575
+ logging .Log .Debugf (ctx , "Tool 3 Synthesize Message 1: %s\n " , message_1 )
576
+ logging .Log .Debugf (ctx , "Tool 3 Synthesize Message 2: %s\n " , message_2 )
577
+
578
+ // Get synthesize actions find key from configuration
579
+ synthesizeActionsFindKey1 , exists := config .GlobalConfig .WORKFLOW_CONFIG_VARIABLES ["APP_PROMPT_TEMPLATE_SYNTHESIZE_ACTION_TOOL3_VALUE" ]
580
+ if ! exists {
581
+ errorMessage := fmt .Sprintf ("failed to load synthesize actions tool 3 find key from the configuration" )
582
+ logging .Log .Error (ctx , errorMessage )
583
+ panic (errorMessage )
584
+ }
585
+
586
+ synthesizeActionsFindKey2 , exists := config .GlobalConfig .WORKFLOW_CONFIG_VARIABLES ["APP_PROMPT_TEMPLATE_SYNTHESIZE_ACTION_FIND_KEY" ]
587
+ if ! exists {
588
+ errorMessage := fmt .Sprintf ("failed to load synthesize actions tool 3 find key from the configuration" )
589
+ logging .Log .Error (ctx , errorMessage )
590
+ panic (errorMessage )
591
+ }
592
+
593
+ // Initialize updatedActions with the input actions
594
+ updatedActions = actions
595
+
596
+ // Check the first dictionary in actions
597
+ if len (updatedActions ) > 0 {
598
+ firstAction := updatedActions [0 ]
599
+ if _ , ok := firstAction [synthesizeActionsFindKey1 ]; ok && len (message_1 ) != 0 {
600
+ // Replace the value with the input message
601
+ firstAction [synthesizeActionsFindKey1 ] = message_1
602
+ }
603
+
604
+ if _ , ok := firstAction [synthesizeActionsFindKey2 ]; ok && len (message_2 ) != 0 {
605
+ firstAction [synthesizeActionsFindKey2 ] = message_2
606
+ }
607
+ }
608
+
609
+ logging .Log .Debugf (ctx , "The Updated Actions: %q\n " , updatedActions )
610
+
611
+ return
612
+ }
613
+
557
614
// SynthesizeActionsTool11 synthesize actions based on user instruction
558
615
//
559
616
// Tags:
@@ -1846,6 +1903,39 @@ func SynthesizeSlashCommand(slashCmd, targetCmd, finalizeResult string) (result
1846
1903
return result
1847
1904
}
1848
1905
1906
+ // ProcessMWWorkflowInfo parses the mwWorkflowInfo string and logs its content.
1907
+ //
1908
+ // Parameters:
1909
+ // - mwWorkflowInfo: the workflow information in string format
1910
+ //
1911
+ // Returns:
1912
+ // - None
1913
+ func ProcessMWWorkflowInfo (mwWorkflowInfo string ) {
1914
+ ctx := & logging.ContextMap {}
1915
+
1916
+ // Replace single quotes with double quotes to make it valid JSON
1917
+ normalizedInfo := strings .ReplaceAll (mwWorkflowInfo , "'" , "\" " )
1918
+
1919
+ // Parse the JSON string into a generic map
1920
+ var parsedData map [string ]interface {}
1921
+ err := json .Unmarshal ([]byte (normalizedInfo ), & parsedData )
1922
+ if err != nil {
1923
+ logging .Log .Errorf (ctx , "Failed to parse mwWorkflowInfo: %v" , err )
1924
+ return
1925
+ }
1926
+
1927
+ // Convert the parsed data back to a single string
1928
+ // parsedString, err := json.MarshalIndent(parsedData, "", " ")
1929
+ parsedString , err := json .Marshal (parsedData )
1930
+ if err != nil {
1931
+ logging .Log .Errorf (ctx , "Failed to convert parsed data to string: %v" , err )
1932
+ return
1933
+ }
1934
+
1935
+ // Log the entire content as a single string
1936
+ logging .Log .Infof (ctx , "MWWorkflowInfo Content: %s" , string (parsedString ))
1937
+ }
1938
+
1849
1939
// GenerateActionsSubWorkflowPrompt generates system and user prompts for subworkflow identification.
1850
1940
//
1851
1941
// Tags:
0 commit comments