Corrected the name of a constant.
This commit is contained in:
parent
2b22ffc5ea
commit
1a2a6582ad
@ -45,7 +45,7 @@ public class ChainWithDocumentLiveTest {
|
|||||||
ingestor.ingest(document);
|
ingestor.ingest(document);
|
||||||
|
|
||||||
ChatLanguageModel chatModel = OpenAiChatModel.builder()
|
ChatLanguageModel chatModel = OpenAiChatModel.builder()
|
||||||
.apiKey(Constants.OPEN_AI_KEY)
|
.apiKey(Constants.OPENAI_API_KEY)
|
||||||
.timeout(ofSeconds(60))
|
.timeout(ofSeconds(60))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class ChatWithDocumentLiveTest {
|
|||||||
|
|
||||||
Prompt prompt = promptTemplate.apply(variables);
|
Prompt prompt = promptTemplate.apply(variables);
|
||||||
ChatLanguageModel chatModel = OpenAiChatModel.builder()
|
ChatLanguageModel chatModel = OpenAiChatModel.builder()
|
||||||
.apiKey(Constants.OPEN_AI_KEY)
|
.apiKey(Constants.OPENAI_API_KEY)
|
||||||
.timeout(ofSeconds(60))
|
.timeout(ofSeconds(60))
|
||||||
.build();
|
.build();
|
||||||
AiMessage aiMessage = chatModel.generate(prompt.toUserMessage())
|
AiMessage aiMessage = chatModel.generate(prompt.toUserMessage())
|
||||||
|
@ -22,7 +22,7 @@ public class ChatWithMemoryLiveTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void givenMemory_whenPrompted_thenValidResponse() {
|
public void givenMemory_whenPrompted_thenValidResponse() {
|
||||||
ChatLanguageModel model = OpenAiChatModel.withApiKey(Constants.OPEN_AI_KEY);
|
ChatLanguageModel model = OpenAiChatModel.withApiKey(Constants.OPENAI_API_KEY);
|
||||||
ChatMemory chatMemory = TokenWindowChatMemory.withMaxTokens(300, new OpenAiTokenizer(GPT_3_5_TURBO));
|
ChatMemory chatMemory = TokenWindowChatMemory.withMaxTokens(300, new OpenAiTokenizer(GPT_3_5_TURBO));
|
||||||
|
|
||||||
chatMemory.add(userMessage("Hello, my name is Kumar"));
|
chatMemory.add(userMessage("Hello, my name is Kumar"));
|
||||||
|
@ -7,6 +7,6 @@ public class Constants {
|
|||||||
* registering for free at (https://platform.openai.com/signup) and then by navigating
|
* registering for free at (https://platform.openai.com/signup) and then by navigating
|
||||||
* to "Create new secret key" page at (https://platform.openai.com/account/api-keys).
|
* to "Create new secret key" page at (https://platform.openai.com/account/api-keys).
|
||||||
*/
|
*/
|
||||||
public static String OPEN_AI_KEY = "demo"; //"<OPEN_AI_KEY>";
|
public static String OPENAI_API_KEY = "<OPENAI_API_KEY>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class PromptTemplatesLiveTest {
|
|||||||
Prompt prompt = promptTemplate.apply(variables);
|
Prompt prompt = promptTemplate.apply(variables);
|
||||||
|
|
||||||
ChatLanguageModel model = OpenAiChatModel.builder()
|
ChatLanguageModel model = OpenAiChatModel.builder()
|
||||||
.apiKey(Constants.OPEN_AI_KEY)
|
.apiKey(Constants.OPENAI_API_KEY)
|
||||||
.modelName(GPT_3_5_TURBO)
|
.modelName(GPT_3_5_TURBO)
|
||||||
.temperature(0.3)
|
.temperature(0.3)
|
||||||
.build();
|
.build();
|
||||||
|
@ -34,7 +34,7 @@ public class ServiceWithToolsLiveTest {
|
|||||||
@Test
|
@Test
|
||||||
public void givenServiceWithTools_whenPrompted_thenValidResponse() {
|
public void givenServiceWithTools_whenPrompted_thenValidResponse() {
|
||||||
Assistant assistant = AiServices.builder(Assistant.class)
|
Assistant assistant = AiServices.builder(Assistant.class)
|
||||||
.chatLanguageModel(OpenAiChatModel.withApiKey(Constants.OPEN_AI_KEY))
|
.chatLanguageModel(OpenAiChatModel.withApiKey(Constants.OPENAI_API_KEY))
|
||||||
.tools(new Calculator())
|
.tools(new Calculator())
|
||||||
.chatMemory(MessageWindowChatMemory.withMaxMessages(10))
|
.chatMemory(MessageWindowChatMemory.withMaxMessages(10))
|
||||||
.build();
|
.build();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user