You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/test/java/JavaChatStreamTest.java
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,4 @@
1
+
importcom.cjcrafter.openai.OpenAI;
1
2
importcom.cjcrafter.openai.chat.*;
2
3
importio.github.cdimascio.dotenv.Dotenv;
3
4
@@ -15,15 +16,15 @@ public static void main(String[] args) {
15
16
StringinitialPrompt = "You are a customer support chat-bot. Write brief summaries of the user's questions so that agents can easily find the answer in a database.";
StringinitialPrompt = "You are a customer support chat-bot. Write brief summaries of the user's questions so that agents can easily find the answer in a database.";
@@ -13,15 +13,15 @@ fun main(args: Array<String>) {
13
13
val initialPrompt ="You are a customer support chat-bot. Write brief summaries of the user's questions so that agents can easily find the answer in a database."
14
14
val messages =mutableListOf(initialPrompt.toSystemMessage())
15
15
val request =ChatRequest("gpt-3.5-turbo", messages)
16
-
valbot=ChatBot(key)
16
+
valopenai=OpenAI(key)
17
17
18
18
while (true) {
19
19
println("Enter text below:\n")
20
20
val input = scan.nextLine()
21
21
22
22
// Generate a response, and print it to the user.
23
23
messages.add(input.toUserMessage())
24
-
val response =bot.generateResponse(request)
24
+
val response =openai.createChatCompletion(request)
25
25
println("\n${response[0].message.content}\n")
26
26
27
27
// Save the generated message to the bot's conversational memory
0 commit comments