diff --git a/src/main/java/com/kwan/springbootkwan/entity/openai/Main.java b/src/main/java/com/kwan/springbootkwan/entity/openai/Main.java index 2a80d72da8cbf0d96abb28f762e763b0f086de13..86a9bfea0ab5051cf9380ecebeddda5f995a3107 100644 --- a/src/main/java/com/kwan/springbootkwan/entity/openai/Main.java +++ b/src/main/java/com/kwan/springbootkwan/entity/openai/Main.java @@ -10,24 +10,23 @@ import java.util.List; public class Main { /** - * # 公司的key * os.environ["OPENAI_API_KEY"] = '' * os.environ["OPENAI_API_BASE"] = 'https://opencatgpt.openai.azure.com/' * os.environ["OPENAI_API_TYPE"] = 'azure' * os.environ["OPENAI_API_VERSION"] = '2023-05-15' */ public static void main(String[] args) throws Exception { - + final String question = "请解释一下java的多态"; // 装配请求集合 List azureAiMessageList = new ArrayList<>(); AzureAIChatRequest azureAiChatRequest = new AzureAIChatRequest(); AzureAIMessage azureAIMessage0 = new AzureAIMessage(); azureAIMessage0.setRole(AzureAIRole.SYSTEM.toString()); - azureAIMessage0.setContent("你是一个AI机器人,请根据提问进行回答"); + azureAIMessage0.setContent("你是一个AI机器人,请根据提问进行详细回答"); azureAiMessageList.add(azureAIMessage0); - execute(azureAiMessageList, azureAiChatRequest, "请解释一下java的多态"); + execute(azureAiMessageList, azureAiChatRequest, question); } private static void execute(List azureAiMessageList, AzureAIChatRequest azureAiChatRequest @@ -45,7 +44,7 @@ public class Main { azureAiChatRequest.setFrequencyPenalty(0); azureAiChatRequest.setStop(null); - AzureAIClient azureAIClient = new AzureAIClient("https://opencatgpt.openai.azure.com/", "", + AzureAIClient azureAIClient = new AzureAIClient("https://opencatgpt.openai.azure.com/", "70846324f01c4e5cb3cc11da28a1e091", "gpt-35-turbo", "2023-05-15"); AzureAIChatResponse azureAIChatResponse = azureAIClient.sendChatRequest(azureAiChatRequest); System.out.println(azureAIChatResponse.getChoices().get(0).getMessage());