diff --git a/bam/deployment/src/main/java/io/quarkiverse/langchain4j/bam/deployment/BamProcessor.java b/bam/deployment/src/main/java/io/quarkiverse/langchain4j/bam/deployment/BamProcessor.java index bbf1863e7..baf148671 100644 --- a/bam/deployment/src/main/java/io/quarkiverse/langchain4j/bam/deployment/BamProcessor.java +++ b/bam/deployment/src/main/java/io/quarkiverse/langchain4j/bam/deployment/BamProcessor.java @@ -1,8 +1,8 @@ package io.quarkiverse.langchain4j.bam.deployment; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.CHAT_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.EMBEDDING_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.STREAMING_CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.EMBEDDING_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.STREAMING_CHAT_MODEL; import java.util.List; @@ -12,7 +12,7 @@ import io.quarkiverse.langchain4j.ModelName; import io.quarkiverse.langchain4j.bam.runtime.BamRecorder; -import io.quarkiverse.langchain4j.bam.runtime.config.Langchain4jBamConfig; +import io.quarkiverse.langchain4j.bam.runtime.config.LangChain4jBamConfig; import io.quarkiverse.langchain4j.deployment.items.ChatModelProviderCandidateBuildItem; import io.quarkiverse.langchain4j.deployment.items.EmbeddingModelProviderCandidateBuildItem; import io.quarkiverse.langchain4j.deployment.items.SelectedChatModelProviderBuildItem; @@ -39,7 +39,7 @@ FeatureBuildItem feature() { @BuildStep public void providerCandidates(BuildProducer chatProducer, BuildProducer embeddingProducer, - Langchain4jBamBuildConfig config) { + LangChain4jBamBuildConfig config) { if (config.chatModel().enabled().isEmpty() || config.chatModel().enabled().get()) { chatProducer.produce(new ChatModelProviderCandidateBuildItem(PROVIDER)); @@ -56,7 +56,7 @@ public void providerCandidates(BuildProducer selectedChatItem, List selectedEmbedding, - Langchain4jBamConfig config, + LangChain4jBamConfig config, BuildProducer beanProducer) { for (var selected : selectedChatItem) { diff --git a/bam/deployment/src/main/java/io/quarkiverse/langchain4j/bam/deployment/Langchain4jBamBuildConfig.java b/bam/deployment/src/main/java/io/quarkiverse/langchain4j/bam/deployment/LangChain4jBamBuildConfig.java similarity index 91% rename from bam/deployment/src/main/java/io/quarkiverse/langchain4j/bam/deployment/Langchain4jBamBuildConfig.java rename to bam/deployment/src/main/java/io/quarkiverse/langchain4j/bam/deployment/LangChain4jBamBuildConfig.java index c8696f7d4..959f99f43 100644 --- a/bam/deployment/src/main/java/io/quarkiverse/langchain4j/bam/deployment/Langchain4jBamBuildConfig.java +++ b/bam/deployment/src/main/java/io/quarkiverse/langchain4j/bam/deployment/LangChain4jBamBuildConfig.java @@ -7,7 +7,7 @@ @ConfigRoot(phase = BUILD_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.bam") -public interface Langchain4jBamBuildConfig { +public interface LangChain4jBamBuildConfig { /** * Chat model related settings diff --git a/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AiChatServiceTest.java b/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AiChatServiceTest.java index 786de6ae1..485fa7af4 100644 --- a/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AiChatServiceTest.java +++ b/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AiChatServiceTest.java @@ -25,7 +25,7 @@ import io.quarkiverse.langchain4j.bam.Message; import io.quarkiverse.langchain4j.bam.Parameters; import io.quarkiverse.langchain4j.bam.TextGenerationRequest; -import io.quarkiverse.langchain4j.bam.runtime.config.Langchain4jBamConfig; +import io.quarkiverse.langchain4j.bam.runtime.config.LangChain4jBamConfig; import io.quarkus.test.QuarkusUnitTest; public class AiChatServiceTest { @@ -66,7 +66,7 @@ interface NewAIService { NewAIService service; @Inject - Langchain4jBamConfig langchain4jBamConfig; + LangChain4jBamConfig langchain4jBamConfig; @Test void chat() throws Exception { diff --git a/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AiStreamingServiceTest.java b/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AiStreamingServiceTest.java index 25ffcc7b5..3ba123443 100644 --- a/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AiStreamingServiceTest.java +++ b/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AiStreamingServiceTest.java @@ -25,7 +25,7 @@ import io.quarkiverse.langchain4j.bam.Message; import io.quarkiverse.langchain4j.bam.Parameters; import io.quarkiverse.langchain4j.bam.TextGenerationRequest; -import io.quarkiverse.langchain4j.bam.runtime.config.Langchain4jBamConfig; +import io.quarkiverse.langchain4j.bam.runtime.config.LangChain4jBamConfig; import io.quarkus.test.QuarkusUnitTest; import io.smallrye.mutiny.Multi; @@ -67,7 +67,7 @@ interface NewAIService { NewAIService service; @Inject - Langchain4jBamConfig langchain4jBamConfig; + LangChain4jBamConfig langchain4jBamConfig; @Test void chat() throws Exception { diff --git a/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AllPropertiesTest.java b/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AllPropertiesTest.java index 24a49f26e..9dfdcb5ab 100644 --- a/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AllPropertiesTest.java +++ b/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/AllPropertiesTest.java @@ -23,7 +23,7 @@ import io.quarkiverse.langchain4j.bam.Message; import io.quarkiverse.langchain4j.bam.Parameters; import io.quarkiverse.langchain4j.bam.TextGenerationRequest; -import io.quarkiverse.langchain4j.bam.runtime.config.Langchain4jBamConfig; +import io.quarkiverse.langchain4j.bam.runtime.config.LangChain4jBamConfig; import io.quarkus.test.QuarkusUnitTest; public class AllPropertiesTest { @@ -59,7 +59,7 @@ public class AllPropertiesTest { .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class).addClass(WireMockUtil.class)); @Inject - Langchain4jBamConfig langchain4jBamConfig; + LangChain4jBamConfig langchain4jBamConfig; @Inject ChatLanguageModel model; diff --git a/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/DefaultPropertiesTest.java b/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/DefaultPropertiesTest.java index bbafe06ea..3142649a9 100644 --- a/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/DefaultPropertiesTest.java +++ b/bam/deployment/src/test/java/io/quarkiverse/langchain4j/bam/deployment/DefaultPropertiesTest.java @@ -23,7 +23,7 @@ import io.quarkiverse.langchain4j.bam.Message; import io.quarkiverse.langchain4j.bam.Parameters; import io.quarkiverse.langchain4j.bam.TextGenerationRequest; -import io.quarkiverse.langchain4j.bam.runtime.config.Langchain4jBamConfig; +import io.quarkiverse.langchain4j.bam.runtime.config.LangChain4jBamConfig; import io.quarkus.test.QuarkusUnitTest; public class DefaultPropertiesTest { @@ -39,7 +39,7 @@ public class DefaultPropertiesTest { .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class).addClass(WireMockUtil.class)); @Inject - Langchain4jBamConfig langchain4jBamConfig; + LangChain4jBamConfig langchain4jBamConfig; @Inject ChatLanguageModel model; diff --git a/bam/runtime/src/main/java/io/quarkiverse/langchain4j/bam/runtime/BamRecorder.java b/bam/runtime/src/main/java/io/quarkiverse/langchain4j/bam/runtime/BamRecorder.java index 5dfaf58ff..5486090de 100644 --- a/bam/runtime/src/main/java/io/quarkiverse/langchain4j/bam/runtime/BamRecorder.java +++ b/bam/runtime/src/main/java/io/quarkiverse/langchain4j/bam/runtime/BamRecorder.java @@ -16,7 +16,7 @@ import io.quarkiverse.langchain4j.bam.BamStreamingChatModel; import io.quarkiverse.langchain4j.bam.runtime.config.ChatModelConfig; import io.quarkiverse.langchain4j.bam.runtime.config.EmbeddingModelConfig; -import io.quarkiverse.langchain4j.bam.runtime.config.Langchain4jBamConfig; +import io.quarkiverse.langchain4j.bam.runtime.config.LangChain4jBamConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkus.runtime.annotations.Recorder; import io.smallrye.config.ConfigValidationException; @@ -26,8 +26,8 @@ public class BamRecorder { private static final String DUMMY_KEY = "dummy"; - public Supplier chatModel(Langchain4jBamConfig runtimeConfig, String modelName) { - Langchain4jBamConfig.BamConfig bamConfig = correspondingBamConfig(runtimeConfig, modelName); + public Supplier chatModel(LangChain4jBamConfig runtimeConfig, String modelName) { + LangChain4jBamConfig.BamConfig bamConfig = correspondingBamConfig(runtimeConfig, modelName); if (bamConfig.enableIntegration()) { ChatModelConfig chatModelConfig = bamConfig.chatModel(); @@ -79,8 +79,8 @@ public ChatLanguageModel get() { } } - public Supplier streamingChatModel(Langchain4jBamConfig runtimeConfig, String modelName) { - Langchain4jBamConfig.BamConfig bamConfig = correspondingBamConfig(runtimeConfig, modelName); + public Supplier streamingChatModel(LangChain4jBamConfig runtimeConfig, String modelName) { + LangChain4jBamConfig.BamConfig bamConfig = correspondingBamConfig(runtimeConfig, modelName); if (bamConfig.enableIntegration()) { ChatModelConfig chatModelConfig = bamConfig.chatModel(); @@ -132,8 +132,8 @@ public StreamingChatLanguageModel get() { } } - public Supplier embeddingModel(Langchain4jBamConfig runtimeConfig, String modelName) { - Langchain4jBamConfig.BamConfig bamConfig = correspondingBamConfig(runtimeConfig, modelName); + public Supplier embeddingModel(LangChain4jBamConfig runtimeConfig, String modelName) { + LangChain4jBamConfig.BamConfig bamConfig = correspondingBamConfig(runtimeConfig, modelName); if (bamConfig.enableIntegration()) { EmbeddingModelConfig embeddingModelConfig = bamConfig.embeddingModel(); @@ -168,8 +168,8 @@ public EmbeddingModel get() { } } - private Langchain4jBamConfig.BamConfig correspondingBamConfig(Langchain4jBamConfig runtimeConfig, String modelName) { - Langchain4jBamConfig.BamConfig bamConfig; + private LangChain4jBamConfig.BamConfig correspondingBamConfig(LangChain4jBamConfig runtimeConfig, String modelName) { + LangChain4jBamConfig.BamConfig bamConfig; if (NamedModelUtil.isDefault(modelName)) { bamConfig = runtimeConfig.defaultConfig(); } else { diff --git a/bam/runtime/src/main/java/io/quarkiverse/langchain4j/bam/runtime/config/Langchain4jBamConfig.java b/bam/runtime/src/main/java/io/quarkiverse/langchain4j/bam/runtime/config/LangChain4jBamConfig.java similarity index 98% rename from bam/runtime/src/main/java/io/quarkiverse/langchain4j/bam/runtime/config/Langchain4jBamConfig.java rename to bam/runtime/src/main/java/io/quarkiverse/langchain4j/bam/runtime/config/LangChain4jBamConfig.java index f8cd2efe4..d5d7d2863 100644 --- a/bam/runtime/src/main/java/io/quarkiverse/langchain4j/bam/runtime/config/Langchain4jBamConfig.java +++ b/bam/runtime/src/main/java/io/quarkiverse/langchain4j/bam/runtime/config/LangChain4jBamConfig.java @@ -19,7 +19,7 @@ @ConfigRoot(phase = RUN_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.bam") -public interface Langchain4jBamConfig { +public interface LangChain4jBamConfig { /** * Default model config. diff --git a/bam/runtime/src/test/java/io/quarkiverse/langchain4j/bam/runtime/DisabledModelsBamRecorderTest.java b/bam/runtime/src/test/java/io/quarkiverse/langchain4j/bam/runtime/DisabledModelsBamRecorderTest.java index d5557f644..f8f673a50 100644 --- a/bam/runtime/src/test/java/io/quarkiverse/langchain4j/bam/runtime/DisabledModelsBamRecorderTest.java +++ b/bam/runtime/src/test/java/io/quarkiverse/langchain4j/bam/runtime/DisabledModelsBamRecorderTest.java @@ -10,13 +10,13 @@ import dev.langchain4j.model.chat.DisabledChatLanguageModel; import dev.langchain4j.model.chat.DisabledStreamingChatLanguageModel; import dev.langchain4j.model.embedding.DisabledEmbeddingModel; -import io.quarkiverse.langchain4j.bam.runtime.config.Langchain4jBamConfig; -import io.quarkiverse.langchain4j.bam.runtime.config.Langchain4jBamConfig.BamConfig; +import io.quarkiverse.langchain4j.bam.runtime.config.LangChain4jBamConfig; +import io.quarkiverse.langchain4j.bam.runtime.config.LangChain4jBamConfig.BamConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; class DisabledModelsBamRecorderTest { - Langchain4jBamConfig config = mock(Langchain4jBamConfig.class); + LangChain4jBamConfig config = mock(LangChain4jBamConfig.class); BamConfig defaultConfig = mock(BamConfig.class); BamRecorder recorder = new BamRecorder(); diff --git a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/AiServicesProcessor.java b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/AiServicesProcessor.java index d22a2268a..b39512612 100644 --- a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/AiServicesProcessor.java +++ b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/AiServicesProcessor.java @@ -3,9 +3,9 @@ import static dev.langchain4j.exception.IllegalConfigurationException.illegalConfiguration; import static dev.langchain4j.service.ServiceOutputParser.outputFormatInstructions; import static io.quarkiverse.langchain4j.deployment.ExceptionUtil.illegalConfigurationForMethod; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.BEAN_IF_EXISTS_RETRIEVAL_AUGMENTOR_SUPPLIER; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.NO_RETRIEVAL_AUGMENTOR_SUPPLIER; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.NO_RETRIEVER; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.BEAN_IF_EXISTS_RETRIEVAL_AUGMENTOR_SUPPLIER; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.NO_RETRIEVAL_AUGMENTOR_SUPPLIER; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.NO_RETRIEVER; import java.io.IOException; import java.io.InputStream; @@ -131,7 +131,7 @@ public void nativeSupport(CombinedIndexBuildItem indexBuildItem, List aiServicesMethodBuildItems, BuildProducer reflectiveClassProducer) { IndexView index = indexBuildItem.getIndex(); - Collection instances = index.getAnnotations(Langchain4jDotNames.DESCRIPTION); + Collection instances = index.getAnnotations(LangChain4jDotNames.DESCRIPTION); Set classesUsingDescription = new HashSet<>(); for (AnnotationInstance instance : instances) { if (instance.target().kind() != AnnotationTarget.Kind.FIELD) { @@ -174,7 +174,7 @@ public void findDeclarativeServices(CombinedIndexBuildItem indexBuildItem, Set chatModelNames = new HashSet<>(); boolean needModerationModelBean = false; - for (AnnotationInstance instance : index.getAnnotations(Langchain4jDotNames.REGISTER_AI_SERVICES)) { + for (AnnotationInstance instance : index.getAnnotations(LangChain4jDotNames.REGISTER_AI_SERVICES)) { if (instance.target().kind() != AnnotationTarget.Kind.CLASS) { continue; // should never happen } @@ -184,7 +184,7 @@ public void findDeclarativeServices(CombinedIndexBuildItem indexBuildItem, AnnotationValue chatLanguageModelSupplierValue = instance.value("chatLanguageModelSupplier"); if (chatLanguageModelSupplierValue != null) { chatLanguageModelSupplierClassDotName = chatLanguageModelSupplierValue.asClass().name(); - if (chatLanguageModelSupplierClassDotName.equals(Langchain4jDotNames.BEAN_CHAT_MODEL_SUPPLIER)) { // this is the case where the default was set, so we just ignore it + if (chatLanguageModelSupplierClassDotName.equals(LangChain4jDotNames.BEAN_CHAT_MODEL_SUPPLIER)) { // this is the case where the default was set, so we just ignore it chatLanguageModelSupplierClassDotName = null; } else { validateSupplierAndRegisterForReflection(chatLanguageModelSupplierClassDotName, index, @@ -212,12 +212,12 @@ public void findDeclarativeServices(CombinedIndexBuildItem indexBuildItem, } // the default value depends on whether tools exists or not - if they do, then we require a ChatMemoryProvider bean - DotName chatMemoryProviderSupplierClassDotName = Langchain4jDotNames.BEAN_CHAT_MEMORY_PROVIDER_SUPPLIER; + DotName chatMemoryProviderSupplierClassDotName = LangChain4jDotNames.BEAN_CHAT_MEMORY_PROVIDER_SUPPLIER; AnnotationValue chatMemoryProviderSupplierValue = instance.value("chatMemoryProviderSupplier"); if (chatMemoryProviderSupplierValue != null) { chatMemoryProviderSupplierClassDotName = chatMemoryProviderSupplierValue.asClass().name(); if (!chatMemoryProviderSupplierClassDotName - .equals(Langchain4jDotNames.BEAN_CHAT_MEMORY_PROVIDER_SUPPLIER)) { + .equals(LangChain4jDotNames.BEAN_CHAT_MEMORY_PROVIDER_SUPPLIER)) { validateSupplierAndRegisterForReflection(chatMemoryProviderSupplierClassDotName, index, reflectiveClassProducer); } @@ -261,7 +261,7 @@ public void findDeclarativeServices(CombinedIndexBuildItem indexBuildItem, } } - DotName auditServiceSupplierClassName = Langchain4jDotNames.BEAN_IF_EXISTS_AUDIT_SERVICE_SUPPLIER; + DotName auditServiceSupplierClassName = LangChain4jDotNames.BEAN_IF_EXISTS_AUDIT_SERVICE_SUPPLIER; AnnotationValue auditServiceSupplierValue = instance.value("auditServiceSupplier"); if (auditServiceSupplierValue != null) { auditServiceSupplierClassName = auditServiceSupplierValue.asClass().name(); @@ -272,9 +272,9 @@ public void findDeclarativeServices(CombinedIndexBuildItem indexBuildItem, AnnotationValue moderationModelSupplierValue = instance.value("moderationModelSupplier"); if (moderationModelSupplierValue != null) { moderationModelSupplierClassName = moderationModelSupplierValue.asClass().name(); - if (Langchain4jDotNames.NO_MODERATION_MODEL_SUPPLIER.equals(moderationModelSupplierClassName)) { + if (LangChain4jDotNames.NO_MODERATION_MODEL_SUPPLIER.equals(moderationModelSupplierClassName)) { moderationModelSupplierClassName = null; - } else if (Langchain4jDotNames.BEAN_MODERATION_MODEL_SUPPLIER.equals(moderationModelSupplierClassName)) { + } else if (LangChain4jDotNames.BEAN_MODERATION_MODEL_SUPPLIER.equals(moderationModelSupplierClassName)) { needModerationModelBean = true; } else { validateSupplierAndRegisterForReflection(moderationModelSupplierClassName, index, reflectiveClassProducer); @@ -373,13 +373,13 @@ public void handleDeclarativeServices(AiServicesRecorder recorder, // determine whether the method returns Multi boolean injectStreamingChatModelBean = false; for (MethodInfo method : declarativeAiServiceClassInfo.methods()) { - if (!Langchain4jDotNames.MULTI.equals(method.returnType().name())) { + if (!LangChain4jDotNames.MULTI.equals(method.returnType().name())) { continue; } boolean isMultiString = false; if (method.returnType().kind() == Type.Kind.PARAMETERIZED_TYPE) { Type multiType = method.returnType().asParameterizedType().arguments().get(0); - if (Langchain4jDotNames.STRING.equals(multiType.name())) { + if (LangChain4jDotNames.STRING.equals(multiType.name())) { isMultiString = true; } } @@ -401,23 +401,23 @@ public void handleDeclarativeServices(AiServicesRecorder recorder, injectStreamingChatModelBean))) .setRuntimeInit() .addQualifier() - .annotation(Langchain4jDotNames.QUARKUS_AI_SERVICE_CONTEXT_QUALIFIER).addValue("value", serviceClassName) + .annotation(LangChain4jDotNames.QUARKUS_AI_SERVICE_CONTEXT_QUALIFIER).addValue("value", serviceClassName) .done() .scope(Dependent.class); if ((chatLanguageModelSupplierClassName == null) && !selectedChatModelProvider.isEmpty()) { if (NamedModelUtil.isDefault(chatModelName)) { - configurator.addInjectionPoint(ClassType.create(Langchain4jDotNames.CHAT_MODEL)); + configurator.addInjectionPoint(ClassType.create(LangChain4jDotNames.CHAT_MODEL)); if (injectStreamingChatModelBean) { - configurator.addInjectionPoint(ClassType.create(Langchain4jDotNames.STREAMING_CHAT_MODEL)); + configurator.addInjectionPoint(ClassType.create(LangChain4jDotNames.STREAMING_CHAT_MODEL)); needsStreamingChatModelBean = true; } } else { - configurator.addInjectionPoint(ClassType.create(Langchain4jDotNames.CHAT_MODEL), + configurator.addInjectionPoint(ClassType.create(LangChain4jDotNames.CHAT_MODEL), AnnotationInstance.builder(ModelName.class).add("value", chatModelName).build()); if (injectStreamingChatModelBean) { - configurator.addInjectionPoint(ClassType.create(Langchain4jDotNames.STREAMING_CHAT_MODEL), + configurator.addInjectionPoint(ClassType.create(LangChain4jDotNames.STREAMING_CHAT_MODEL), AnnotationInstance.builder(ModelName.class).add("value", chatModelName).build()); needsStreamingChatModelBean = true; } @@ -433,8 +433,8 @@ public void handleDeclarativeServices(AiServicesRecorder recorder, } } - if (Langchain4jDotNames.BEAN_CHAT_MEMORY_PROVIDER_SUPPLIER.toString().equals(chatMemoryProviderSupplierClassName)) { - configurator.addInjectionPoint(ClassType.create(Langchain4jDotNames.CHAT_MEMORY_PROVIDER)); + if (LangChain4jDotNames.BEAN_CHAT_MEMORY_PROVIDER_SUPPLIER.toString().equals(chatMemoryProviderSupplierClassName)) { + configurator.addInjectionPoint(ClassType.create(LangChain4jDotNames.CHAT_MEMORY_PROVIDER)); needsChatMemoryProviderBean = true; } @@ -443,12 +443,12 @@ public void handleDeclarativeServices(AiServicesRecorder recorder, needsRetrieverBean = true; } - if (Langchain4jDotNames.BEAN_IF_EXISTS_RETRIEVAL_AUGMENTOR_SUPPLIER.toString() + if (LangChain4jDotNames.BEAN_IF_EXISTS_RETRIEVAL_AUGMENTOR_SUPPLIER.toString() .equals(retrievalAugmentorSupplierClassName)) { // Use a CDI bean of type `RetrievalAugmentor` if one exists, otherwise // don't use an augmentor. configurator.addInjectionPoint(ParameterizedType.create(CDI_INSTANCE, - new Type[] { ClassType.create(Langchain4jDotNames.RETRIEVAL_AUGMENTOR) }, null)); + new Type[] { ClassType.create(LangChain4jDotNames.RETRIEVAL_AUGMENTOR) }, null)); needsRetrievalAugmentorBean = true; } else { if (retrievalAugmentorSupplierClassName != null) { @@ -465,14 +465,14 @@ public void handleDeclarativeServices(AiServicesRecorder recorder, } } - if (Langchain4jDotNames.BEAN_IF_EXISTS_AUDIT_SERVICE_SUPPLIER.toString().equals(auditServiceClassSupplierName)) { + if (LangChain4jDotNames.BEAN_IF_EXISTS_AUDIT_SERVICE_SUPPLIER.toString().equals(auditServiceClassSupplierName)) { configurator.addInjectionPoint(ParameterizedType.create(CDI_INSTANCE, - new Type[] { ClassType.create(Langchain4jDotNames.AUDIT_SERVICE) }, null)); + new Type[] { ClassType.create(LangChain4jDotNames.AUDIT_SERVICE) }, null)); needsAuditServiceBean = true; } - if (Langchain4jDotNames.BEAN_MODERATION_MODEL_SUPPLIER.toString().equals(moderationModelSupplierClassName)) { - configurator.addInjectionPoint(ClassType.create(Langchain4jDotNames.MODERATION_MODEL)); + if (LangChain4jDotNames.BEAN_MODERATION_MODEL_SUPPLIER.toString().equals(moderationModelSupplierClassName)) { + configurator.addInjectionPoint(ClassType.create(LangChain4jDotNames.MODERATION_MODEL)); needsModerationModelBean = true; } @@ -480,25 +480,25 @@ public void handleDeclarativeServices(AiServicesRecorder recorder, } if (needsChatModelBean) { - unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(Langchain4jDotNames.CHAT_MODEL)); + unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(LangChain4jDotNames.CHAT_MODEL)); } if (needsStreamingChatModelBean) { - unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(Langchain4jDotNames.STREAMING_CHAT_MODEL)); + unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(LangChain4jDotNames.STREAMING_CHAT_MODEL)); } if (needsChatMemoryProviderBean) { - unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(Langchain4jDotNames.CHAT_MEMORY_PROVIDER)); + unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(LangChain4jDotNames.CHAT_MEMORY_PROVIDER)); } if (needsRetrieverBean) { - unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(Langchain4jDotNames.RETRIEVER)); + unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(LangChain4jDotNames.RETRIEVER)); } if (needsRetrievalAugmentorBean) { - unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(Langchain4jDotNames.RETRIEVAL_AUGMENTOR)); + unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(LangChain4jDotNames.RETRIEVAL_AUGMENTOR)); } if (needsAuditServiceBean) { - unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(Langchain4jDotNames.AUDIT_SERVICE)); + unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(LangChain4jDotNames.AUDIT_SERVICE)); } if (needsModerationModelBean) { - unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(Langchain4jDotNames.MODERATION_MODEL)); + unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(LangChain4jDotNames.MODERATION_MODEL)); } if (!allToolNames.isEmpty()) { unremoveableProducer.produce(UnremovableBeanBuildItem.beanTypes(allToolNames)); @@ -521,7 +521,7 @@ public void handleAiServices(AiServicesRecorder recorder, IndexView index = indexBuildItem.getIndex(); List aiServicesAnalysisResults = new ArrayList<>(); - for (ClassInfo classInfo : index.getKnownUsers(Langchain4jDotNames.AI_SERVICES)) { + for (ClassInfo classInfo : index.getKnownUsers(LangChain4jDotNames.AI_SERVICES)) { String className = classInfo.name().toString(); if (className.startsWith("io.quarkiverse.langchain4j") || className.startsWith("dev.langchain4j")) { // TODO: this can be made smarter if needed continue; @@ -551,7 +551,7 @@ public void handleAiServices(AiServicesRecorder recorder, if (classInfo == null) { continue; } - if (!classInfo.annotations(Langchain4jDotNames.MEMORY_ID).isEmpty() && !entry.getValue()) { + if (!classInfo.annotations(LangChain4jDotNames.MEMORY_ID).isEmpty() && !entry.getValue()) { log.warn("Class '" + className + "' is used in AiServices and while it leverages @MemoryId, a ChatMemoryProvider has not been configured. This will likely result in an exception being thrown when the service is used."); } @@ -653,7 +653,7 @@ public void handleAiServices(AiServicesRecorder recorder, ctor.setModifiers(Modifier.PUBLIC); ctor.addAnnotation(Inject.class); ctor.getParameterAnnotations(0) - .addAnnotation(Langchain4jDotNames.QUARKUS_AI_SERVICE_CONTEXT_QUALIFIER.toString()) + .addAnnotation(LangChain4jDotNames.QUARKUS_AI_SERVICE_CONTEXT_QUALIFIER.toString()) .add("value", ifaceName); ctor.invokeSpecialMethod(OBJECT_CONSTRUCTOR, ctor.getThis()); ctor.writeInstanceField(contextField, ctor.getThis(), @@ -752,8 +752,8 @@ private String createMethodId(MethodInfo methodInfo) { } private void addIfacesWithMessageAnns(IndexView index, Set detectedForCreate) { - List annotations = List.of(Langchain4jDotNames.SYSTEM_MESSAGE, Langchain4jDotNames.USER_MESSAGE, - Langchain4jDotNames.MODERATE); + List annotations = List.of(LangChain4jDotNames.SYSTEM_MESSAGE, LangChain4jDotNames.USER_MESSAGE, + LangChain4jDotNames.MODERATE); for (DotName annotation : annotations) { Collection instances = index.getAnnotations(annotation); for (AnnotationInstance instance : instances) { @@ -776,7 +776,7 @@ private void addIfacesWithMessageAnns(IndexView index, Set detectedForCr } private static void addCreatedAware(IndexView index, Set detectedForCreate) { - Collection instances = index.getAnnotations(Langchain4jDotNames.CREATED_AWARE); + Collection instances = index.getAnnotations(LangChain4jDotNames.CREATED_AWARE); for (var instance : instances) { if (instance.target().kind() != AnnotationTarget.Kind.CLASS) { continue; @@ -791,7 +791,7 @@ private AiServiceMethodCreateInfo gatherMethodMetadata(MethodInfo method, boolea throw illegalConfiguration("Return type of method '%s' cannot be void", method); } - boolean requiresModeration = method.hasAnnotation(Langchain4jDotNames.MODERATE); + boolean requiresModeration = method.hasAnnotation(LangChain4jDotNames.MODERATE); List params = method.parameters(); @@ -858,9 +858,9 @@ private List effectiveParamAnnotations(MethodParameterInfo p private Optional gatherSystemMessageInfo(MethodInfo method, List templateParams) { - AnnotationInstance instance = method.annotation(Langchain4jDotNames.SYSTEM_MESSAGE); + AnnotationInstance instance = method.annotation(LangChain4jDotNames.SYSTEM_MESSAGE); if (instance == null) { // try and see if the class is annotated with @SystemMessage - instance = method.declaringClass().declaredAnnotation(Langchain4jDotNames.SYSTEM_MESSAGE); + instance = method.declaringClass().declaredAnnotation(LangChain4jDotNames.SYSTEM_MESSAGE); } if (instance != null) { String systemMessageTemplate = ""; @@ -884,7 +884,7 @@ private Optional gatherSystemMessageInfo } private Optional gatherMemoryIdParamName(MethodInfo method) { - return method.annotations(Langchain4jDotNames.MEMORY_ID).stream().filter(IS_METHOD_PARAMETER_ANNOTATION) + return method.annotations(LangChain4jDotNames.MEMORY_ID).stream().filter(IS_METHOD_PARAMETER_ANNOTATION) .map(METHOD_PARAMETER_POSITION_FUNCTION) .findFirst(); } @@ -896,10 +896,10 @@ private AiServiceMethodCreateInfo.UserMessageInfo gatherUserMessageInfo(MethodIn if (!returnType.equals(Multi.class)) outputFormatInstructions = outputFormatInstructions(returnType); - Optional userNameParamName = method.annotations(Langchain4jDotNames.USER_NAME).stream().filter( + Optional userNameParamName = method.annotations(LangChain4jDotNames.USER_NAME).stream().filter( IS_METHOD_PARAMETER_ANNOTATION).map(METHOD_PARAMETER_POSITION_FUNCTION).findFirst(); - AnnotationInstance userMessageInstance = method.declaredAnnotation(Langchain4jDotNames.USER_MESSAGE); + AnnotationInstance userMessageInstance = method.declaredAnnotation(LangChain4jDotNames.USER_MESSAGE); if (userMessageInstance != null) { AnnotationValue delimiterValue = userMessageInstance.value("delimiter"); String delimiter = delimiterValue != null ? delimiterValue.asString() : DEFAULT_DELIMITER; @@ -920,7 +920,7 @@ private AiServiceMethodCreateInfo.UserMessageInfo gatherUserMessageInfo(MethodIn TemplateParameterInfo.toNameToArgsPositionMap(templateParams)), userNameParamName, outputFormatInstructions); } else { - Optional userMessageOnMethodParam = method.annotations(Langchain4jDotNames.USER_MESSAGE) + Optional userMessageOnMethodParam = method.annotations(LangChain4jDotNames.USER_MESSAGE) .stream() .filter(IS_METHOD_PARAMETER_ANNOTATION).findFirst(); if (userMessageOnMethodParam.isPresent()) { diff --git a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/BeansProcessor.java b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/BeansProcessor.java index ccb9a99ae..142c48daf 100644 --- a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/BeansProcessor.java +++ b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/BeansProcessor.java @@ -1,11 +1,11 @@ package io.quarkiverse.langchain4j.deployment; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.CHAT_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.EMBEDDING_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.IMAGE_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.MODEL_NAME; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.MODERATION_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.STREAMING_CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.EMBEDDING_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.IMAGE_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.MODEL_NAME; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.MODERATION_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.STREAMING_CHAT_MODEL; import java.util.HashSet; import java.util.List; @@ -33,7 +33,7 @@ import io.quarkiverse.langchain4j.deployment.items.SelectedEmbeddingModelCandidateBuildItem; import io.quarkiverse.langchain4j.deployment.items.SelectedImageModelProviderBuildItem; import io.quarkiverse.langchain4j.deployment.items.SelectedModerationModelProviderBuildItem; -import io.quarkiverse.langchain4j.runtime.Langchain4jRecorder; +import io.quarkiverse.langchain4j.runtime.LangChain4jRecorder; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkus.arc.deployment.BeanDiscoveryFinishedBuildItem; import io.quarkus.arc.deployment.UnremovableBeanBuildItem; @@ -336,7 +336,7 @@ private String selectEmbeddingModelProvider( @BuildStep @Record(ExecutionTime.RUNTIME_INIT) - public void cleanUp(Langchain4jRecorder recorder, ShutdownContextBuildItem shutdown) { + public void cleanUp(LangChain4jRecorder recorder, ShutdownContextBuildItem shutdown) { recorder.cleanUp(shutdown); } diff --git a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/Langchain4jDotNames.java b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/LangChain4jDotNames.java similarity index 99% rename from core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/Langchain4jDotNames.java rename to core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/LangChain4jDotNames.java index f8714a895..bcb3da627 100644 --- a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/Langchain4jDotNames.java +++ b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/LangChain4jDotNames.java @@ -26,7 +26,7 @@ import io.quarkiverse.langchain4j.runtime.aiservice.QuarkusAiServiceContextQualifier; import io.smallrye.mutiny.Multi; -public class Langchain4jDotNames { +public class LangChain4jDotNames { public static final DotName CHAT_MODEL = DotName.createSimple(ChatLanguageModel.class); public static final DotName STREAMING_CHAT_MODEL = DotName.createSimple(StreamingChatLanguageModel.class); public static final DotName EMBEDDING_MODEL = DotName.createSimple(EmbeddingModel.class); diff --git a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/PromptProcessor.java b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/PromptProcessor.java index 904cb4ecd..2b28ed3bf 100644 --- a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/PromptProcessor.java +++ b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/PromptProcessor.java @@ -77,7 +77,7 @@ public void structuredPromptSupport(StructuredPromptsRecorder recorder, BuildProducer transformerProducer) { IndexView index = combinedIndexBuildItem.getIndex(); - Collection instances = index.getAnnotations(Langchain4jDotNames.STRUCTURED_PROMPT); + Collection instances = index.getAnnotations(LangChain4jDotNames.STRUCTURED_PROMPT); for (AnnotationInstance instance : instances) { AnnotationTarget target = instance.target(); if (target.kind() != AnnotationTarget.Kind.CLASS) { @@ -125,7 +125,7 @@ private static boolean hasNestedParams(String promptTemplateString) { private void warnForUnsafeUsage(IndexView index) { Set candidates = new HashSet<>(); - for (ClassInfo classInfo : index.getKnownUsers(Langchain4jDotNames.STRUCTURED_PROMPT_PROCESSOR)) { + for (ClassInfo classInfo : index.getKnownUsers(LangChain4jDotNames.STRUCTURED_PROMPT_PROCESSOR)) { String className = classInfo.name().toString(); if (className.startsWith("io.quarkiverse.langchain4j") || className.startsWith("dev.langchain4j")) { // TODO: this can be made smarter if needed continue; @@ -153,7 +153,7 @@ private void warnForUnsafeUsage(IndexView index) { if (classInfo == null) { continue; } - if (!classInfo.hasDeclaredAnnotation(Langchain4jDotNames.STRUCTURED_PROMPT)) { + if (!classInfo.hasDeclaredAnnotation(LangChain4jDotNames.STRUCTURED_PROMPT)) { log.warn("Class '" + candidate + "' is used in StructuredPromptProcessor but it is not annotated with @StructuredPrompt. This will likely result in an exception being thrown when the prompt is used."); } diff --git a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/devui/Langchain4jDevUIProcessor.java b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/devui/LangChain4jDevUIProcessor.java similarity index 99% rename from core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/devui/Langchain4jDevUIProcessor.java rename to core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/devui/LangChain4jDevUIProcessor.java index d639d2127..db8ddf775 100644 --- a/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/devui/Langchain4jDevUIProcessor.java +++ b/core/deployment/src/main/java/io/quarkiverse/langchain4j/deployment/devui/LangChain4jDevUIProcessor.java @@ -20,7 +20,7 @@ import io.quarkus.devui.spi.page.CardPageBuildItem; import io.quarkus.devui.spi.page.Page; -public class Langchain4jDevUIProcessor { +public class LangChain4jDevUIProcessor { @BuildStep(onlyIf = IsDevelopment.class) CardPageBuildItem cardPage(List aiServices, diff --git a/core/deployment/src/test/java/io/quarkiverse/langchain4j/test/Langchain4jDevModeTest.java b/core/deployment/src/test/java/io/quarkiverse/langchain4j/test/LangChain4jDevModeTest.java similarity index 92% rename from core/deployment/src/test/java/io/quarkiverse/langchain4j/test/Langchain4jDevModeTest.java rename to core/deployment/src/test/java/io/quarkiverse/langchain4j/test/LangChain4jDevModeTest.java index 2528237d0..1dca75bf8 100644 --- a/core/deployment/src/test/java/io/quarkiverse/langchain4j/test/Langchain4jDevModeTest.java +++ b/core/deployment/src/test/java/io/quarkiverse/langchain4j/test/LangChain4jDevModeTest.java @@ -7,7 +7,7 @@ import io.quarkus.test.QuarkusDevModeTest; -public class Langchain4jDevModeTest { +public class LangChain4jDevModeTest { @RegisterExtension static final QuarkusDevModeTest devModeTest = new QuarkusDevModeTest() diff --git a/core/runtime/src/main/java/io/quarkiverse/langchain4j/QuarkusAiServicesFactory.java b/core/runtime/src/main/java/io/quarkiverse/langchain4j/QuarkusAiServicesFactory.java index f084144cf..810bb3906 100644 --- a/core/runtime/src/main/java/io/quarkiverse/langchain4j/QuarkusAiServicesFactory.java +++ b/core/runtime/src/main/java/io/quarkiverse/langchain4j/QuarkusAiServicesFactory.java @@ -62,7 +62,7 @@ public AiServices tools(List objectsWithTools) { List methodCreateInfos = lookup(objectWithTool); if ((methodCreateInfos == null) || methodCreateInfos.isEmpty()) { if ((methodCreateInfos == null) || methodCreateInfos.isEmpty()) { - continue; // this is what Langchain4j does + continue; // this is what LangChain4j does } } for (ToolMethodCreateInfo methodCreateInfo : methodCreateInfos) { diff --git a/core/runtime/src/main/java/io/quarkiverse/langchain4j/QuarkusJsonCodecFactory.java b/core/runtime/src/main/java/io/quarkiverse/langchain4j/QuarkusJsonCodecFactory.java index b5c0c1f79..8541b73a8 100644 --- a/core/runtime/src/main/java/io/quarkiverse/langchain4j/QuarkusJsonCodecFactory.java +++ b/core/runtime/src/main/java/io/quarkiverse/langchain4j/QuarkusJsonCodecFactory.java @@ -44,7 +44,7 @@ public T fromJson(String json, Class type) { return ObjectMapperHolder.MAPPER.readValue(json, type); } catch (JsonProcessingException e) { if ((e instanceof JsonParseException) && (type.isEnum())) { - // this is the case where Langchain4j simply passes the string value of the enum to Json.fromJson() + // this is the case where LangChain4j simply passes the string value of the enum to Json.fromJson() // and Jackson does not handle it Class enumClass = type.asSubclass(Enum.class); return (T) Enum.valueOf(enumClass, json); diff --git a/core/runtime/src/main/java/io/quarkiverse/langchain4j/RegisterAiService.java b/core/runtime/src/main/java/io/quarkiverse/langchain4j/RegisterAiService.java index 559405f98..05877287b 100644 --- a/core/runtime/src/main/java/io/quarkiverse/langchain4j/RegisterAiService.java +++ b/core/runtime/src/main/java/io/quarkiverse/langchain4j/RegisterAiService.java @@ -22,9 +22,9 @@ import io.quarkiverse.langchain4j.audit.AuditService; /** - * Used to create Langchain4j's {@link AiServices} in a declarative manner that the application can then use simply by + * Used to create LangChain4j's {@link AiServices} in a declarative manner that the application can then use simply by * using the class as a CDI bean. - * Under the hood Langchain4j's {@link AiServices#builder(Class)} is called + * Under the hood LangChain4j's {@link AiServices#builder(Class)} is called * while also providing the builder with the proper {@link ChatLanguageModel} bean (mandatory), {@code tools} bean (optional), * {@link ChatMemoryProvider} and {@link Retriever} beans (which by default are configured if such beans exist). *

diff --git a/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/Langchain4jRecorder.java b/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/LangChain4jRecorder.java similarity index 93% rename from core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/Langchain4jRecorder.java rename to core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/LangChain4jRecorder.java index 98febdf8f..4438f2717 100644 --- a/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/Langchain4jRecorder.java +++ b/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/LangChain4jRecorder.java @@ -4,7 +4,7 @@ import io.quarkus.runtime.annotations.Recorder; @Recorder -public class Langchain4jRecorder { +public class LangChain4jRecorder { public void cleanUp(ShutdownContext shutdown) { shutdown.addShutdownTask(new Runnable() { diff --git a/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/aiservice/AiServiceMethodImplementationSupport.java b/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/aiservice/AiServiceMethodImplementationSupport.java index 7aeaddd79..14514ee30 100644 --- a/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/aiservice/AiServiceMethodImplementationSupport.java +++ b/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/aiservice/AiServiceMethodImplementationSupport.java @@ -265,7 +265,7 @@ private static UserMessage prepareUserMessage(AiServiceContext context, AiServic String userName = null; if (userMessageInfo.getUserNameParamPosition().isPresent()) { userName = methodArgs[userMessageInfo.getUserNameParamPosition().get()] - .toString(); // Langchain4j does this, but might want to make anything other than a String a build time error + .toString(); // LangChain4j does this, but might want to make anything other than a String a build time error } if (userMessageInfo.getTemplate().isPresent()) { @@ -306,7 +306,7 @@ private static UserMessage createUserMessage(String name, String text) { private static Object transformTemplateParamValue(Object value) { if (value.getClass().isArray()) { - // Qute does not transform these values but Langchain4j expects to be converted to a [item1, item2, item3] like systax + // Qute does not transform these values but LangChain4j expects to be converted to a [item1, item2, item3] like systax return Arrays.toString((Object[]) value); } return value; @@ -330,7 +330,7 @@ private static Object memoryId(AiServiceMethodCreateInfo createInfo, Object[] me return "default"; } - //TODO: share these methods with Langchain4j + //TODO: share these methods with LangChain4j private static String toString(Object arg) { if (arg.getClass().isArray()) { diff --git a/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/devui/EmbeddingStoreJsonRPCService.java b/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/devui/EmbeddingStoreJsonRPCService.java index e1fd618b5..150e9d11d 100644 --- a/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/devui/EmbeddingStoreJsonRPCService.java +++ b/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/devui/EmbeddingStoreJsonRPCService.java @@ -44,7 +44,7 @@ private Metadata parseMetadata(String metadata) { } // FIXME: the limit argument can be changed to int after https://github.com/quarkusio/quarkus/issues/37481 is fixed - // Langchain4jDevUIJsonRpcTest will need to be adjusted accordingly + // LangChain4jDevUIJsonRpcTest will need to be adjusted accordingly public JsonArray findRelevant(String text, String limit) { int limitInt = Integer.parseInt(limit); JsonArray result = new JsonArray(); diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc index 1b06c63cf..fc23a4c7c 100644 --- a/docs/modules/ROOT/pages/index.adoc +++ b/docs/modules/ROOT/pages/index.adoc @@ -1,4 +1,4 @@ -= Quarkus Langchain4j += Quarkus LangChain4j include::./includes/attributes.adoc[] @@ -20,7 +20,7 @@ image::llms-big-picture.png[width=600,align="center"] == Quick Overview -To incorporate Quarkus Langchain4j into your Quarkus project, add the following Maven dependency: +To incorporate Quarkus LangChain4j into your Quarkus project, add the following Maven dependency: [source,xml,subs=attributes+] ---- @@ -65,12 +65,12 @@ During interaction, the LLM can invoke these tools and reflect on their output. <4> The `@UserMessage` annotation serves as the _prompt_. <5> The method invokes the LLM, initiating an exchange between the LLM and the application, beginning with the system message and then the user message. Your application triggers this method and receives the response. -== Advantages over vanilla Langchain4j +== Advantages over vanilla LangChain4j The extension offers the following advantages over using the vanilla https://github.com/langchain4j/langchain4j[LangChain4j] library in Quarkus: * Seamless integration with the Quarkus programming model -** CDI beans for the Langchain4j models +** CDI beans for the LangChain4j models ** Standard configuration properties for configuring said models * xref:ai-services.adoc[Declarative AI Services] * Built-in observability diff --git a/hugging-face/deployment/src/main/java/io/quarkiverse/langchain4j/huggingface/deployment/HuggingFaceProcessor.java b/hugging-face/deployment/src/main/java/io/quarkiverse/langchain4j/huggingface/deployment/HuggingFaceProcessor.java index 3e83e3114..49603c8c8 100644 --- a/hugging-face/deployment/src/main/java/io/quarkiverse/langchain4j/huggingface/deployment/HuggingFaceProcessor.java +++ b/hugging-face/deployment/src/main/java/io/quarkiverse/langchain4j/huggingface/deployment/HuggingFaceProcessor.java @@ -1,7 +1,7 @@ package io.quarkiverse.langchain4j.huggingface.deployment; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.CHAT_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.EMBEDDING_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.EMBEDDING_MODEL; import java.util.List; @@ -15,7 +15,7 @@ import io.quarkiverse.langchain4j.deployment.items.SelectedChatModelProviderBuildItem; import io.quarkiverse.langchain4j.deployment.items.SelectedEmbeddingModelCandidateBuildItem; import io.quarkiverse.langchain4j.huggingface.runtime.HuggingFaceRecorder; -import io.quarkiverse.langchain4j.huggingface.runtime.config.Langchain4jHuggingFaceConfig; +import io.quarkiverse.langchain4j.huggingface.runtime.config.LangChain4jHuggingFaceConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -37,7 +37,7 @@ FeatureBuildItem feature() { @BuildStep public void providerCandidates(BuildProducer chatProducer, BuildProducer embeddingProducer, - Langchain4jHuggingFaceBuildConfig config) { + LangChain4jHuggingFaceBuildConfig config) { if (config.chatModel().enabled().isEmpty() || config.chatModel().enabled().get()) { chatProducer.produce(new ChatModelProviderCandidateBuildItem(PROVIDER)); } @@ -52,7 +52,7 @@ public void providerCandidates(BuildProducer selectedChatItem, List selectedEmbedding, - Langchain4jHuggingFaceConfig config, + LangChain4jHuggingFaceConfig config, BuildProducer beanProducer) { for (var selected : selectedChatItem) { diff --git a/hugging-face/deployment/src/main/java/io/quarkiverse/langchain4j/huggingface/deployment/Langchain4jHuggingFaceBuildConfig.java b/hugging-face/deployment/src/main/java/io/quarkiverse/langchain4j/huggingface/deployment/LangChain4jHuggingFaceBuildConfig.java similarity index 92% rename from hugging-face/deployment/src/main/java/io/quarkiverse/langchain4j/huggingface/deployment/Langchain4jHuggingFaceBuildConfig.java rename to hugging-face/deployment/src/main/java/io/quarkiverse/langchain4j/huggingface/deployment/LangChain4jHuggingFaceBuildConfig.java index b7a4ac1e7..184451613 100644 --- a/hugging-face/deployment/src/main/java/io/quarkiverse/langchain4j/huggingface/deployment/Langchain4jHuggingFaceBuildConfig.java +++ b/hugging-face/deployment/src/main/java/io/quarkiverse/langchain4j/huggingface/deployment/LangChain4jHuggingFaceBuildConfig.java @@ -7,7 +7,7 @@ @ConfigRoot(phase = BUILD_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.huggingface") -public interface Langchain4jHuggingFaceBuildConfig { +public interface LangChain4jHuggingFaceBuildConfig { /** * Chat model related settings diff --git a/hugging-face/runtime/src/main/java/io/quarkiverse/langchain4j/huggingface/runtime/HuggingFaceRecorder.java b/hugging-face/runtime/src/main/java/io/quarkiverse/langchain4j/huggingface/runtime/HuggingFaceRecorder.java index d992e6315..46e1a3379 100644 --- a/hugging-face/runtime/src/main/java/io/quarkiverse/langchain4j/huggingface/runtime/HuggingFaceRecorder.java +++ b/hugging-face/runtime/src/main/java/io/quarkiverse/langchain4j/huggingface/runtime/HuggingFaceRecorder.java @@ -13,7 +13,7 @@ import io.quarkiverse.langchain4j.huggingface.QuarkusHuggingFaceEmbeddingModel; import io.quarkiverse.langchain4j.huggingface.runtime.config.ChatModelConfig; import io.quarkiverse.langchain4j.huggingface.runtime.config.EmbeddingModelConfig; -import io.quarkiverse.langchain4j.huggingface.runtime.config.Langchain4jHuggingFaceConfig; +import io.quarkiverse.langchain4j.huggingface.runtime.config.LangChain4jHuggingFaceConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkus.runtime.annotations.Recorder; import io.smallrye.config.ConfigValidationException; @@ -24,8 +24,8 @@ public class HuggingFaceRecorder { private static final String DUMMY_KEY = "dummy"; private static final String HUGGING_FACE_URL_MARKER = "api-inference.huggingface.co"; - public Supplier chatModel(Langchain4jHuggingFaceConfig runtimeConfig, String modelName) { - Langchain4jHuggingFaceConfig.HuggingFaceConfig huggingFaceConfig = correspondingHuggingFaceConfig(runtimeConfig, + public Supplier chatModel(LangChain4jHuggingFaceConfig runtimeConfig, String modelName) { + LangChain4jHuggingFaceConfig.HuggingFaceConfig huggingFaceConfig = correspondingHuggingFaceConfig(runtimeConfig, modelName); if (huggingFaceConfig.enableIntegration()) { @@ -76,8 +76,8 @@ public ChatLanguageModel get() { } } - public Supplier embeddingModel(Langchain4jHuggingFaceConfig runtimeConfig, String modelName) { - Langchain4jHuggingFaceConfig.HuggingFaceConfig huggingFaceConfig = correspondingHuggingFaceConfig(runtimeConfig, + public Supplier embeddingModel(LangChain4jHuggingFaceConfig runtimeConfig, String modelName) { + LangChain4jHuggingFaceConfig.HuggingFaceConfig huggingFaceConfig = correspondingHuggingFaceConfig(runtimeConfig, modelName); if (huggingFaceConfig.enableIntegration()) { @@ -114,9 +114,9 @@ public EmbeddingModel get() { } } - private Langchain4jHuggingFaceConfig.HuggingFaceConfig correspondingHuggingFaceConfig( - Langchain4jHuggingFaceConfig runtimeConfig, String modelName) { - Langchain4jHuggingFaceConfig.HuggingFaceConfig huggingFaceConfig; + private LangChain4jHuggingFaceConfig.HuggingFaceConfig correspondingHuggingFaceConfig( + LangChain4jHuggingFaceConfig runtimeConfig, String modelName) { + LangChain4jHuggingFaceConfig.HuggingFaceConfig huggingFaceConfig; if (NamedModelUtil.isDefault(modelName)) { huggingFaceConfig = runtimeConfig.defaultConfig(); } else { diff --git a/hugging-face/runtime/src/main/java/io/quarkiverse/langchain4j/huggingface/runtime/config/Langchain4jHuggingFaceConfig.java b/hugging-face/runtime/src/main/java/io/quarkiverse/langchain4j/huggingface/runtime/config/LangChain4jHuggingFaceConfig.java similarity index 97% rename from hugging-face/runtime/src/main/java/io/quarkiverse/langchain4j/huggingface/runtime/config/Langchain4jHuggingFaceConfig.java rename to hugging-face/runtime/src/main/java/io/quarkiverse/langchain4j/huggingface/runtime/config/LangChain4jHuggingFaceConfig.java index 8b5af104a..05efb730b 100644 --- a/hugging-face/runtime/src/main/java/io/quarkiverse/langchain4j/huggingface/runtime/config/Langchain4jHuggingFaceConfig.java +++ b/hugging-face/runtime/src/main/java/io/quarkiverse/langchain4j/huggingface/runtime/config/LangChain4jHuggingFaceConfig.java @@ -18,7 +18,7 @@ @ConfigRoot(phase = RUN_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.huggingface") -public interface Langchain4jHuggingFaceConfig { +public interface LangChain4jHuggingFaceConfig { /** * Default model config. diff --git a/hugging-face/runtime/src/test/java/io/quarkiverse/langchain4j/huggingface/runtime/DisabledModelsHuggingFaceRecorderTest.java b/hugging-face/runtime/src/test/java/io/quarkiverse/langchain4j/huggingface/runtime/DisabledModelsHuggingFaceRecorderTest.java index 47b9240f3..7a6575e97 100644 --- a/hugging-face/runtime/src/test/java/io/quarkiverse/langchain4j/huggingface/runtime/DisabledModelsHuggingFaceRecorderTest.java +++ b/hugging-face/runtime/src/test/java/io/quarkiverse/langchain4j/huggingface/runtime/DisabledModelsHuggingFaceRecorderTest.java @@ -8,12 +8,12 @@ import dev.langchain4j.model.chat.DisabledChatLanguageModel; import dev.langchain4j.model.embedding.DisabledEmbeddingModel; -import io.quarkiverse.langchain4j.huggingface.runtime.config.Langchain4jHuggingFaceConfig; -import io.quarkiverse.langchain4j.huggingface.runtime.config.Langchain4jHuggingFaceConfig.HuggingFaceConfig; +import io.quarkiverse.langchain4j.huggingface.runtime.config.LangChain4jHuggingFaceConfig; +import io.quarkiverse.langchain4j.huggingface.runtime.config.LangChain4jHuggingFaceConfig.HuggingFaceConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; class DisabledModelsHuggingFaceRecorderTest { - Langchain4jHuggingFaceConfig config = mock(Langchain4jHuggingFaceConfig.class); + LangChain4jHuggingFaceConfig config = mock(LangChain4jHuggingFaceConfig.class); HuggingFaceConfig defaultConfig = mock(HuggingFaceConfig.class); HuggingFaceRecorder recorder = new HuggingFaceRecorder(); diff --git a/integration-tests/devui/src/test/java/devui/Langchain4jDevUIJsonRpcTest.java b/integration-tests/devui/src/test/java/devui/LangChain4jDevUIJsonRpcTest.java similarity index 93% rename from integration-tests/devui/src/test/java/devui/Langchain4jDevUIJsonRpcTest.java rename to integration-tests/devui/src/test/java/devui/LangChain4jDevUIJsonRpcTest.java index 2bec40575..4453367c0 100644 --- a/integration-tests/devui/src/test/java/devui/Langchain4jDevUIJsonRpcTest.java +++ b/integration-tests/devui/src/test/java/devui/LangChain4jDevUIJsonRpcTest.java @@ -17,13 +17,13 @@ * Tests for the EmbeddingStoreJsonRPCService class that is used as the backend * called by the Dev UI. */ -public class Langchain4jDevUIJsonRpcTest extends DevUIJsonRPCTest { +public class LangChain4jDevUIJsonRpcTest extends DevUIJsonRPCTest { @RegisterExtension static final QuarkusDevModeTest config = new QuarkusDevModeTest() .withEmptyApplication(); - public Langchain4jDevUIJsonRpcTest() { + public LangChain4jDevUIJsonRpcTest() { super("io.quarkiverse.langchain4j.quarkus-langchain4j-core"); } diff --git a/integration-tests/openai/src/main/java/org/acme/example/openai/QuarkusRestApiResource.java b/integration-tests/openai/src/main/java/org/acme/example/openai/QuarkusRestApiResource.java index 78691a536..88004d18d 100644 --- a/integration-tests/openai/src/main/java/org/acme/example/openai/QuarkusRestApiResource.java +++ b/integration-tests/openai/src/main/java/org/acme/example/openai/QuarkusRestApiResource.java @@ -37,7 +37,7 @@ import dev.ai4j.openai4j.completion.CompletionResponse; import dev.ai4j.openai4j.embedding.EmbeddingResponse; import io.quarkiverse.langchain4j.openai.OpenAiRestApi; -import io.quarkiverse.langchain4j.openai.runtime.config.Langchain4jOpenAiConfig; +import io.quarkiverse.langchain4j.openai.runtime.config.LangChain4jOpenAiConfig; import io.quarkus.rest.client.reactive.QuarkusRestClientBuilder; import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; @@ -50,9 +50,9 @@ public class QuarkusRestApiResource { private final String token; private final String organizationId; - public QuarkusRestApiResource(Langchain4jOpenAiConfig runtimeConfig) + public QuarkusRestApiResource(LangChain4jOpenAiConfig runtimeConfig) throws URISyntaxException { - Langchain4jOpenAiConfig.OpenAiConfig openAiConfig = runtimeConfig.defaultConfig(); + LangChain4jOpenAiConfig.OpenAiConfig openAiConfig = runtimeConfig.defaultConfig(); this.restApi = QuarkusRestClientBuilder.newBuilder() .baseUri(new URI(openAiConfig.baseUrl())) .build(OpenAiRestApi.class); diff --git a/integration-tests/openai/src/main/java/org/acme/example/openai/chat/QuarkusOpenAiClientChatResource.java b/integration-tests/openai/src/main/java/org/acme/example/openai/chat/QuarkusOpenAiClientChatResource.java index 0fe987b90..ce4182ed6 100644 --- a/integration-tests/openai/src/main/java/org/acme/example/openai/chat/QuarkusOpenAiClientChatResource.java +++ b/integration-tests/openai/src/main/java/org/acme/example/openai/chat/QuarkusOpenAiClientChatResource.java @@ -11,7 +11,7 @@ import dev.ai4j.openai4j.chat.ChatCompletionChoice; import dev.ai4j.openai4j.chat.Delta; import io.quarkiverse.langchain4j.openai.QuarkusOpenAiClient; -import io.quarkiverse.langchain4j.openai.runtime.config.Langchain4jOpenAiConfig; +import io.quarkiverse.langchain4j.openai.runtime.config.LangChain4jOpenAiConfig; import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.Uni; @@ -20,7 +20,7 @@ public class QuarkusOpenAiClientChatResource { private final QuarkusOpenAiClient quarkusOpenAiClient; - public QuarkusOpenAiClientChatResource(Langchain4jOpenAiConfig runtimeConfig) { + public QuarkusOpenAiClientChatResource(LangChain4jOpenAiConfig runtimeConfig) { String token = runtimeConfig.defaultConfig().apiKey(); String baseUrl = runtimeConfig.defaultConfig().baseUrl(); quarkusOpenAiClient = QuarkusOpenAiClient.builder().openAiApiKey(token).baseUrl(baseUrl).build(); diff --git a/integration-tests/simple-ollama/src/main/resources/META-INF/resources/index.html b/integration-tests/simple-ollama/src/main/resources/META-INF/resources/index.html index 3bba1b24e..7db2045f1 100644 --- a/integration-tests/simple-ollama/src/main/resources/META-INF/resources/index.html +++ b/integration-tests/simple-ollama/src/main/resources/META-INF/resources/index.html @@ -269,8 +269,8 @@

You just made a Quarkus application.

Selected extensions

  • RESTEasy Reactive (guide)
  • -
  • Langchain4j OpenAI
  • -
  • Langchain4j
  • +
  • LangChain4j OpenAI
  • +
  • LangChain4j
Documentation

Practical step-by-step guides to help you achieve a specific goal. Use them to help get your work diff --git a/ollama/deployment/src/main/java/io/quarkiverse/langchain4j/ollama/deployment/Langchain4jOllamaOpenAiBuildConfig.java b/ollama/deployment/src/main/java/io/quarkiverse/langchain4j/ollama/deployment/LangChain4jOllamaOpenAiBuildConfig.java similarity index 90% rename from ollama/deployment/src/main/java/io/quarkiverse/langchain4j/ollama/deployment/Langchain4jOllamaOpenAiBuildConfig.java rename to ollama/deployment/src/main/java/io/quarkiverse/langchain4j/ollama/deployment/LangChain4jOllamaOpenAiBuildConfig.java index 5efe1304e..d4c08fb0d 100644 --- a/ollama/deployment/src/main/java/io/quarkiverse/langchain4j/ollama/deployment/Langchain4jOllamaOpenAiBuildConfig.java +++ b/ollama/deployment/src/main/java/io/quarkiverse/langchain4j/ollama/deployment/LangChain4jOllamaOpenAiBuildConfig.java @@ -7,7 +7,7 @@ @ConfigRoot(phase = BUILD_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.ollama") -public interface Langchain4jOllamaOpenAiBuildConfig { +public interface LangChain4jOllamaOpenAiBuildConfig { /** * Chat model related settings diff --git a/ollama/deployment/src/main/java/io/quarkiverse/langchain4j/ollama/deployment/OllamaProcessor.java b/ollama/deployment/src/main/java/io/quarkiverse/langchain4j/ollama/deployment/OllamaProcessor.java index ff465eb0e..9b8268f63 100644 --- a/ollama/deployment/src/main/java/io/quarkiverse/langchain4j/ollama/deployment/OllamaProcessor.java +++ b/ollama/deployment/src/main/java/io/quarkiverse/langchain4j/ollama/deployment/OllamaProcessor.java @@ -1,7 +1,7 @@ package io.quarkiverse.langchain4j.ollama.deployment; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.CHAT_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.EMBEDDING_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.EMBEDDING_MODEL; import java.util.List; @@ -15,7 +15,7 @@ import io.quarkiverse.langchain4j.deployment.items.SelectedChatModelProviderBuildItem; import io.quarkiverse.langchain4j.deployment.items.SelectedEmbeddingModelCandidateBuildItem; import io.quarkiverse.langchain4j.ollama.runtime.OllamaRecorder; -import io.quarkiverse.langchain4j.ollama.runtime.config.Langchain4jOllamaConfig; +import io.quarkiverse.langchain4j.ollama.runtime.config.LangChain4jOllamaConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -37,7 +37,7 @@ FeatureBuildItem feature() { @BuildStep public void providerCandidates(BuildProducer chatProducer, BuildProducer embeddingProducer, - Langchain4jOllamaOpenAiBuildConfig config) { + LangChain4jOllamaOpenAiBuildConfig config) { if (config.chatModel().enabled().isEmpty() || config.chatModel().enabled().get()) { chatProducer.produce(new ChatModelProviderCandidateBuildItem(PROVIDER)); } @@ -52,7 +52,7 @@ public void providerCandidates(BuildProducer selectedChatItem, List selectedEmbedding, - Langchain4jOllamaConfig config, + LangChain4jOllamaConfig config, BuildProducer beanProducer) { for (var selected : selectedChatItem) { diff --git a/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/runtime/OllamaRecorder.java b/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/runtime/OllamaRecorder.java index eb7aba26e..36cd45474 100644 --- a/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/runtime/OllamaRecorder.java +++ b/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/runtime/OllamaRecorder.java @@ -11,15 +11,15 @@ import io.quarkiverse.langchain4j.ollama.Options; import io.quarkiverse.langchain4j.ollama.runtime.config.ChatModelConfig; import io.quarkiverse.langchain4j.ollama.runtime.config.EmbeddingModelConfig; -import io.quarkiverse.langchain4j.ollama.runtime.config.Langchain4jOllamaConfig; +import io.quarkiverse.langchain4j.ollama.runtime.config.LangChain4jOllamaConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkus.runtime.annotations.Recorder; @Recorder public class OllamaRecorder { - public Supplier chatModel(Langchain4jOllamaConfig runtimeConfig, String modelName) { - Langchain4jOllamaConfig.OllamaConfig ollamaConfig = correspondingOllamaConfig(runtimeConfig, modelName); + public Supplier chatModel(LangChain4jOllamaConfig runtimeConfig, String modelName) { + LangChain4jOllamaConfig.OllamaConfig ollamaConfig = correspondingOllamaConfig(runtimeConfig, modelName); if (ollamaConfig.enableIntegration()) { ChatModelConfig chatModelConfig = ollamaConfig.chatModel(); @@ -60,8 +60,8 @@ public ChatLanguageModel get() { } } - public Supplier embeddingModel(Langchain4jOllamaConfig runtimeConfig, String modelName) { - Langchain4jOllamaConfig.OllamaConfig ollamaConfig = correspondingOllamaConfig(runtimeConfig, modelName); + public Supplier embeddingModel(LangChain4jOllamaConfig runtimeConfig, String modelName) { + LangChain4jOllamaConfig.OllamaConfig ollamaConfig = correspondingOllamaConfig(runtimeConfig, modelName); if (ollamaConfig.enableIntegration()) { EmbeddingModelConfig embeddingModelConfig = ollamaConfig.embeddingModel(); @@ -96,9 +96,9 @@ public EmbeddingModel get() { } } - private Langchain4jOllamaConfig.OllamaConfig correspondingOllamaConfig(Langchain4jOllamaConfig runtimeConfig, + private LangChain4jOllamaConfig.OllamaConfig correspondingOllamaConfig(LangChain4jOllamaConfig runtimeConfig, String modelName) { - Langchain4jOllamaConfig.OllamaConfig ollamaConfig; + LangChain4jOllamaConfig.OllamaConfig ollamaConfig; if (NamedModelUtil.isDefault(modelName)) { ollamaConfig = runtimeConfig.defaultConfig(); } else { diff --git a/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/runtime/config/Langchain4jOllamaConfig.java b/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/runtime/config/LangChain4jOllamaConfig.java similarity index 97% rename from ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/runtime/config/Langchain4jOllamaConfig.java rename to ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/runtime/config/LangChain4jOllamaConfig.java index 3fea7bea7..d377d24da 100644 --- a/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/runtime/config/Langchain4jOllamaConfig.java +++ b/ollama/runtime/src/main/java/io/quarkiverse/langchain4j/ollama/runtime/config/LangChain4jOllamaConfig.java @@ -15,7 +15,7 @@ @ConfigRoot(phase = RUN_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.ollama") -public interface Langchain4jOllamaConfig { +public interface LangChain4jOllamaConfig { /** * Default model config. diff --git a/ollama/runtime/src/test/java/io/quarkiverse/langchain4j/ollama/runtime/DisabledModelsOllamaRecorderTest.java b/ollama/runtime/src/test/java/io/quarkiverse/langchain4j/ollama/runtime/DisabledModelsOllamaRecorderTest.java index 5f58e1d19..c0e7b6608 100644 --- a/ollama/runtime/src/test/java/io/quarkiverse/langchain4j/ollama/runtime/DisabledModelsOllamaRecorderTest.java +++ b/ollama/runtime/src/test/java/io/quarkiverse/langchain4j/ollama/runtime/DisabledModelsOllamaRecorderTest.java @@ -8,12 +8,12 @@ import dev.langchain4j.model.chat.DisabledChatLanguageModel; import dev.langchain4j.model.embedding.DisabledEmbeddingModel; -import io.quarkiverse.langchain4j.ollama.runtime.config.Langchain4jOllamaConfig; -import io.quarkiverse.langchain4j.ollama.runtime.config.Langchain4jOllamaConfig.OllamaConfig; +import io.quarkiverse.langchain4j.ollama.runtime.config.LangChain4jOllamaConfig; +import io.quarkiverse.langchain4j.ollama.runtime.config.LangChain4jOllamaConfig.OllamaConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; class DisabledModelsOllamaRecorderTest { - Langchain4jOllamaConfig config = mock(Langchain4jOllamaConfig.class); + LangChain4jOllamaConfig config = mock(LangChain4jOllamaConfig.class); OllamaConfig defaultConfig = mock(OllamaConfig.class); OllamaRecorder recorder = new OllamaRecorder(); diff --git a/openai/azure-openai/deployment/src/main/java/io/quarkiverse/langchain4j/azure/openai/deployment/AzureOpenAiProcessor.java b/openai/azure-openai/deployment/src/main/java/io/quarkiverse/langchain4j/azure/openai/deployment/AzureOpenAiProcessor.java index 2f5dcab5f..bd41b0a4f 100644 --- a/openai/azure-openai/deployment/src/main/java/io/quarkiverse/langchain4j/azure/openai/deployment/AzureOpenAiProcessor.java +++ b/openai/azure-openai/deployment/src/main/java/io/quarkiverse/langchain4j/azure/openai/deployment/AzureOpenAiProcessor.java @@ -1,9 +1,9 @@ package io.quarkiverse.langchain4j.azure.openai.deployment; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.CHAT_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.EMBEDDING_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.IMAGE_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.STREAMING_CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.EMBEDDING_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.IMAGE_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.STREAMING_CHAT_MODEL; import java.util.List; @@ -13,7 +13,7 @@ import io.quarkiverse.langchain4j.ModelName; import io.quarkiverse.langchain4j.azure.openai.runtime.AzureOpenAiRecorder; -import io.quarkiverse.langchain4j.azure.openai.runtime.config.Langchain4jAzureOpenAiConfig; +import io.quarkiverse.langchain4j.azure.openai.runtime.config.LangChain4jAzureOpenAiConfig; import io.quarkiverse.langchain4j.deployment.items.ChatModelProviderCandidateBuildItem; import io.quarkiverse.langchain4j.deployment.items.EmbeddingModelProviderCandidateBuildItem; import io.quarkiverse.langchain4j.deployment.items.ImageModelProviderCandidateBuildItem; @@ -45,7 +45,7 @@ public void providerCandidates(BuildProducer embeddingProducer, BuildProducer moderationProducer, BuildProducer imageProducer, - Langchain4jAzureOpenAiBuildConfig config) { + LangChain4jAzureOpenAiBuildConfig config) { if (config.chatModel().enabled().isEmpty() || config.chatModel().enabled().get()) { chatProducer.produce(new ChatModelProviderCandidateBuildItem(PROVIDER)); } @@ -64,7 +64,7 @@ void generateBeans(AzureOpenAiRecorder recorder, List selectedChatItem, List selectedEmbedding, List selectedImage, - Langchain4jAzureOpenAiConfig config, + LangChain4jAzureOpenAiConfig config, BuildProducer beanProducer) { for (var selected : selectedChatItem) { if (PROVIDER.equals(selected.getProvider())) { diff --git a/openai/azure-openai/deployment/src/main/java/io/quarkiverse/langchain4j/azure/openai/deployment/Langchain4jAzureOpenAiBuildConfig.java b/openai/azure-openai/deployment/src/main/java/io/quarkiverse/langchain4j/azure/openai/deployment/LangChain4jAzureOpenAiBuildConfig.java similarity index 93% rename from openai/azure-openai/deployment/src/main/java/io/quarkiverse/langchain4j/azure/openai/deployment/Langchain4jAzureOpenAiBuildConfig.java rename to openai/azure-openai/deployment/src/main/java/io/quarkiverse/langchain4j/azure/openai/deployment/LangChain4jAzureOpenAiBuildConfig.java index 98d4f6932..53a7aa626 100644 --- a/openai/azure-openai/deployment/src/main/java/io/quarkiverse/langchain4j/azure/openai/deployment/Langchain4jAzureOpenAiBuildConfig.java +++ b/openai/azure-openai/deployment/src/main/java/io/quarkiverse/langchain4j/azure/openai/deployment/LangChain4jAzureOpenAiBuildConfig.java @@ -7,7 +7,7 @@ @ConfigRoot(phase = BUILD_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.azure-openai") -public interface Langchain4jAzureOpenAiBuildConfig { +public interface LangChain4jAzureOpenAiBuildConfig { /** * Chat model related settings diff --git a/openai/azure-openai/runtime/src/main/java/io/quarkiverse/langchain4j/azure/openai/runtime/AzureOpenAiRecorder.java b/openai/azure-openai/runtime/src/main/java/io/quarkiverse/langchain4j/azure/openai/runtime/AzureOpenAiRecorder.java index 56d63b148..ff86cfe10 100644 --- a/openai/azure-openai/runtime/src/main/java/io/quarkiverse/langchain4j/azure/openai/runtime/AzureOpenAiRecorder.java +++ b/openai/azure-openai/runtime/src/main/java/io/quarkiverse/langchain4j/azure/openai/runtime/AzureOpenAiRecorder.java @@ -23,7 +23,7 @@ import io.quarkiverse.langchain4j.azure.openai.AzureOpenAiStreamingChatModel; import io.quarkiverse.langchain4j.azure.openai.runtime.config.ChatModelConfig; import io.quarkiverse.langchain4j.azure.openai.runtime.config.EmbeddingModelConfig; -import io.quarkiverse.langchain4j.azure.openai.runtime.config.Langchain4jAzureOpenAiConfig; +import io.quarkiverse.langchain4j.azure.openai.runtime.config.LangChain4jAzureOpenAiConfig; import io.quarkiverse.langchain4j.openai.QuarkusOpenAiClient; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkus.runtime.ShutdownContext; @@ -38,8 +38,8 @@ public class AzureOpenAiRecorder { static final String AZURE_ENDPOINT_URL_PATTERN = "https://%s.openai.azure.com/openai/deployments/%s"; public static final Problem[] EMPTY_PROBLEMS = new Problem[0]; - public Supplier chatModel(Langchain4jAzureOpenAiConfig runtimeConfig, String modelName) { - Langchain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig = correspondingAzureOpenAiConfig(runtimeConfig, modelName); + public Supplier chatModel(LangChain4jAzureOpenAiConfig runtimeConfig, String modelName) { + LangChain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig = correspondingAzureOpenAiConfig(runtimeConfig, modelName); if (azureAiConfig.enableIntegration()) { ChatModelConfig chatModelConfig = azureAiConfig.chatModel(); @@ -80,9 +80,9 @@ public ChatLanguageModel get() { } } - public Supplier streamingChatModel(Langchain4jAzureOpenAiConfig runtimeConfig, + public Supplier streamingChatModel(LangChain4jAzureOpenAiConfig runtimeConfig, String modelName) { - Langchain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig = correspondingAzureOpenAiConfig(runtimeConfig, modelName); + LangChain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig = correspondingAzureOpenAiConfig(runtimeConfig, modelName); if (azureAiConfig.enableIntegration()) { ChatModelConfig chatModelConfig = azureAiConfig.chatModel(); @@ -122,8 +122,8 @@ public StreamingChatLanguageModel get() { } } - public Supplier embeddingModel(Langchain4jAzureOpenAiConfig runtimeConfig, String modelName) { - Langchain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig = correspondingAzureOpenAiConfig(runtimeConfig, modelName); + public Supplier embeddingModel(LangChain4jAzureOpenAiConfig runtimeConfig, String modelName) { + LangChain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig = correspondingAzureOpenAiConfig(runtimeConfig, modelName); if (azureAiConfig.enableIntegration()) { EmbeddingModelConfig embeddingModelConfig = azureAiConfig.embeddingModel(); @@ -156,8 +156,8 @@ public EmbeddingModel get() { } } - public Supplier imageModel(Langchain4jAzureOpenAiConfig runtimeConfig, String modelName) { - Langchain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig = correspondingAzureOpenAiConfig(runtimeConfig, modelName); + public Supplier imageModel(LangChain4jAzureOpenAiConfig runtimeConfig, String modelName) { + LangChain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig = correspondingAzureOpenAiConfig(runtimeConfig, modelName); if (azureAiConfig.enableIntegration()) { var apiKey = azureAiConfig.apiKey(); @@ -218,14 +218,14 @@ public ImageModel get() { } } - static String getEndpoint(Langchain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig, String modelName) { + static String getEndpoint(LangChain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig, String modelName) { var endpoint = azureAiConfig.endpoint(); return (endpoint.isPresent() && !endpoint.get().trim().isBlank()) ? endpoint.get() : constructEndpointFromConfig(azureAiConfig, modelName); } - private static String constructEndpointFromConfig(Langchain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig, + private static String constructEndpointFromConfig(LangChain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig, String modelName) { var resourceName = azureAiConfig.resourceName(); var deploymentName = azureAiConfig.deploymentName(); @@ -247,10 +247,10 @@ private static String constructEndpointFromConfig(Langchain4jAzureOpenAiConfig.A return String.format(AZURE_ENDPOINT_URL_PATTERN, resourceName.get(), deploymentName.get()); } - private Langchain4jAzureOpenAiConfig.AzureAiConfig correspondingAzureOpenAiConfig( - Langchain4jAzureOpenAiConfig runtimeConfig, + private LangChain4jAzureOpenAiConfig.AzureAiConfig correspondingAzureOpenAiConfig( + LangChain4jAzureOpenAiConfig runtimeConfig, String modelName) { - Langchain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig; + LangChain4jAzureOpenAiConfig.AzureAiConfig azureAiConfig; if (NamedModelUtil.isDefault(modelName)) { azureAiConfig = runtimeConfig.defaultConfig(); } else { diff --git a/openai/azure-openai/runtime/src/main/java/io/quarkiverse/langchain4j/azure/openai/runtime/config/Langchain4jAzureOpenAiConfig.java b/openai/azure-openai/runtime/src/main/java/io/quarkiverse/langchain4j/azure/openai/runtime/config/LangChain4jAzureOpenAiConfig.java similarity index 98% rename from openai/azure-openai/runtime/src/main/java/io/quarkiverse/langchain4j/azure/openai/runtime/config/Langchain4jAzureOpenAiConfig.java rename to openai/azure-openai/runtime/src/main/java/io/quarkiverse/langchain4j/azure/openai/runtime/config/LangChain4jAzureOpenAiConfig.java index def95fc32..8492db2fe 100644 --- a/openai/azure-openai/runtime/src/main/java/io/quarkiverse/langchain4j/azure/openai/runtime/config/Langchain4jAzureOpenAiConfig.java +++ b/openai/azure-openai/runtime/src/main/java/io/quarkiverse/langchain4j/azure/openai/runtime/config/LangChain4jAzureOpenAiConfig.java @@ -18,7 +18,7 @@ @ConfigRoot(phase = RUN_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.azure-openai") -public interface Langchain4jAzureOpenAiConfig { +public interface LangChain4jAzureOpenAiConfig { /** * Default model config. diff --git a/openai/azure-openai/runtime/src/test/java/io/quarkiverse/langchain4j/azure/openai/runtime/AzureOpenAiRecorderEndpointTests.java b/openai/azure-openai/runtime/src/test/java/io/quarkiverse/langchain4j/azure/openai/runtime/AzureOpenAiRecorderEndpointTests.java index bd7036d17..07e952d14 100644 --- a/openai/azure-openai/runtime/src/test/java/io/quarkiverse/langchain4j/azure/openai/runtime/AzureOpenAiRecorderEndpointTests.java +++ b/openai/azure-openai/runtime/src/test/java/io/quarkiverse/langchain4j/azure/openai/runtime/AzureOpenAiRecorderEndpointTests.java @@ -13,7 +13,7 @@ import io.quarkiverse.langchain4j.azure.openai.runtime.config.ChatModelConfig; import io.quarkiverse.langchain4j.azure.openai.runtime.config.EmbeddingModelConfig; import io.quarkiverse.langchain4j.azure.openai.runtime.config.ImageModelConfig; -import io.quarkiverse.langchain4j.azure.openai.runtime.config.Langchain4jAzureOpenAiConfig; +import io.quarkiverse.langchain4j.azure.openai.runtime.config.LangChain4jAzureOpenAiConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.smallrye.config.ConfigValidationException; import io.smallrye.config.ConfigValidationException.Problem; @@ -21,7 +21,7 @@ class AzureOpenAiRecorderEndpointTests { private static final String CONFIG_ERROR_MESSAGE_TEMPLATE = "SRCFG00014: The config property quarkus.langchain4j.azure-openai.%s is required but it could not be found in any config source"; - Langchain4jAzureOpenAiConfig.AzureAiConfig config = spy(CustomAzureAiConfig.class); + LangChain4jAzureOpenAiConfig.AzureAiConfig config = spy(CustomAzureAiConfig.class); @Test void noEndpointConfigSet() { @@ -107,7 +107,7 @@ void resourceNameAndDeploymentNameSet() { .isEqualTo(String.format(AzureOpenAiRecorder.AZURE_ENDPOINT_URL_PATTERN, "resourceName", "deploymentName")); } - static class CustomLangchain4JAzureOpenAiConfig implements Langchain4jAzureOpenAiConfig { + static class CustomLangchain4JAzureOpenAiConfig implements LangChain4jAzureOpenAiConfig { private final AzureAiConfig azureAiConfig; @@ -126,7 +126,7 @@ public Map namedConfig() { } } - static class CustomAzureAiConfig implements Langchain4jAzureOpenAiConfig.AzureAiConfig { + static class CustomAzureAiConfig implements LangChain4jAzureOpenAiConfig.AzureAiConfig { @Override public Optional resourceName() { return Optional.empty(); diff --git a/openai/azure-openai/runtime/src/test/java/io/quarkiverse/langchain4j/azure/openai/runtime/DisabledModelsAzureOpenAiRecorderTest.java b/openai/azure-openai/runtime/src/test/java/io/quarkiverse/langchain4j/azure/openai/runtime/DisabledModelsAzureOpenAiRecorderTest.java index b33da6de3..a42422782 100644 --- a/openai/azure-openai/runtime/src/test/java/io/quarkiverse/langchain4j/azure/openai/runtime/DisabledModelsAzureOpenAiRecorderTest.java +++ b/openai/azure-openai/runtime/src/test/java/io/quarkiverse/langchain4j/azure/openai/runtime/DisabledModelsAzureOpenAiRecorderTest.java @@ -10,12 +10,12 @@ import dev.langchain4j.model.chat.DisabledStreamingChatLanguageModel; import dev.langchain4j.model.embedding.DisabledEmbeddingModel; import dev.langchain4j.model.image.DisabledImageModel; -import io.quarkiverse.langchain4j.azure.openai.runtime.config.Langchain4jAzureOpenAiConfig; -import io.quarkiverse.langchain4j.azure.openai.runtime.config.Langchain4jAzureOpenAiConfig.AzureAiConfig; +import io.quarkiverse.langchain4j.azure.openai.runtime.config.LangChain4jAzureOpenAiConfig; +import io.quarkiverse.langchain4j.azure.openai.runtime.config.LangChain4jAzureOpenAiConfig.AzureAiConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; class DisabledModelsAzureOpenAiRecorderTest { - Langchain4jAzureOpenAiConfig config = mock(Langchain4jAzureOpenAiConfig.class); + LangChain4jAzureOpenAiConfig config = mock(LangChain4jAzureOpenAiConfig.class); AzureAiConfig defaultConfig = mock(AzureAiConfig.class); AzureOpenAiRecorder recorder = new AzureOpenAiRecorder(); diff --git a/openai/openai-common/runtime/src/main/java/io/quarkiverse/langchain4j/openai/OpenAiRestApi.java b/openai/openai-common/runtime/src/main/java/io/quarkiverse/langchain4j/openai/OpenAiRestApi.java index 62f49c609..84e26966d 100644 --- a/openai/openai-common/runtime/src/main/java/io/quarkiverse/langchain4j/openai/OpenAiRestApi.java +++ b/openai/openai-common/runtime/src/main/java/io/quarkiverse/langchain4j/openai/OpenAiRestApi.java @@ -201,7 +201,7 @@ public void writeTo(Object o, Class type, Type genericType, Annotation[] anno class OpenAiRestApiJacksonReader extends AbstractJsonMessageBodyReader { /** - * Normally this is not necessary, but if one uses the 'demo' Langchain4j key, then the response comes back as type + * Normally this is not necessary, but if one uses the 'demo' LangChain4j key, then the response comes back as type * text/html * but the content is still JSON. */ diff --git a/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/Langchain4jOpenAiBuildConfig.java b/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/LangChain4jOpenAiBuildConfig.java similarity index 93% rename from openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/Langchain4jOpenAiBuildConfig.java rename to openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/LangChain4jOpenAiBuildConfig.java index 0cf5b97e1..e1ac11895 100644 --- a/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/Langchain4jOpenAiBuildConfig.java +++ b/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/LangChain4jOpenAiBuildConfig.java @@ -7,7 +7,7 @@ @ConfigRoot(phase = BUILD_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.openai") -public interface Langchain4jOpenAiBuildConfig { +public interface LangChain4jOpenAiBuildConfig { /** * Chat model related settings diff --git a/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/OpenAiProcessor.java b/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/OpenAiProcessor.java index 20efeffe9..736545d26 100644 --- a/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/OpenAiProcessor.java +++ b/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/OpenAiProcessor.java @@ -1,10 +1,10 @@ package io.quarkiverse.langchain4j.openai.deployment; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.CHAT_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.EMBEDDING_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.IMAGE_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.MODERATION_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.STREAMING_CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.EMBEDDING_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.IMAGE_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.MODERATION_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.STREAMING_CHAT_MODEL; import java.util.List; @@ -23,7 +23,7 @@ import io.quarkiverse.langchain4j.deployment.items.SelectedImageModelProviderBuildItem; import io.quarkiverse.langchain4j.deployment.items.SelectedModerationModelProviderBuildItem; import io.quarkiverse.langchain4j.openai.runtime.OpenAiRecorder; -import io.quarkiverse.langchain4j.openai.runtime.config.Langchain4jOpenAiConfig; +import io.quarkiverse.langchain4j.openai.runtime.config.LangChain4jOpenAiConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -49,7 +49,7 @@ public void providerCandidates(BuildProducer embeddingM BuildProducer embeddingProducer, BuildProducer moderationProducer, BuildProducer imageProducer, - Langchain4jOpenAiBuildConfig config) { + LangChain4jOpenAiBuildConfig config) { if (config.chatModel().enabled().isEmpty() || config.chatModel().enabled().get()) { chatProducer.produce(new ChatModelProviderCandidateBuildItem(PROVIDER)); } @@ -73,7 +73,7 @@ void generateBeans(OpenAiRecorder recorder, List selectedEmbedding, List selectedModeration, List selectedImage, - Langchain4jOpenAiConfig config, + LangChain4jOpenAiConfig config, BuildProducer beanProducer) { for (var selected : selectedChatItem) { diff --git a/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/devui/OpenAiDevUIProcessor.java b/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/devui/OpenAiDevUIProcessor.java index a8f20e51c..f89aa9bf2 100644 --- a/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/devui/OpenAiDevUIProcessor.java +++ b/openai/openai-vanilla/deployment/src/main/java/io/quarkiverse/langchain4j/openai/deployment/devui/OpenAiDevUIProcessor.java @@ -5,7 +5,7 @@ import io.quarkiverse.langchain4j.deployment.items.SelectedImageModelProviderBuildItem; import io.quarkiverse.langchain4j.deployment.items.SelectedModerationModelProviderBuildItem; -import io.quarkiverse.langchain4j.openai.deployment.Langchain4jOpenAiBuildConfig; +import io.quarkiverse.langchain4j.openai.deployment.LangChain4jOpenAiBuildConfig; import io.quarkiverse.langchain4j.openai.runtime.devui.OpenAiImagesJsonRPCService; import io.quarkiverse.langchain4j.openai.runtime.devui.OpenAiModerationModelsJsonRPCService; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; @@ -20,7 +20,7 @@ public class OpenAiDevUIProcessor { @BuildStep(onlyIf = IsDevelopment.class) CardPageBuildItem cardPage( - Langchain4jOpenAiBuildConfig config, + LangChain4jOpenAiBuildConfig config, List imageModels, List moderationModels) { CardPageBuildItem card = new CardPageBuildItem(); @@ -31,7 +31,7 @@ CardPageBuildItem cardPage( @BuildStep(onlyIf = IsDevelopment.class) void jsonRpcProviders(BuildProducer rpcProviders, - Langchain4jOpenAiBuildConfig config) { + LangChain4jOpenAiBuildConfig config) { if (config.imageModel().enabled().orElse(true)) { rpcProviders.produce(new JsonRPCProvidersBuildItem(OpenAiImagesJsonRPCService.class)); } @@ -41,7 +41,7 @@ void jsonRpcProviders(BuildProducer rpcProviders, } private void addImageModelPage( - Langchain4jOpenAiBuildConfig config, + LangChain4jOpenAiBuildConfig config, CardPageBuildItem card, List imageModels) { List configurations = new ArrayList<>(); @@ -65,7 +65,7 @@ private void addImageModelPage( } private void addModerationModelPage( - Langchain4jOpenAiBuildConfig config, + LangChain4jOpenAiBuildConfig config, CardPageBuildItem card, List moderationModels) { List configurations = new ArrayList<>(); diff --git a/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/OpenAiRecorder.java b/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/OpenAiRecorder.java index 57f3e8184..081b40190 100644 --- a/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/OpenAiRecorder.java +++ b/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/OpenAiRecorder.java @@ -26,7 +26,7 @@ import io.quarkiverse.langchain4j.openai.runtime.config.ChatModelConfig; import io.quarkiverse.langchain4j.openai.runtime.config.EmbeddingModelConfig; import io.quarkiverse.langchain4j.openai.runtime.config.ImageModelConfig; -import io.quarkiverse.langchain4j.openai.runtime.config.Langchain4jOpenAiConfig; +import io.quarkiverse.langchain4j.openai.runtime.config.LangChain4jOpenAiConfig; import io.quarkiverse.langchain4j.openai.runtime.config.ModerationModelConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkus.runtime.ShutdownContext; @@ -38,8 +38,8 @@ public class OpenAiRecorder { private static final String DUMMY_KEY = "dummy"; - public Supplier chatModel(Langchain4jOpenAiConfig runtimeConfig, String modelName) { - Langchain4jOpenAiConfig.OpenAiConfig openAiConfig = correspondingOpenAiConfig(runtimeConfig, modelName); + public Supplier chatModel(LangChain4jOpenAiConfig runtimeConfig, String modelName) { + LangChain4jOpenAiConfig.OpenAiConfig openAiConfig = correspondingOpenAiConfig(runtimeConfig, modelName); if (openAiConfig.enableIntegration()) { String apiKey = openAiConfig.apiKey(); @@ -83,8 +83,8 @@ public ChatLanguageModel get() { } } - public Supplier streamingChatModel(Langchain4jOpenAiConfig runtimeConfig, String modelName) { - Langchain4jOpenAiConfig.OpenAiConfig openAiConfig = correspondingOpenAiConfig(runtimeConfig, modelName); + public Supplier streamingChatModel(LangChain4jOpenAiConfig runtimeConfig, String modelName) { + LangChain4jOpenAiConfig.OpenAiConfig openAiConfig = correspondingOpenAiConfig(runtimeConfig, modelName); if (openAiConfig.enableIntegration()) { String apiKey = openAiConfig.apiKey(); @@ -127,8 +127,8 @@ public StreamingChatLanguageModel get() { } } - public Supplier embeddingModel(Langchain4jOpenAiConfig runtimeConfig, String modelName) { - Langchain4jOpenAiConfig.OpenAiConfig openAiConfig = correspondingOpenAiConfig(runtimeConfig, modelName); + public Supplier embeddingModel(LangChain4jOpenAiConfig runtimeConfig, String modelName) { + LangChain4jOpenAiConfig.OpenAiConfig openAiConfig = correspondingOpenAiConfig(runtimeConfig, modelName); if (openAiConfig.enableIntegration()) { String apiKeyOpt = openAiConfig.apiKey(); @@ -167,8 +167,8 @@ public EmbeddingModel get() { } } - public Supplier moderationModel(Langchain4jOpenAiConfig runtimeConfig, String modelName) { - Langchain4jOpenAiConfig.OpenAiConfig openAiConfig = correspondingOpenAiConfig(runtimeConfig, modelName); + public Supplier moderationModel(LangChain4jOpenAiConfig runtimeConfig, String modelName) { + LangChain4jOpenAiConfig.OpenAiConfig openAiConfig = correspondingOpenAiConfig(runtimeConfig, modelName); if (openAiConfig.enableIntegration()) { String apiKey = openAiConfig.apiKey(); @@ -203,8 +203,8 @@ public ModerationModel get() { } } - public Supplier imageModel(Langchain4jOpenAiConfig runtimeConfig, String modelName) { - Langchain4jOpenAiConfig.OpenAiConfig openAiConfig = correspondingOpenAiConfig(runtimeConfig, modelName); + public Supplier imageModel(LangChain4jOpenAiConfig runtimeConfig, String modelName) { + LangChain4jOpenAiConfig.OpenAiConfig openAiConfig = correspondingOpenAiConfig(runtimeConfig, modelName); if (openAiConfig.enableIntegration()) { String apiKey = openAiConfig.apiKey(); @@ -264,9 +264,9 @@ public ImageModel get() { } } - private Langchain4jOpenAiConfig.OpenAiConfig correspondingOpenAiConfig(Langchain4jOpenAiConfig runtimeConfig, + private LangChain4jOpenAiConfig.OpenAiConfig correspondingOpenAiConfig(LangChain4jOpenAiConfig runtimeConfig, String modelName) { - Langchain4jOpenAiConfig.OpenAiConfig openAiConfig; + LangChain4jOpenAiConfig.OpenAiConfig openAiConfig; if (NamedModelUtil.isDefault(modelName)) { openAiConfig = runtimeConfig.defaultConfig(); } else { diff --git a/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/config/Langchain4jOpenAiConfig.java b/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/config/LangChain4jOpenAiConfig.java similarity index 98% rename from openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/config/Langchain4jOpenAiConfig.java rename to openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/config/LangChain4jOpenAiConfig.java index 7cdd02e08..5e23df9b6 100644 --- a/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/config/Langchain4jOpenAiConfig.java +++ b/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/config/LangChain4jOpenAiConfig.java @@ -18,7 +18,7 @@ @ConfigRoot(phase = RUN_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.openai") -public interface Langchain4jOpenAiConfig { +public interface LangChain4jOpenAiConfig { /** * Default model config. diff --git a/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/devui/OpenAiImagesJsonRPCService.java b/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/devui/OpenAiImagesJsonRPCService.java index c704154c3..f0c4bde89 100644 --- a/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/devui/OpenAiImagesJsonRPCService.java +++ b/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/devui/OpenAiImagesJsonRPCService.java @@ -7,14 +7,14 @@ import dev.langchain4j.data.image.Image; import dev.langchain4j.model.image.ImageModel; import io.quarkiverse.langchain4j.openai.QuarkusOpenAiImageModel; -import io.quarkiverse.langchain4j.openai.runtime.config.Langchain4jOpenAiConfig; +import io.quarkiverse.langchain4j.openai.runtime.config.LangChain4jOpenAiConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.vertx.core.json.JsonObject; public class OpenAiImagesJsonRPCService { @Inject - Langchain4jOpenAiConfig config; + LangChain4jOpenAiConfig config; public JsonObject generate(String configuration, String modelName, String size, String prompt, String quality) { if (NamedModelUtil.isDefault(configuration) && config.defaultConfig().apiKey().equals("dummy")) { @@ -22,7 +22,7 @@ public JsonObject generate(String configuration, String modelName, String size, throw new RuntimeException("OpenAI API key is not configured. " + "Please specify the key in the `quarkus.langchain4j.openai.api-key` configuration property."); } - Langchain4jOpenAiConfig.OpenAiConfig clientConfig = NamedModelUtil.isDefault(configuration) ? config.defaultConfig() + LangChain4jOpenAiConfig.OpenAiConfig clientConfig = NamedModelUtil.isDefault(configuration) ? config.defaultConfig() : config.namedConfig().get(configuration); ImageModel model = QuarkusOpenAiImageModel.builder() .baseUrl(clientConfig.baseUrl()) diff --git a/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/devui/OpenAiModerationModelsJsonRPCService.java b/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/devui/OpenAiModerationModelsJsonRPCService.java index 3dbb88201..2b7d3be39 100644 --- a/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/devui/OpenAiModerationModelsJsonRPCService.java +++ b/openai/openai-vanilla/runtime/src/main/java/io/quarkiverse/langchain4j/openai/runtime/devui/OpenAiModerationModelsJsonRPCService.java @@ -9,7 +9,7 @@ import dev.ai4j.openai4j.moderation.ModerationResponse; import dev.ai4j.openai4j.moderation.ModerationResult; import dev.langchain4j.internal.RetryUtils; -import io.quarkiverse.langchain4j.openai.runtime.config.Langchain4jOpenAiConfig; +import io.quarkiverse.langchain4j.openai.runtime.config.LangChain4jOpenAiConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; @@ -17,7 +17,7 @@ public class OpenAiModerationModelsJsonRPCService { @Inject - Langchain4jOpenAiConfig config; + LangChain4jOpenAiConfig config; public JsonObject moderate(String configuration, String modelName, String prompt) { if (NamedModelUtil.isDefault(configuration) && config.defaultConfig().apiKey().equals("dummy")) { @@ -25,7 +25,7 @@ public JsonObject moderate(String configuration, String modelName, String prompt throw new RuntimeException("OpenAI API key is not configured. " + "Please specify the key in the `quarkus.langchain4j.openai.api-key` configuration property."); } - Langchain4jOpenAiConfig.OpenAiConfig clientConfig = NamedModelUtil.isDefault(configuration) ? config.defaultConfig() + LangChain4jOpenAiConfig.OpenAiConfig clientConfig = NamedModelUtil.isDefault(configuration) ? config.defaultConfig() : config.namedConfig().get(configuration); OpenAiClient client = OpenAiClient.builder().openAiApiKey(clientConfig.apiKey()).baseUrl(clientConfig.baseUrl()) .callTimeout(clientConfig.timeout()).connectTimeout(clientConfig.timeout()) diff --git a/openai/openai-vanilla/runtime/src/test/java/io/quarkiverse/langchain4j/openai/runtime/DisabledModelsOpenAiRecorderTest.java b/openai/openai-vanilla/runtime/src/test/java/io/quarkiverse/langchain4j/openai/runtime/DisabledModelsOpenAiRecorderTest.java index a07655d97..2b8cf1669 100644 --- a/openai/openai-vanilla/runtime/src/test/java/io/quarkiverse/langchain4j/openai/runtime/DisabledModelsOpenAiRecorderTest.java +++ b/openai/openai-vanilla/runtime/src/test/java/io/quarkiverse/langchain4j/openai/runtime/DisabledModelsOpenAiRecorderTest.java @@ -11,12 +11,12 @@ import dev.langchain4j.model.embedding.DisabledEmbeddingModel; import dev.langchain4j.model.image.DisabledImageModel; import dev.langchain4j.model.moderation.DisabledModerationModel; -import io.quarkiverse.langchain4j.openai.runtime.config.Langchain4jOpenAiConfig; -import io.quarkiverse.langchain4j.openai.runtime.config.Langchain4jOpenAiConfig.OpenAiConfig; +import io.quarkiverse.langchain4j.openai.runtime.config.LangChain4jOpenAiConfig; +import io.quarkiverse.langchain4j.openai.runtime.config.LangChain4jOpenAiConfig.OpenAiConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; class DisabledModelsOpenAiRecorderTest { - Langchain4jOpenAiConfig config = mock(Langchain4jOpenAiConfig.class); + LangChain4jOpenAiConfig config = mock(LangChain4jOpenAiConfig.class); OpenAiConfig defaultConfig = mock(OpenAiConfig.class); OpenAiRecorder recorder = new OpenAiRecorder(); diff --git a/openshift-ai/deployment/src/main/java/io/quarkiverse/langchain4j/openshift/ai/deployment/Langchain4jOpenshiftAiBuildConfig.java b/openshift-ai/deployment/src/main/java/io/quarkiverse/langchain4j/openshift/ai/deployment/LangChain4jOpenshiftAiBuildConfig.java similarity index 88% rename from openshift-ai/deployment/src/main/java/io/quarkiverse/langchain4j/openshift/ai/deployment/Langchain4jOpenshiftAiBuildConfig.java rename to openshift-ai/deployment/src/main/java/io/quarkiverse/langchain4j/openshift/ai/deployment/LangChain4jOpenshiftAiBuildConfig.java index 2ef5bde41..d927191ed 100644 --- a/openshift-ai/deployment/src/main/java/io/quarkiverse/langchain4j/openshift/ai/deployment/Langchain4jOpenshiftAiBuildConfig.java +++ b/openshift-ai/deployment/src/main/java/io/quarkiverse/langchain4j/openshift/ai/deployment/LangChain4jOpenshiftAiBuildConfig.java @@ -7,7 +7,7 @@ @ConfigRoot(phase = BUILD_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.openshift-ai") -public interface Langchain4jOpenshiftAiBuildConfig { +public interface LangChain4jOpenshiftAiBuildConfig { /** * Chat model related settings diff --git a/openshift-ai/deployment/src/main/java/io/quarkiverse/langchain4j/openshift/ai/deployment/OpenshiftAiProcessor.java b/openshift-ai/deployment/src/main/java/io/quarkiverse/langchain4j/openshift/ai/deployment/OpenshiftAiProcessor.java index 33e81c860..b3a3ad707 100644 --- a/openshift-ai/deployment/src/main/java/io/quarkiverse/langchain4j/openshift/ai/deployment/OpenshiftAiProcessor.java +++ b/openshift-ai/deployment/src/main/java/io/quarkiverse/langchain4j/openshift/ai/deployment/OpenshiftAiProcessor.java @@ -1,6 +1,6 @@ package io.quarkiverse.langchain4j.openshift.ai.deployment; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.CHAT_MODEL; import java.util.List; @@ -12,7 +12,7 @@ import io.quarkiverse.langchain4j.deployment.items.ChatModelProviderCandidateBuildItem; import io.quarkiverse.langchain4j.deployment.items.SelectedChatModelProviderBuildItem; import io.quarkiverse.langchain4j.openshiftai.runtime.OpenshiftAiRecorder; -import io.quarkiverse.langchain4j.openshiftai.runtime.config.Langchain4jOpenshiftAiConfig; +import io.quarkiverse.langchain4j.openshiftai.runtime.config.LangChain4jOpenshiftAiConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; @@ -34,7 +34,7 @@ FeatureBuildItem feature() { @BuildStep public void providerCandidates(BuildProducer chatProducer, - Langchain4jOpenshiftAiBuildConfig config) { + LangChain4jOpenshiftAiBuildConfig config) { if (config.chatModel().enabled().isEmpty() || config.chatModel().enabled().get()) { chatProducer.produce(new ChatModelProviderCandidateBuildItem(PROVIDER)); } @@ -45,7 +45,7 @@ public void providerCandidates(BuildProducer selectedChatItem, - Langchain4jOpenshiftAiConfig config, + LangChain4jOpenshiftAiConfig config, BuildProducer beanProducer) { for (var selected : selectedChatItem) { diff --git a/openshift-ai/runtime/src/main/java/io/quarkiverse/langchain4j/openshiftai/runtime/OpenshiftAiRecorder.java b/openshift-ai/runtime/src/main/java/io/quarkiverse/langchain4j/openshiftai/runtime/OpenshiftAiRecorder.java index c8e0199c4..e6164957a 100644 --- a/openshift-ai/runtime/src/main/java/io/quarkiverse/langchain4j/openshiftai/runtime/OpenshiftAiRecorder.java +++ b/openshift-ai/runtime/src/main/java/io/quarkiverse/langchain4j/openshiftai/runtime/OpenshiftAiRecorder.java @@ -9,7 +9,7 @@ import dev.langchain4j.model.chat.DisabledChatLanguageModel; import io.quarkiverse.langchain4j.openshiftai.OpenshiftAiChatModel; import io.quarkiverse.langchain4j.openshiftai.runtime.config.ChatModelConfig; -import io.quarkiverse.langchain4j.openshiftai.runtime.config.Langchain4jOpenshiftAiConfig; +import io.quarkiverse.langchain4j.openshiftai.runtime.config.LangChain4jOpenshiftAiConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkus.runtime.annotations.Recorder; import io.smallrye.config.ConfigValidationException; @@ -21,8 +21,8 @@ public class OpenshiftAiRecorder { private static final String DUMMY_MODEL_ID = "dummy"; public static final ConfigValidationException.Problem[] EMPTY_PROBLEMS = new ConfigValidationException.Problem[0]; - public Supplier chatModel(Langchain4jOpenshiftAiConfig runtimeConfig, String modelName) { - Langchain4jOpenshiftAiConfig.OpenshiftAiConfig openshiftAiConfig = correspondingOpenshiftAiConfig(runtimeConfig, + public Supplier chatModel(LangChain4jOpenshiftAiConfig runtimeConfig, String modelName) { + LangChain4jOpenshiftAiConfig.OpenshiftAiConfig openshiftAiConfig = correspondingOpenshiftAiConfig(runtimeConfig, modelName); if (openshiftAiConfig.enableIntegration()) { @@ -67,10 +67,10 @@ public ChatLanguageModel get() { } } - private Langchain4jOpenshiftAiConfig.OpenshiftAiConfig correspondingOpenshiftAiConfig( - Langchain4jOpenshiftAiConfig runtimeConfig, + private LangChain4jOpenshiftAiConfig.OpenshiftAiConfig correspondingOpenshiftAiConfig( + LangChain4jOpenshiftAiConfig runtimeConfig, String modelName) { - Langchain4jOpenshiftAiConfig.OpenshiftAiConfig openshiftAiConfig; + LangChain4jOpenshiftAiConfig.OpenshiftAiConfig openshiftAiConfig; if (NamedModelUtil.isDefault(modelName)) { openshiftAiConfig = runtimeConfig.defaultConfig(); } else { diff --git a/openshift-ai/runtime/src/main/java/io/quarkiverse/langchain4j/openshiftai/runtime/config/Langchain4jOpenshiftAiConfig.java b/openshift-ai/runtime/src/main/java/io/quarkiverse/langchain4j/openshiftai/runtime/config/LangChain4jOpenshiftAiConfig.java similarity index 97% rename from openshift-ai/runtime/src/main/java/io/quarkiverse/langchain4j/openshiftai/runtime/config/Langchain4jOpenshiftAiConfig.java rename to openshift-ai/runtime/src/main/java/io/quarkiverse/langchain4j/openshiftai/runtime/config/LangChain4jOpenshiftAiConfig.java index 271d51dce..6b008697e 100644 --- a/openshift-ai/runtime/src/main/java/io/quarkiverse/langchain4j/openshiftai/runtime/config/Langchain4jOpenshiftAiConfig.java +++ b/openshift-ai/runtime/src/main/java/io/quarkiverse/langchain4j/openshiftai/runtime/config/LangChain4jOpenshiftAiConfig.java @@ -17,7 +17,7 @@ @ConfigRoot(phase = RUN_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.openshift-ai") -public interface Langchain4jOpenshiftAiConfig { +public interface LangChain4jOpenshiftAiConfig { /** * Default model config. diff --git a/openshift-ai/runtime/src/test/java/io/quarkiverse/langchain4j/openshiftai/runtime/DisabledModelsOpenshiftAiRecorderTest.java b/openshift-ai/runtime/src/test/java/io/quarkiverse/langchain4j/openshiftai/runtime/DisabledModelsOpenshiftAiRecorderTest.java index 0b86c59eb..fc18ce8c9 100644 --- a/openshift-ai/runtime/src/test/java/io/quarkiverse/langchain4j/openshiftai/runtime/DisabledModelsOpenshiftAiRecorderTest.java +++ b/openshift-ai/runtime/src/test/java/io/quarkiverse/langchain4j/openshiftai/runtime/DisabledModelsOpenshiftAiRecorderTest.java @@ -7,12 +7,12 @@ import org.junit.jupiter.api.Test; import dev.langchain4j.model.chat.DisabledChatLanguageModel; -import io.quarkiverse.langchain4j.openshiftai.runtime.config.Langchain4jOpenshiftAiConfig; -import io.quarkiverse.langchain4j.openshiftai.runtime.config.Langchain4jOpenshiftAiConfig.OpenshiftAiConfig; +import io.quarkiverse.langchain4j.openshiftai.runtime.config.LangChain4jOpenshiftAiConfig; +import io.quarkiverse.langchain4j.openshiftai.runtime.config.LangChain4jOpenshiftAiConfig.OpenshiftAiConfig; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; class DisabledModelsOpenshiftAiRecorderTest { - Langchain4jOpenshiftAiConfig config = mock(Langchain4jOpenshiftAiConfig.class); + LangChain4jOpenshiftAiConfig config = mock(LangChain4jOpenshiftAiConfig.class); OpenshiftAiConfig defaultConfig = mock(OpenshiftAiConfig.class); OpenshiftAiRecorder recorder = new OpenshiftAiRecorder(); diff --git a/pgvector/deployment/src/main/java/io/quarkiverse/langchain4j/pgvector/deployment/Langchain4jPgvectorProcessor.java b/pgvector/deployment/src/main/java/io/quarkiverse/langchain4j/pgvector/deployment/LangChain4jPgvectorProcessor.java similarity index 98% rename from pgvector/deployment/src/main/java/io/quarkiverse/langchain4j/pgvector/deployment/Langchain4jPgvectorProcessor.java rename to pgvector/deployment/src/main/java/io/quarkiverse/langchain4j/pgvector/deployment/LangChain4jPgvectorProcessor.java index 2e328e43b..a0479e4b8 100644 --- a/pgvector/deployment/src/main/java/io/quarkiverse/langchain4j/pgvector/deployment/Langchain4jPgvectorProcessor.java +++ b/pgvector/deployment/src/main/java/io/quarkiverse/langchain4j/pgvector/deployment/LangChain4jPgvectorProcessor.java @@ -26,7 +26,7 @@ import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; -class Langchain4jPgvectorProcessor { +class LangChain4jPgvectorProcessor { public static final DotName PGVECTOR_EMBEDDING_STORE = DotName.createSimple(PgVectorEmbeddingStore.class); diff --git a/pgvector/deployment/src/test/java/io/quarkiverse/langchain4j/pgvector/test/Langchain4jPgvectorTest.java b/pgvector/deployment/src/test/java/io/quarkiverse/langchain4j/pgvector/test/LangChain4jPgvectorTest.java similarity index 96% rename from pgvector/deployment/src/test/java/io/quarkiverse/langchain4j/pgvector/test/Langchain4jPgvectorTest.java rename to pgvector/deployment/src/test/java/io/quarkiverse/langchain4j/pgvector/test/LangChain4jPgvectorTest.java index 1bc3a08e3..443b5185d 100644 --- a/pgvector/deployment/src/test/java/io/quarkiverse/langchain4j/pgvector/test/Langchain4jPgvectorTest.java +++ b/pgvector/deployment/src/test/java/io/quarkiverse/langchain4j/pgvector/test/LangChain4jPgvectorTest.java @@ -17,7 +17,7 @@ import io.quarkiverse.langchain4j.pgvector.PgVectorEmbeddingStore; import io.quarkus.test.QuarkusUnitTest; -public class Langchain4jPgvectorTest extends EmbeddingStoreIT { +public class LangChain4jPgvectorTest extends EmbeddingStoreIT { @RegisterExtension static final QuarkusUnitTest unitTest = new QuarkusUnitTest() diff --git a/watsonx/deployment/src/main/java/io/quarkiverse/langchain4j/watsonx/deployment/Langchain4jWatsonBuildConfig.java b/watsonx/deployment/src/main/java/io/quarkiverse/langchain4j/watsonx/deployment/LangChain4jWatsonBuildConfig.java similarity index 89% rename from watsonx/deployment/src/main/java/io/quarkiverse/langchain4j/watsonx/deployment/Langchain4jWatsonBuildConfig.java rename to watsonx/deployment/src/main/java/io/quarkiverse/langchain4j/watsonx/deployment/LangChain4jWatsonBuildConfig.java index 2166ae255..485948f36 100644 --- a/watsonx/deployment/src/main/java/io/quarkiverse/langchain4j/watsonx/deployment/Langchain4jWatsonBuildConfig.java +++ b/watsonx/deployment/src/main/java/io/quarkiverse/langchain4j/watsonx/deployment/LangChain4jWatsonBuildConfig.java @@ -7,7 +7,7 @@ @ConfigRoot(phase = BUILD_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.watsonx") -public interface Langchain4jWatsonBuildConfig { +public interface LangChain4jWatsonBuildConfig { /** * Chat model related settings diff --git a/watsonx/deployment/src/main/java/io/quarkiverse/langchain4j/watsonx/deployment/WatsonProcessor.java b/watsonx/deployment/src/main/java/io/quarkiverse/langchain4j/watsonx/deployment/WatsonProcessor.java index 100d9edd0..ad5d28a67 100644 --- a/watsonx/deployment/src/main/java/io/quarkiverse/langchain4j/watsonx/deployment/WatsonProcessor.java +++ b/watsonx/deployment/src/main/java/io/quarkiverse/langchain4j/watsonx/deployment/WatsonProcessor.java @@ -1,7 +1,7 @@ package io.quarkiverse.langchain4j.watsonx.deployment; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.CHAT_MODEL; -import static io.quarkiverse.langchain4j.deployment.Langchain4jDotNames.STREAMING_CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.CHAT_MODEL; +import static io.quarkiverse.langchain4j.deployment.LangChain4jDotNames.STREAMING_CHAT_MODEL; import java.util.List; @@ -14,7 +14,7 @@ import io.quarkiverse.langchain4j.deployment.items.SelectedChatModelProviderBuildItem; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; import io.quarkiverse.langchain4j.watsonx.runtime.WatsonxRecorder; -import io.quarkiverse.langchain4j.watsonx.runtime.config.Langchain4jWatsonxConfig; +import io.quarkiverse.langchain4j.watsonx.runtime.config.LangChain4jWatsonxConfig; import io.quarkus.arc.deployment.SyntheticBeanBuildItem; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; @@ -34,7 +34,7 @@ FeatureBuildItem feature() { @BuildStep public void providerCandidates(BuildProducer chatProducer, - Langchain4jWatsonBuildConfig config) { + LangChain4jWatsonBuildConfig config) { if (config.chatModel().enabled().isEmpty() || config.chatModel().enabled().get()) { chatProducer.produce(new ChatModelProviderCandidateBuildItem(PROVIDER)); @@ -46,7 +46,7 @@ public void providerCandidates(BuildProducer selectedChatItem, - Langchain4jWatsonxConfig config, + LangChain4jWatsonxConfig config, BuildProducer beanProducer) { for (var selected : selectedChatItem) { diff --git a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AiChatServiceTest.java b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AiChatServiceTest.java index 37f79baee..1423dad3b 100644 --- a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AiChatServiceTest.java +++ b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AiChatServiceTest.java @@ -26,7 +26,7 @@ import io.quarkiverse.langchain4j.watsonx.bean.TextGenerationRequest; import io.quarkiverse.langchain4j.watsonx.client.WatsonxRestApi; import io.quarkiverse.langchain4j.watsonx.runtime.config.ChatModelConfig; -import io.quarkiverse.langchain4j.watsonx.runtime.config.Langchain4jWatsonxConfig; +import io.quarkiverse.langchain4j.watsonx.runtime.config.LangChain4jWatsonxConfig; import io.quarkus.test.QuarkusUnitTest; public class AiChatServiceTest { @@ -36,7 +36,7 @@ public class AiChatServiceTest { static ObjectMapper mapper; @Inject - Langchain4jWatsonxConfig langchain4jWatsonConfig; + LangChain4jWatsonxConfig langchain4jWatsonConfig; @Inject ChatLanguageModel model; @@ -85,7 +85,7 @@ interface NewAIService { @Test void chat() throws Exception { - Langchain4jWatsonxConfig.WatsonConfig watsonConfig = langchain4jWatsonConfig.defaultConfig(); + LangChain4jWatsonxConfig.WatsonConfig watsonConfig = langchain4jWatsonConfig.defaultConfig(); ChatModelConfig chatModelConfig = watsonConfig.chatModel(); String modelId = chatModelConfig.modelId(); String projectId = watsonConfig.projectId(); diff --git a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AiStreamingServiceTest.java b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AiStreamingServiceTest.java index d8a81ffae..bdf0b911f 100644 --- a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AiStreamingServiceTest.java +++ b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AiStreamingServiceTest.java @@ -26,7 +26,7 @@ import io.quarkiverse.langchain4j.watsonx.bean.TextGenerationRequest; import io.quarkiverse.langchain4j.watsonx.client.WatsonxRestApi; import io.quarkiverse.langchain4j.watsonx.runtime.config.ChatModelConfig; -import io.quarkiverse.langchain4j.watsonx.runtime.config.Langchain4jWatsonxConfig; +import io.quarkiverse.langchain4j.watsonx.runtime.config.LangChain4jWatsonxConfig; import io.quarkus.test.QuarkusUnitTest; import io.smallrye.mutiny.Multi; @@ -37,7 +37,7 @@ public class AiStreamingServiceTest { static ObjectMapper mapper; @Inject - Langchain4jWatsonxConfig langchain4jWatsonConfig; + LangChain4jWatsonxConfig langchain4jWatsonConfig; @Inject ChatLanguageModel model; @@ -86,7 +86,7 @@ interface NewAIService { @Test void chat() throws Exception { - Langchain4jWatsonxConfig.WatsonConfig watsonConfig = langchain4jWatsonConfig.defaultConfig(); + LangChain4jWatsonxConfig.WatsonConfig watsonConfig = langchain4jWatsonConfig.defaultConfig(); ChatModelConfig chatModelConfig = watsonConfig.chatModel(); String modelId = chatModelConfig.modelId(); String projectId = watsonConfig.projectId(); diff --git a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AllPropertiesTest.java b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AllPropertiesTest.java index 78738e926..ec4e35c2e 100644 --- a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AllPropertiesTest.java +++ b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/AllPropertiesTest.java @@ -23,7 +23,7 @@ import io.quarkiverse.langchain4j.watsonx.bean.Parameters; import io.quarkiverse.langchain4j.watsonx.bean.TextGenerationRequest; import io.quarkiverse.langchain4j.watsonx.client.WatsonxRestApi; -import io.quarkiverse.langchain4j.watsonx.runtime.config.Langchain4jWatsonxConfig; +import io.quarkiverse.langchain4j.watsonx.runtime.config.LangChain4jWatsonxConfig; import io.quarkus.test.QuarkusUnitTest; public class AllPropertiesTest { @@ -33,7 +33,7 @@ public class AllPropertiesTest { static ObjectMapper mapper; @Inject - Langchain4jWatsonxConfig langchain4jWatsonConfig; + LangChain4jWatsonxConfig langchain4jWatsonConfig; @Inject ChatLanguageModel model; diff --git a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/CacheTokenTest.java b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/CacheTokenTest.java index ebb3e3817..9c8ba2555 100644 --- a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/CacheTokenTest.java +++ b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/CacheTokenTest.java @@ -26,7 +26,7 @@ import dev.langchain4j.model.chat.ChatLanguageModel; import io.quarkiverse.langchain4j.watsonx.client.WatsonxRestApi; -import io.quarkiverse.langchain4j.watsonx.runtime.config.Langchain4jWatsonxConfig; +import io.quarkiverse.langchain4j.watsonx.runtime.config.LangChain4jWatsonxConfig; import io.quarkus.test.QuarkusUnitTest; public class CacheTokenTest { @@ -36,7 +36,7 @@ public class CacheTokenTest { static ObjectMapper mapper; @Inject - Langchain4jWatsonxConfig config; + LangChain4jWatsonxConfig config; @Inject ChatLanguageModel model; diff --git a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/DefaultPropertiesTest.java b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/DefaultPropertiesTest.java index 6e34baec1..822bced32 100644 --- a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/DefaultPropertiesTest.java +++ b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/DefaultPropertiesTest.java @@ -22,7 +22,7 @@ import io.quarkiverse.langchain4j.watsonx.bean.Parameters; import io.quarkiverse.langchain4j.watsonx.bean.TextGenerationRequest; import io.quarkiverse.langchain4j.watsonx.client.WatsonxRestApi; -import io.quarkiverse.langchain4j.watsonx.runtime.config.Langchain4jWatsonxConfig; +import io.quarkiverse.langchain4j.watsonx.runtime.config.LangChain4jWatsonxConfig; import io.quarkus.test.QuarkusUnitTest; public class DefaultPropertiesTest { @@ -32,7 +32,7 @@ public class DefaultPropertiesTest { static ObjectMapper mapper; @Inject - Langchain4jWatsonxConfig langchain4jWatsonConfig; + LangChain4jWatsonxConfig langchain4jWatsonConfig; @Inject ChatLanguageModel model; diff --git a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/HttpErrorTest.java b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/HttpErrorTest.java index 7de932ee7..8c33697f2 100644 --- a/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/HttpErrorTest.java +++ b/watsonx/deployment/src/test/java/com/ibm/langchain4j/watsonx/deployment/HttpErrorTest.java @@ -28,7 +28,7 @@ import io.quarkiverse.langchain4j.watsonx.bean.WatsonError; import io.quarkiverse.langchain4j.watsonx.client.WatsonxRestApi; import io.quarkiverse.langchain4j.watsonx.exception.WatsonxException; -import io.quarkiverse.langchain4j.watsonx.runtime.config.Langchain4jWatsonxConfig; +import io.quarkiverse.langchain4j.watsonx.runtime.config.LangChain4jWatsonxConfig; import io.quarkus.test.QuarkusUnitTest; public class HttpErrorTest { @@ -38,7 +38,7 @@ public class HttpErrorTest { static ObjectMapper mapper; @Inject - Langchain4jWatsonxConfig config; + LangChain4jWatsonxConfig config; @Inject ChatLanguageModel model; diff --git a/watsonx/runtime/src/main/java/io/quarkiverse/langchain4j/watsonx/runtime/WatsonxRecorder.java b/watsonx/runtime/src/main/java/io/quarkiverse/langchain4j/watsonx/runtime/WatsonxRecorder.java index 8cb2b4c2e..2c7fd8f6a 100644 --- a/watsonx/runtime/src/main/java/io/quarkiverse/langchain4j/watsonx/runtime/WatsonxRecorder.java +++ b/watsonx/runtime/src/main/java/io/quarkiverse/langchain4j/watsonx/runtime/WatsonxRecorder.java @@ -17,7 +17,7 @@ import io.quarkiverse.langchain4j.watsonx.WatsonxStreamingChatModel; import io.quarkiverse.langchain4j.watsonx.runtime.config.ChatModelConfig; import io.quarkiverse.langchain4j.watsonx.runtime.config.IAMConfig; -import io.quarkiverse.langchain4j.watsonx.runtime.config.Langchain4jWatsonxConfig; +import io.quarkiverse.langchain4j.watsonx.runtime.config.LangChain4jWatsonxConfig; import io.quarkus.runtime.annotations.Recorder; import io.smallrye.config.ConfigValidationException; @@ -29,8 +29,8 @@ public class WatsonxRecorder { private static final String DUMMY_PROJECT_ID = "dummy"; public static final ConfigValidationException.Problem[] EMPTY_PROBLEMS = new ConfigValidationException.Problem[0]; - public Supplier chatModel(Langchain4jWatsonxConfig runtimeConfig, String modelName) { - Langchain4jWatsonxConfig.WatsonConfig watsonConfig = correspondingWatsonConfig(runtimeConfig, modelName); + public Supplier chatModel(LangChain4jWatsonxConfig runtimeConfig, String modelName) { + LangChain4jWatsonxConfig.WatsonConfig watsonConfig = correspondingWatsonConfig(runtimeConfig, modelName); if (watsonConfig.enableIntegration()) { ChatModelConfig chatModelConfig = watsonConfig.chatModel(); @@ -93,8 +93,8 @@ public ChatLanguageModel get() { } } - public Supplier streamingChatModel(Langchain4jWatsonxConfig runtimeConfig, String modelName) { - Langchain4jWatsonxConfig.WatsonConfig watsonConfig = correspondingWatsonConfig(runtimeConfig, modelName); + public Supplier streamingChatModel(LangChain4jWatsonxConfig runtimeConfig, String modelName) { + LangChain4jWatsonxConfig.WatsonConfig watsonConfig = correspondingWatsonConfig(runtimeConfig, modelName); if (watsonConfig.enableIntegration()) { ChatModelConfig chatModelConfig = watsonConfig.chatModel(); @@ -157,9 +157,9 @@ public StreamingChatLanguageModel get() { } } - private Langchain4jWatsonxConfig.WatsonConfig correspondingWatsonConfig(Langchain4jWatsonxConfig runtimeConfig, + private LangChain4jWatsonxConfig.WatsonConfig correspondingWatsonConfig(LangChain4jWatsonxConfig runtimeConfig, String modelName) { - Langchain4jWatsonxConfig.WatsonConfig watsonConfig; + LangChain4jWatsonxConfig.WatsonConfig watsonConfig; if (NamedModelUtil.isDefault(modelName)) { watsonConfig = runtimeConfig.defaultConfig(); } else { diff --git a/watsonx/runtime/src/main/java/io/quarkiverse/langchain4j/watsonx/runtime/config/Langchain4jWatsonxConfig.java b/watsonx/runtime/src/main/java/io/quarkiverse/langchain4j/watsonx/runtime/config/LangChain4jWatsonxConfig.java similarity index 98% rename from watsonx/runtime/src/main/java/io/quarkiverse/langchain4j/watsonx/runtime/config/Langchain4jWatsonxConfig.java rename to watsonx/runtime/src/main/java/io/quarkiverse/langchain4j/watsonx/runtime/config/LangChain4jWatsonxConfig.java index a3ac05ed8..2b2f82c54 100644 --- a/watsonx/runtime/src/main/java/io/quarkiverse/langchain4j/watsonx/runtime/config/Langchain4jWatsonxConfig.java +++ b/watsonx/runtime/src/main/java/io/quarkiverse/langchain4j/watsonx/runtime/config/LangChain4jWatsonxConfig.java @@ -17,7 +17,7 @@ @ConfigRoot(phase = RUN_TIME) @ConfigMapping(prefix = "quarkus.langchain4j.watsonx") -public interface Langchain4jWatsonxConfig { +public interface LangChain4jWatsonxConfig { /** * Default model config. diff --git a/watsonx/runtime/src/test/java/io/quarkiverse/langchain4j/watsonx/runtime/DisabledModelsWatsonRecorderTest.java b/watsonx/runtime/src/test/java/io/quarkiverse/langchain4j/watsonx/runtime/DisabledModelsWatsonRecorderTest.java index 271b7839a..73b79f1d7 100644 --- a/watsonx/runtime/src/test/java/io/quarkiverse/langchain4j/watsonx/runtime/DisabledModelsWatsonRecorderTest.java +++ b/watsonx/runtime/src/test/java/io/quarkiverse/langchain4j/watsonx/runtime/DisabledModelsWatsonRecorderTest.java @@ -10,11 +10,11 @@ import dev.langchain4j.model.chat.DisabledChatLanguageModel; import dev.langchain4j.model.chat.DisabledStreamingChatLanguageModel; import io.quarkiverse.langchain4j.runtime.NamedModelUtil; -import io.quarkiverse.langchain4j.watsonx.runtime.config.Langchain4jWatsonxConfig; -import io.quarkiverse.langchain4j.watsonx.runtime.config.Langchain4jWatsonxConfig.WatsonConfig; +import io.quarkiverse.langchain4j.watsonx.runtime.config.LangChain4jWatsonxConfig; +import io.quarkiverse.langchain4j.watsonx.runtime.config.LangChain4jWatsonxConfig.WatsonConfig; class DisabledModelsWatsonRecorderTest { - Langchain4jWatsonxConfig config = mock(Langchain4jWatsonxConfig.class); + LangChain4jWatsonxConfig config = mock(LangChain4jWatsonxConfig.class); WatsonConfig defaultConfig = mock(WatsonConfig.class); WatsonxRecorder recorder = new WatsonxRecorder();