|
5 | 5 |
|
6 | 6 | package org.opensearch.ml.engine.function_calling;
|
7 | 7 |
|
8 |
| -import static org.junit.Assert.*; |
9 | 8 | import static org.opensearch.ml.engine.algorithms.agent.AgentUtils.LLM_INTERFACE_BEDROCK_CONVERSE_DEEPSEEK_R1;
|
10 | 9 | import static org.opensearch.ml.engine.algorithms.agent.AgentUtils.LLM_RESPONSE_FILTER;
|
11 | 10 | import static org.opensearch.ml.engine.algorithms.agent.AgentUtils.TOOL_CALL_ID;
|
|
29 | 28 | import org.opensearch.ml.common.output.model.ModelTensor;
|
30 | 29 | import org.opensearch.ml.common.output.model.ModelTensorOutput;
|
31 | 30 | import org.opensearch.ml.common.output.model.ModelTensors;
|
| 31 | +import org.opensearch.ml.common.utils.StringUtils; |
32 | 32 | import org.opensearch.ml.repackage.com.google.common.collect.ImmutableMap;
|
33 | 33 |
|
34 | 34 | public class BedrockConverseDeepseekR1FunctionCallingTests {
|
@@ -77,8 +77,11 @@ public void supply() {
|
77 | 77 | Assert.assertEquals(1, messages.size());
|
78 | 78 | LLMMessage message = messages.get(0);
|
79 | 79 | Assert.assertEquals("user", message.getRole());
|
80 |
| - List<Map<String, Map<String, String>>> content = (List<Map<String, Map<String, String>>>) message.getContent(); |
81 |
| - Assert.assertEquals("test_tool_call_id", content.get(0).get("text").get(TOOL_CALL_ID)); |
82 |
| - Assert.assertEquals("test result for bedrock deepseek", content.get(0).get("text").get(TOOL_RESULT)); |
| 80 | + List<Object> content = (List<Object>) message.getContent(); |
| 81 | + Map<String, String> textMap = (Map<String, String>) content.get(0); |
| 82 | + String textJson = textMap.get("text"); |
| 83 | + Map<String, Object> resultMap = StringUtils.fromJson(textJson, "response"); |
| 84 | + Assert.assertEquals("test_tool_call_id", resultMap.get("tool_call_id")); |
| 85 | + Assert.assertEquals("test result for bedrock deepseek", resultMap.get("tool_result")); |
83 | 86 | }
|
84 | 87 | }
|
0 commit comments