corgy-w commented on code in PR #8551:
URL: https://github.com/apache/seatunnel/pull/8551#discussion_r1955785239
##########
seatunnel-transforms-v2/src/test/java/org/apache/seatunnel/transform/llm/LLMRequestJsonTest.java:
##########
@@ -209,4 +215,80 @@ void testCustomRequestJson() throws IOException {
"{\"messages\":[{\"role\":\"system\",\"content\":\"Determine
whether someone is Chinese or American by their
name\"},{\"role\":\"user\",\"content\":\"{\\\"id\\\":1,
\\\"name\\\":\\\"John\\\"}\"}],\"model\":\"custom-model\"}",
OBJECT_MAPPER.writeValueAsString(node));
}
+
+ @Mock
+ private HttpClient httpClient;
+
+ @Test
+ void testCustomOllamaRequestJson() throws IOException {
+
+ MockWebServer mockWebServer = new MockWebServer();
+ mockWebServer.start(11434);
+ // 设置模拟的 JSON 响应
+ String jsonResponse = "{\n" +
+ " \"model\": \"qwen:7b\",\n" +
+ " \"created_at\": \"2025-02-07T01:22:46.589856Z\",\n" +
+ " \"message\": {\n" +
+ " \"role\": \"assistant\",\n" +
+ " \"content\": \"Based on the information provided in
the JSON object, \\\"John\\\" does not inherently indicate if the person is
Chinese or American. The name \\\"John\\\" is commonly used across many
cultures. To determine a person's nationality based solely on their name, more
context would be needed.\"\n" +
+ " },\n" +
+ " \"done_reason\": \"stop\",\n" +
+ " \"done\": true,\n" +
+ " \"total_duration\": 14435322300,\n" +
+ " \"load_duration\": 28998200,\n" +
+ " \"prompt_eval_count\": 34,\n" +
+ " \"prompt_eval_duration\": 302000000,\n" +
+ " \"eval_count\": 56,\n" +
+ " \"eval_duration\": 14102000000\n" +
+ "}";
+
+ // 向 MockWebServer 添加响应
Review Comment:
Remind you to develop the habit of commenting in En
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]