Created
January 27, 2025 09:28
-
-
Save maxandersen/72f219ef0f4f0e230a86372d6d839d54 to your computer and use it in GitHub Desktop.
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
///usr/bin/env jbang "$0" "$@" ; exit $? | |
/// Basic setup for using deepseek service with Quarkus/Langchain4j | |
/// To run this you need to have env variable OPENAI_API_KEY set | |
/// to an api key for deepseek which has money on their account. | |
//DEPS io.quarkus.platform:quarkus-bom:3.15.1@pom | |
//DEPS io.quarkus:quarkus-picocli | |
//DEPS io.quarkiverse.langchain4j:quarkus-langchain4j-openai:0.24.0.CR1 | |
//Q:CONFIG quarkus.banner.enabled=false | |
//Q:CONFIG quarkus.langchain4j.openai.api-key=${OPENAI_API_KEY} | |
//Q:CONFIG quarkus.langchain4j.openai.base-url=https://api.deepseek.com/v1 | |
//Q:CONFIG quarkus.langchain4j.openai.chat-model.model-name=deepseek-chat | |
import dev.langchain4j.model.chat.ChatLanguageModel; | |
import jakarta.inject.Inject; | |
import picocli.CommandLine.Command; | |
@Command | |
public class jokes implements Runnable { | |
@Inject | |
private ChatLanguageModel ai; | |
@Override | |
public void run() { | |
System.out.println("Asking for a joke..."); | |
System.out.println(ai.generate("tell me a joke about people with neonsigns behind their heads")); | |
} | |
} |
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
///usr/bin/env jbang "$0" "$@" ; exit $? | |
/// Basic setup for using ollama service with Quarkus/Langchain4j | |
/// To run this you need to have ollama installed and running | |
/// and pulled the deepseek-r1:8b model | |
/// | |
/// Note: if you do this in maven/gradle project quarkus dev would | |
/// do the ollama setup and pull for you. | |
//DEPS io.quarkus.platform:quarkus-bom:3.15.1@pom | |
//DEPS io.quarkus:quarkus-picocli | |
//DEPS io.quarkiverse.langchain4j:quarkus-langchain4j-ollama:0.24.0.CR1 | |
//Q:CONFIG quarkus.banner.enabled=false | |
//Q:CONFIG quarkus.log.level=WARN | |
//Q:CONFIG quarkus.langchain4j.ollama.chat-model.model-id=deepseek-r1:8b | |
//Q:CONFIG quarkus.langchain4j.ollama.timeout=60s | |
import dev.langchain4j.model.chat.ChatLanguageModel; | |
import jakarta.inject.Inject; | |
import picocli.CommandLine.Command; | |
@Command | |
public class localjokes implements Runnable { | |
@Inject | |
private ChatLanguageModel ai; | |
@Override | |
public void run() { | |
System.out.println("Asking for a joke..."); | |
System.out.println(ai.generate("tell me a joke about people with neonsigns behind their heads")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment