@@ -75,6 +75,14 @@ public class AgentUtilsTest {
7575 + "\" thought\" : \" Now I know the final answer\" ,\n "
7676 + "\" final_answer\" : \" PPLTool generates such query ```json source=iris_data | fields petal_length_in_cm,petal_width_in_cm | kmeans centroids=3 ```.\" \n }\n ```" ;
7777
78+ private String responseForFinalAnswerWithMultilines = "---------------------```json\n {\n "
79+ + "\" thought\" : \" Now I know the final answer\" ,\n "
80+ + "\" final_answer\" : \" PPLTool generates such query \n ```json source=iris_data | fields petal_length_in_cm,petal_width_in_cm | kmeans centroids=3 ```.\" \n }\n ```" ;
81+
82+ private String responseForFinalAnswerWithQuotes = "---------------------```json\n {\n "
83+ + "\" thought\" : \" Now I know the final answer\" ,\n "
84+ + "\" final_answer\" : \" PPLTool generates such query \n ```json source=iris_data | fields petal_length_in_cm,petal_width_in_cm | kmeans name=\" Jack\" ```.\" \n }\n ```" ;
85+
7886 private String wrongResponseForAction = "---------------------```json\n {\n "
7987 + "\" thought\" : \" Let's try VectorDBTool\" ,\n "
8088 + "\" action\" : \" After checking online weather forecasts, it looks like tomorrow will be sunny with a high of 25 degrees Celsius.\" \n }\n ```" ;
@@ -120,7 +128,7 @@ public void setup() {
120128 THOUGHT ,
121129 "Unfortunately the tools did not provide the weather forecast directly. Let me check online sources:" ,
122130 FINAL_ANSWER ,
123- "After checking online weather forecasts, it looks like tomorrow will be sunny with a high of 25 degrees Celsius.\" \n } \n ``` "
131+ "After checking online weather forecasts, it looks like tomorrow will be sunny with a high of 25 degrees Celsius."
124132 );
125133 llmResponseExpectedParseResults .put (responseForFinalAnswerInvalidJson , responseForFinalAnswerExpectedResultExpectedResult );
126134 Map responseForFinalAnswerWithJsonExpectedResultExpectedResult = Map
@@ -144,6 +152,24 @@ public void setup() {
144152 );
145153 llmResponseExpectedParseResults .put (wrongResponseForAction , wrongResponseForActionExpectedResultExpectedResult );
146154
155+ Map responseForFinalAnswerWithMultilinesExpectedResult = Map
156+ .of (
157+ THOUGHT ,
158+ "Now I know the final answer" ,
159+ FINAL_ANSWER ,
160+ "PPLTool generates such query \n ```json source=iris_data | fields petal_length_in_cm,petal_width_in_cm | kmeans centroids=3 ```."
161+ );
162+ llmResponseExpectedParseResults .put (responseForFinalAnswerWithMultilines , responseForFinalAnswerWithMultilinesExpectedResult );
163+
164+ Map responseForFinalAnswerWithQuotesExpectedResult = Map
165+ .of (
166+ THOUGHT ,
167+ "Now I know the final answer" ,
168+ FINAL_ANSWER ,
169+ "PPLTool generates such query \n ```json source=iris_data | fields petal_length_in_cm,petal_width_in_cm | kmeans name=\" Jack\" ```."
170+ );
171+ llmResponseExpectedParseResults .put (responseForFinalAnswerWithQuotes , responseForFinalAnswerWithQuotesExpectedResult );
172+
147173 }
148174
149175 @ Test
@@ -442,7 +468,7 @@ public void testExtractMethods_FinalAnswer() {
442468 Assert .assertNull (actionInput );
443469 Assert
444470 .assertEquals (
445- "After checking online weather forecasts, it looks like tomorrow will be sunny with a high of 25 degrees Celsius.\" \n } \n ``` " ,
471+ "After checking online weather forecasts, it looks like tomorrow will be sunny with a high of 25 degrees Celsius." ,
446472 finalAnswer
447473 );
448474 }
0 commit comments