Created
December 17, 2025 11:55
-
-
Save vinimonteiro/dc54be1eb8a0ac4f9ef4697065508f9a to your computer and use it in GitHub Desktop.
lc4j-simple-chat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import dev.langchain4j.model.chat.ChatModel; | |
| import dev.langchain4j.model.openai.OpenAiChatModel; | |
| public class Main { | |
| public static void main(String[] args){ | |
| final ChatModel model = OpenAiChatModel.builder() | |
| .baseUrl("http://langchain4j.dev/demo/openai/v1") | |
| .apiKey("demo") | |
| .modelName("gpt-4o-mini") | |
| .build(); | |
| final String answer = model.chat("Say 'Hello World' in portuguese"); | |
| System.out.println(answer); // "Olá Mundo" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment