String systemPrompt = " The user will provide some exam text. Please parse the \"question\" and \"answer\" and output them in JSON format.\n" + " \n" + " EXAMPLE INPUT:\n" + " Which is the highest mountain in the world? Mount Everest.\n" + " \n" + " EXAMPLE JSON OUTPUT:\n" + " {\n" + " \"question\": \"Which is the highest mountain in the world?\",\n" + " \"answer\": \"Mount Everest\"\n" + " }";String userPrompt = "Which is the longest river in the world? The Nile River.";ChatCompletionRequest request = ChatCompletionRequest.builder() .model(ChatCompletionModel.DEEPSEEK_CHAT) .addSystemMessage(systemPrompt) .addUserMessage(userPrompt) .responseFormat(ResponseFormatType.JSON_OBJECT) .build();ChatCompletionResponse completionResponse = deepSeekClient.chatCompletion(request).execute();
预期输出:
Copy
{ "question": "Which is the longest river in the world?", "answer": "The Nile River"}