Skip to content

Commit

Permalink
1744 - Reorganize, SF
Browse files Browse the repository at this point in the history
  • Loading branch information
ivicac committed Dec 18, 2024
1 parent f8133e6 commit 5cb6f74
Show file tree
Hide file tree
Showing 39 changed files with 626 additions and 523 deletions.
2 changes: 1 addition & 1 deletion server/apps/server-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ dependencies {
implementation(project(":server:libs:modules:components:accelo"))
implementation(project(":server:libs:modules:components:active-campaign"))
implementation(project(":server:libs:modules:components:affinity"))
implementation(project(":server:libs:modules:components:ai:ai-text-analysis"))
implementation(project(":server:libs:modules:components:airtable"))
implementation(project(":server:libs:modules:components:aitable"))
implementation(project(":server:libs:modules:components:app-event"))
Expand Down Expand Up @@ -175,7 +176,6 @@ dependencies {
implementation(project(":server:libs:modules:components:json-file"))
implementation(project(":server:libs:modules:components:json-helper"))
implementation(project(":server:libs:modules:components:keap"))
implementation(project(":server:libs:modules:components:llm:ai-text-analysis"))
implementation(project(":server:libs:modules:components:llm:amazon-bedrock"))
implementation(project(":server:libs:modules:components:llm:anthropic"))
implementation(project(":server:libs:modules:components:llm:azure-openai"))
Expand Down
2 changes: 1 addition & 1 deletion server/ee/apps/worker-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ dependencies {
implementation(project(":server:libs:modules:components:accelo"))
implementation(project(":server:libs:modules:components:active-campaign"))
implementation(project(":server:libs:modules:components:affinity"))
implementation(project(":server:libs:modules:components:ai:ai-text-analysis"))
implementation(project(":server:libs:modules:components:airtable"))
implementation(project(":server:libs:modules:components:aitable"))
implementation(project(":server:libs:modules:components:app-event"))
Expand Down Expand Up @@ -95,7 +96,6 @@ dependencies {
implementation(project(":server:libs:modules:components:json-file"))
implementation(project(":server:libs:modules:components:json-helper"))
implementation(project(":server:libs:modules:components:keap"))
implementation(project(":server:libs:modules:components:llm:ai-text-analysis"))
implementation(project(":server:libs:modules:components:llm:amazon-bedrock"))
implementation(project(":server:libs:modules:components:llm:anthropic"))
implementation(project(":server:libs:modules:components:llm:azure-openai"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,19 @@ public static class Ai {
public Copilot getCopilot() {
return copilot;
}

public Component getComponent() {
return component;
}

public void setCopilot(Copilot copilot) {
this.copilot = copilot;
}

public void setComponent(Component component) {
this.component = component;
}

public static class Copilot {

public enum Provider {
Expand Down Expand Up @@ -425,6 +429,7 @@ public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
}

private Anthropic anthropic = new Anthropic();

public Anthropic getAnthropic() {
Expand All @@ -447,6 +452,7 @@ public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
}

private AzureOpenAi azureOpenAi = new AzureOpenAi();

public AzureOpenAi getAzureOpenAi() {
Expand Down Expand Up @@ -492,6 +498,7 @@ public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
}

private NVIDIA NVIDIA = new NVIDIA();

public NVIDIA getNVIDIA() {
Expand All @@ -514,6 +521,7 @@ public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
}

private HuggingFace huggingFace = new HuggingFace();

public HuggingFace getHuggingFace() {
Expand All @@ -536,6 +544,7 @@ public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
}

private Mistral mistral = new Mistral();

public Mistral getMistral() {
Expand All @@ -558,6 +567,7 @@ public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
}

private OpenAi openAi = new OpenAi();

public OpenAi getOpenAi() {
Expand All @@ -580,6 +590,7 @@ public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
}

private VertexGemini vertexGemini = new VertexGemini();

public VertexGemini getVertexGemini() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dependencies {
implementation(project(":server:libs:config:app-config"))
implementation(project(":server:libs:platform:platform-component:platform-component-api"))

implementation(project(":server:libs:modules:components:llm"))
implementation(project(":server:libs:modules:components:llm:amazon-bedrock"))
implementation(project(":server:libs:modules:components:llm:anthropic"))
implementation(project(":server:libs:modules:components:llm:azure-openai"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,27 @@ public class AiTextAnalysisComponentHandler implements ComponentHandler {
private final AIComponentDefinition componentDefinition;

public AiTextAnalysisComponentHandler(ApplicationProperties applicationProperties) {
this.componentDefinition = new AiTextAnalysisComponentDefinitionImpl(applicationProperties.getAi().getComponent());
ApplicationProperties.Ai ai = applicationProperties.getAi();

this.componentDefinition = new AiTextAnalysisComponentDefinitionImpl(ai.getComponent());
}

@Override
public ComponentDefinition getDefinition() {
return componentDefinition;
}

private static class AiTextAnalysisComponentDefinitionImpl extends AbstractComponentDefinitionWrapper
implements AIComponentDefinition {
private AiTextAnalysisComponentDefinitionImpl(ApplicationProperties.Ai.Component component){
private static class AiTextAnalysisComponentDefinitionImpl
extends AbstractComponentDefinitionWrapper implements AIComponentDefinition {

private AiTextAnalysisComponentDefinitionImpl(ApplicationProperties.Ai.Component component) {
super(
component(AI_TEXT_ANALYSIS)
.title("AI Text Analysis")
.description("AI Helper component for text analysis.")
.icon("path:assets/ai-text-analysis.svg")
.categories(ComponentCategory.ARTIFICIAL_INTELLIGENCE)
.actions(new SummarizeTextAction(component).ACTION_DEFINITION)
);
.actions(new SummarizeTextAction(component).actionDefinition));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@

package com.bytechef.component.ai.text.analysis.action;

import static com.bytechef.component.ai.text.analysis.constant.AiTextAnalysisConstants.CONNECTION_PROVIDER;
import static com.bytechef.component.ai.text.analysis.constant.AiTextAnalysisConstants.FORMAT;
import static com.bytechef.component.ai.text.analysis.constant.AiTextAnalysisConstants.MODEL_PROVIDER;
import static com.bytechef.component.ai.text.analysis.constant.AiTextAnalysisConstants.PROMPT;
import static com.bytechef.component.ai.text.analysis.constant.AiTextAnalysisConstants.TEXT;
import static com.bytechef.component.definition.Authorization.TOKEN;
import static com.bytechef.component.definition.ComponentDsl.action;
import static com.bytechef.component.definition.ComponentDsl.integer;
import static com.bytechef.component.definition.ComponentDsl.option;
Expand All @@ -29,43 +28,30 @@
import static com.bytechef.component.llm.constant.LLMConstants.MODEL;
import static com.bytechef.component.llm.constant.LLMConstants.TEMPERATURE_PROPERTY;

import com.bytechef.component.ai.text.analysis.AiTextAnalysisActionDefinition;
import com.bytechef.component.ai.text.analysis.AiTextAnalysisConfiguration;
import com.bytechef.component.ai.text.analysis.action.definition.AiTextAnalysisActionDefinition;
import com.bytechef.component.ai.text.analysis.constant.AiTextAnalysisConstants;
import com.bytechef.component.amazon.bedrock.action.AmazonBedrockAnthropic2ChatAction;
import com.bytechef.component.amazon.bedrock.action.AmazonBedrockAnthropic3ChatAction;
import com.bytechef.component.amazon.bedrock.action.AmazonBedrockCohereChatAction;
import com.bytechef.component.amazon.bedrock.action.AmazonBedrockJurassic2ChatAction;
import com.bytechef.component.amazon.bedrock.action.AmazonBedrockLlamaChatAction;
import com.bytechef.component.amazon.bedrock.action.AmazonBedrockTitanChatAction;
import com.bytechef.component.anthropic.action.AnthropicChatAction;
import com.bytechef.component.definition.ActionContext;
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
import com.bytechef.component.definition.Parameters;
import com.bytechef.component.llm.Chat;
import com.bytechef.component.mistral.action.MistralChatAction;
import com.bytechef.component.openai.action.OpenAIChatAction;
import com.bytechef.component.vertex.gemini.action.VertexGeminiChatAction;
import com.bytechef.component.amazon.bedrock.constant.AmazonBedrockConstants;
import com.bytechef.component.anthropic.constant.AnthropicConstants;
import com.bytechef.component.mistral.constant.MistralConstants;
import com.bytechef.component.openai.constant.OpenAIConstants;
import com.bytechef.component.vertex.gemini.constant.VertexGeminiConstants;
import com.bytechef.config.ApplicationProperties;
import com.bytechef.platform.component.definition.AbstractActionDefinitionWrapper;


/**
* @author Marko Kriskovic
*/
public class SummarizeTextAction {

public final AiTextAnalysisActionDefinition ACTION_DEFINITION;

public final AiTextAnalysisActionDefinition actionDefinition;

public SummarizeTextAction(ApplicationProperties.Ai.Component component) {
this.ACTION_DEFINITION = new AiTextAnalysisActionDefinition(
action("summarizeText")
this.actionDefinition = new AiTextAnalysisActionDefinition(
action(AiTextAnalysisConstants.SUMMARIZE_TEXT)
.title("Summarize Text")
.description("AI reads, analyzes and summarizes your text into a shorter format.")
.properties(
integer(CONNECTION_PROVIDER)
.label("Connection provider")
integer(MODEL_PROVIDER)
.label("Model provider")
.options(
option("Amazon Bedrock: Anthropic 2", 0),
option("Amazon Bedrock: Anthropic 3", 1),
Expand All @@ -80,47 +66,48 @@ public SummarizeTextAction(ApplicationProperties.Ai.Component component) {
option("Hugging Face", 10),
option("Mistral", 11),
option("Open AI", 12),
option("Vertex Gemini", 13)),
option("Vertex Gemini", 13))
.required(true),
string(MODEL)
.label("Model")
.description("ID of the model to use.")
.options(AmazonBedrockAnthropic2ChatAction.MODELS_ENUM)
.options(AmazonBedrockConstants.ANTHROPIC2_MODELS)
.displayCondition("connectionProvider == 0")
.required(true),
string(MODEL)
.label("Model")
.description("ID of the model to use.")
.options(AmazonBedrockAnthropic3ChatAction.MODELS_ENUM)
.options(AmazonBedrockConstants.ANTHROPIC3_MODELS)
.displayCondition("connectionProvider == 1")
.required(true),
string(MODEL)
.label("Model")
.description("ID of the model to use.")
.options(AmazonBedrockCohereChatAction.MODELS_ENUM)
.options(AmazonBedrockConstants.COHERE_MODELS)
.displayCondition("connectionProvider == 2")
.required(true),
string(MODEL)
.label("Model")
.description("ID of the model to use.")
.options(AmazonBedrockJurassic2ChatAction.MODELS_ENUM)
.options(AmazonBedrockConstants.JURASSIC2_MODELS)
.displayCondition("connectionProvider == 3")
.required(true),
string(MODEL)
.label("Model")
.description("ID of the model to use.")
.options(AmazonBedrockLlamaChatAction.MODELS_ENUM)
.options(AmazonBedrockConstants.LLAMA_MODELS)
.displayCondition("connectionProvider == 4")
.required(true),
string(MODEL)
.label("Model")
.description("ID of the model to use.")
.options(AmazonBedrockTitanChatAction.MODELS_ENUM)
.options(AmazonBedrockConstants.TITAN_MODELS)
.displayCondition("connectionProvider == 5")
.required(true),
string(MODEL)
.label("Model")
.description("ID of the model to use.")
.options(AnthropicChatAction.MODELS_ENUM)
.options(AnthropicConstants.MODELS)
.displayCondition("connectionProvider == 6")
.required(true),
string(MODEL)
Expand All @@ -136,25 +123,26 @@ public SummarizeTextAction(ApplicationProperties.Ai.Component component) {
string(MODEL)
.label("Model")
.description("ID of the model to use.")
.options(MistralChatAction.MODELS_ENUM)
.options(MistralConstants.MODELS)
.displayCondition("connectionProvider == 11")
.required(true),
string(MODEL)
.label("Model")
.description("ID of the model to use.")
.options(OpenAIChatAction.MODELS_ENUM)
.options(OpenAIConstants.MODELS)
.displayCondition("connectionProvider == 12")
.required(true),
string(MODEL)
.label("Model")
.description("ID of the model to use.")
.options(VertexGeminiChatAction.MODELS_ENUM)
.options(VertexGeminiConstants.MODELS)
.displayCondition("connectionProvider == 13")
.required(true),
string(TEXT)
.label("Text")
.description("The text that is to be summarized.")
.minLength(100),
.minLength(100)
.required(true),
integer(FORMAT)
.label("Format")
.description("In what format do you wish the text summarized?")
Expand All @@ -163,15 +151,16 @@ public SummarizeTextAction(ApplicationProperties.Ai.Component component) {
option("A brief title summarizing the content in 4-7 words", 1),
option("A single, concise sentence", 2),
option("A bulleted list recap", 3),
option("Custom Prompt", 4)),
option("Custom Prompt", 4))
.required(true),
string(PROMPT)
.label("Custom Prompt")
.description("Write your prompt for summarizing text.")
.displayCondition("format == 4"),
.displayCondition("format == 4")
.required(true),
MAX_TOKENS_PROPERTY,
TEMPERATURE_PROPERTY)
.output()
, component);
.output(),
component);
}

}
Loading

0 comments on commit 5cb6f74

Please sign in to comment.