Skip to content

Commit

Permalink
Upgrade LangChain4J to v0.34.0 and Use LC4J Gemini API
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanj committed Sep 8, 2024
1 parent 8ce04da commit ab1253a
Show file tree
Hide file tree
Showing 22 changed files with 24 additions and 431 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ tasks.named("buildPlugin") {
}

dependencies {
val lg4j_version = "0.33.0"
val lg4j_version = "0.34.0"

// Add the dependencies for the core module
implementation(project(":core"))
Expand All @@ -48,6 +48,7 @@ dependencies {
implementation("dev.langchain4j:langchain4j-open-ai:$lg4j_version")
implementation("dev.langchain4j:langchain4j-anthropic:$lg4j_version")
implementation("dev.langchain4j:langchain4j-mistral-ai:$lg4j_version")
implementation("dev.langchain4j:langchain4j-google-ai-gemini:$lg4j_version")
implementation("dev.langchain4j:langchain4j-web-search-engine-google-custom:$lg4j_version")
implementation("dev.langchain4j:langchain4j-web-search-engine-tavily:$lg4j_version")

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions core/src/main/java/com/devoxx/genie/model/gemini/model/Part.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,22 @@
import com.devoxx.genie.model.ChatModel;
import com.devoxx.genie.model.LanguageModel;
import com.devoxx.genie.model.enumarations.ModelProvider;
import com.devoxx.genie.model.gemini.GeminiChatModel;
import com.devoxx.genie.service.DevoxxGenieSettingsServiceProvider;
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.googleai.GoogleAiGeminiChatModel;
import org.jetbrains.annotations.NotNull;

import java.time.Duration;
import java.util.List;

public class GoogleChatModelFactory implements ChatModelFactory {

@Override
public ChatLanguageModel createChatModel(@NotNull ChatModel chatModel) {
return GeminiChatModel.builder()
.modelName(chatModel.getModelName())
return GoogleAiGeminiChatModel.builder()
.apiKey(getApiKey())
.modelName(chatModel.getModelName())
.temperature(chatModel.getTemperature())
.maxTokens(chatModel.getMaxTokens())
.timeout(Duration.ofSeconds(chatModel.getTimeout()))
.maxOutputTokens(chatModel.getMaxTokens())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public StreamingChatLanguageModel createStreamingChatModel(@NotNull ChatModel ch

@Override
public String getApiKey() {
return DevoxxGenieSettingsServiceProvider.getInstance().getOpenRouterKey().trim();
return DevoxxGenieSettingsServiceProvider.getInstance().getOpenRouterKey();
}

/**
Expand Down
14 changes: 0 additions & 14 deletions src/main/java/com/devoxx/genie/model/gemini/GeminiApi.java

This file was deleted.

99 changes: 0 additions & 99 deletions src/main/java/com/devoxx/genie/model/gemini/GeminiChatModel.java

This file was deleted.

Loading

0 comments on commit ab1253a

Please sign in to comment.