Skip to content

Commit

Permalink
polish openAIKey
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Jan 3, 2025
1 parent dbd65ad commit b670292
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"configurations": [
{
"type": "java",
"name": "LangChain4JAIServicesDemo",
"request": "launch",
"mainClass": "com.learning.openai.LangChain4JAIServicesDemo",
"projectName": "playground-langchain4j"
},
{
"type": "java",
"name": "LangChain4JObservabilityDemo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Optional;

public class LangChain4JAIServicesDemo {

private static final Logger LOGGER = LoggerFactory.getLogger(LangChain4JAIServicesDemo.class);

public static void main(String[] args) {
// String openAIKey = System.getenv("OPEN_AI_KEY");
// OpenAiChatModel openAiChatModel = OpenAiChatModel.withApiKey("demo");
String openAIKey = System.getenv("OPEN_AI_KEY");
OpenAiChatModel openAiChatModel = OpenAiChatModel.builder()
.apiKey("demo")
.apiKey(Optional.ofNullable(openAIKey).orElse("demo"))
.modelName(OpenAiChatModelName.GPT_4_O_MINI)
.logRequests(false)
.logResponses(false)
Expand Down

0 comments on commit b670292

Please sign in to comment.