Skip to content

Commit 80a1a0f

Browse files
committed
1639 - add responseSchema property to enable UI to build response schemas
1 parent dccbd51 commit 80a1a0f

File tree

19 files changed

+191
-25
lines changed

19 files changed

+191
-25
lines changed

server/libs/modules/components/llm/amazon-bedrock/src/main/java/com/bytechef/component/amazon/bedrock/action/AmazonBedrockAnthropic2ChatAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import static com.bytechef.component.llm.constant.LLMConstants.MESSAGE_PROPERTY;
2727
import static com.bytechef.component.llm.constant.LLMConstants.MODEL;
2828
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_FORMAT_PROPERTY;
29+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_ARRAY_PROPERTY;
30+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_OBJECT_PROPERTY;
2931
import static com.bytechef.component.llm.constant.LLMConstants.STOP;
3032
import static com.bytechef.component.llm.constant.LLMConstants.STOP_PROPERTY;
3133
import static com.bytechef.component.llm.constant.LLMConstants.TEMPERATURE;
@@ -77,6 +79,8 @@ public class AmazonBedrockAnthropic2ChatAction {
7779
.description("The maximum number of tokens to generate in the chat completion.")
7880
.required(true),
7981
RESPONSE_FORMAT_PROPERTY,
82+
RESPONSE_SCHEMA_OBJECT_PROPERTY,
83+
RESPONSE_SCHEMA_ARRAY_PROPERTY,
8084
TEMPERATURE_PROPERTY,
8185
TOP_P_PROPERTY,
8286
TOP_K_PROPERTY,
@@ -90,7 +94,7 @@ private AmazonBedrockAnthropic2ChatAction() {
9094
public static Object perform(
9195
Parameters inputParameters, Parameters connectionParameters, ActionContext context) {
9296

93-
return Chat.getResponse(CHAT, inputParameters, connectionParameters);
97+
return Chat.getResponse(CHAT, inputParameters, connectionParameters, context);
9498
}
9599

96100
private static final Chat CHAT = new Chat() {

server/libs/modules/components/llm/amazon-bedrock/src/main/java/com/bytechef/component/amazon/bedrock/action/AmazonBedrockAnthropic3ChatAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import static com.bytechef.component.llm.constant.LLMConstants.MESSAGE_PROPERTY;
2727
import static com.bytechef.component.llm.constant.LLMConstants.MODEL;
2828
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_FORMAT_PROPERTY;
29+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_ARRAY_PROPERTY;
30+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_OBJECT_PROPERTY;
2931
import static com.bytechef.component.llm.constant.LLMConstants.STOP;
3032
import static com.bytechef.component.llm.constant.LLMConstants.STOP_PROPERTY;
3133
import static com.bytechef.component.llm.constant.LLMConstants.TEMPERATURE;
@@ -77,6 +79,8 @@ public class AmazonBedrockAnthropic3ChatAction {
7779
.description("The maximum number of tokens to generate in the chat completion.")
7880
.required(true),
7981
RESPONSE_FORMAT_PROPERTY,
82+
RESPONSE_SCHEMA_OBJECT_PROPERTY,
83+
RESPONSE_SCHEMA_ARRAY_PROPERTY,
8084
TEMPERATURE_PROPERTY,
8185
TOP_P_PROPERTY,
8286
TOP_K_PROPERTY,
@@ -90,7 +94,7 @@ private AmazonBedrockAnthropic3ChatAction() {
9094
public static Object perform(
9195
Parameters inputParameters, Parameters connectionParameters, ActionContext context) {
9296

93-
return Chat.getResponse(CHAT, inputParameters, connectionParameters);
97+
return Chat.getResponse(CHAT, inputParameters, connectionParameters, context);
9498
}
9599

96100
private static final Chat CHAT = new Chat() {

server/libs/modules/components/llm/amazon-bedrock/src/main/java/com/bytechef/component/amazon/bedrock/action/AmazonBedrockCohereChatAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import static com.bytechef.component.llm.constant.LLMConstants.N;
3636
import static com.bytechef.component.llm.constant.LLMConstants.N_PROPERTY;
3737
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_FORMAT_PROPERTY;
38+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_ARRAY_PROPERTY;
39+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_OBJECT_PROPERTY;
3840
import static com.bytechef.component.llm.constant.LLMConstants.STOP;
3941
import static com.bytechef.component.llm.constant.LLMConstants.STOP_PROPERTY;
4042
import static com.bytechef.component.llm.constant.LLMConstants.TEMPERATURE;
@@ -83,6 +85,8 @@ public class AmazonBedrockCohereChatAction {
8385
CohereChatBedrockApi.CohereChatModel::getName, (f, s) -> f)))),
8486
MESSAGE_PROPERTY,
8587
RESPONSE_FORMAT_PROPERTY,
88+
RESPONSE_SCHEMA_OBJECT_PROPERTY,
89+
RESPONSE_SCHEMA_ARRAY_PROPERTY,
8690
MAX_TOKENS_PROPERTY,
8791
N_PROPERTY,
8892
TEMPERATURE_PROPERTY,
@@ -130,7 +134,7 @@ private AmazonBedrockCohereChatAction() {
130134
public static Object perform(
131135
Parameters inputParameters, Parameters connectionParameters, ActionContext context) {
132136

133-
return Chat.getResponse(CHAT, inputParameters, connectionParameters);
137+
return Chat.getResponse(CHAT, inputParameters, connectionParameters, context);
134138
}
135139

136140
private static final Chat CHAT = new Chat() {

server/libs/modules/components/llm/amazon-bedrock/src/main/java/com/bytechef/component/amazon/bedrock/action/AmazonBedrockJurassic2ChatAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
import static com.bytechef.component.llm.constant.LLMConstants.PRESENCE_PENALTY_PROPERTY;
3838
import static com.bytechef.component.llm.constant.LLMConstants.PROMPT;
3939
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_FORMAT_PROPERTY;
40+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_ARRAY_PROPERTY;
41+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_OBJECT_PROPERTY;
4042
import static com.bytechef.component.llm.constant.LLMConstants.STOP;
4143
import static com.bytechef.component.llm.constant.LLMConstants.STOP_PROPERTY;
4244
import static com.bytechef.component.llm.constant.LLMConstants.TEMPERATURE;
@@ -81,6 +83,8 @@ public class AmazonBedrockJurassic2ChatAction {
8183
Ai21Jurassic2ChatBedrockApi.Ai21Jurassic2ChatModel::getName, (f, s) -> f)))),
8284
MESSAGE_PROPERTY,
8385
RESPONSE_FORMAT_PROPERTY,
86+
RESPONSE_SCHEMA_OBJECT_PROPERTY,
87+
RESPONSE_SCHEMA_ARRAY_PROPERTY,
8488
integer(MIN_TOKENS)
8589
.label("Min Tokens")
8690
.description("The minimum number of tokens to generate in the chat completion.")
@@ -110,7 +114,7 @@ private AmazonBedrockJurassic2ChatAction() {
110114
public static Object perform(
111115
Parameters inputParameters, Parameters connectionParameters, ActionContext context) {
112116

113-
return Chat.getResponse(CHAT, inputParameters, connectionParameters);
117+
return Chat.getResponse(CHAT, inputParameters, connectionParameters, context);
114118
}
115119

116120
private static final Chat CHAT = new Chat() {

server/libs/modules/components/llm/amazon-bedrock/src/main/java/com/bytechef/component/amazon/bedrock/action/AmazonBedrockLlamaChatAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import static com.bytechef.component.llm.constant.LLMConstants.MESSAGE_PROPERTY;
2727
import static com.bytechef.component.llm.constant.LLMConstants.MODEL;
2828
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_FORMAT_PROPERTY;
29+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_ARRAY_PROPERTY;
30+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_OBJECT_PROPERTY;
2931
import static com.bytechef.component.llm.constant.LLMConstants.TEMPERATURE;
3032
import static com.bytechef.component.llm.constant.LLMConstants.TEMPERATURE_PROPERTY;
3133
import static com.bytechef.component.llm.constant.LLMConstants.TOP_P;
@@ -69,6 +71,8 @@ public class AmazonBedrockLlamaChatAction {
6971
(f, s) -> f)))),
7072
MESSAGE_PROPERTY,
7173
RESPONSE_FORMAT_PROPERTY,
74+
RESPONSE_SCHEMA_OBJECT_PROPERTY,
75+
RESPONSE_SCHEMA_ARRAY_PROPERTY,
7276
MAX_TOKENS_PROPERTY,
7377
TEMPERATURE_PROPERTY,
7478
TOP_P_PROPERTY)
@@ -81,7 +85,7 @@ private AmazonBedrockLlamaChatAction() {
8185
public static Object perform(
8286
Parameters inputParameters, Parameters connectionParameters, ActionContext context) {
8387

84-
return Chat.getResponse(CHAT, inputParameters, connectionParameters);
88+
return Chat.getResponse(CHAT, inputParameters, connectionParameters, context);
8589
}
8690

8791
public static final Chat CHAT = new Chat() {

server/libs/modules/components/llm/amazon-bedrock/src/main/java/com/bytechef/component/amazon/bedrock/action/AmazonBedrockTitanChatAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import static com.bytechef.component.llm.constant.LLMConstants.MESSAGE_PROPERTY;
2727
import static com.bytechef.component.llm.constant.LLMConstants.MODEL;
2828
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_FORMAT_PROPERTY;
29+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_ARRAY_PROPERTY;
30+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_OBJECT_PROPERTY;
2931
import static com.bytechef.component.llm.constant.LLMConstants.STOP;
3032
import static com.bytechef.component.llm.constant.LLMConstants.STOP_PROPERTY;
3133
import static com.bytechef.component.llm.constant.LLMConstants.TEMPERATURE;
@@ -72,6 +74,8 @@ public class AmazonBedrockTitanChatAction {
7274
(f, s) -> f)))),
7375
MESSAGE_PROPERTY,
7476
RESPONSE_FORMAT_PROPERTY,
77+
RESPONSE_SCHEMA_OBJECT_PROPERTY,
78+
RESPONSE_SCHEMA_ARRAY_PROPERTY,
7579
MAX_TOKENS_PROPERTY,
7680
TEMPERATURE_PROPERTY,
7781
TOP_P_PROPERTY,
@@ -85,7 +89,7 @@ private AmazonBedrockTitanChatAction() {
8589
public static Object perform(
8690
Parameters inputParameters, Parameters connectionParameters, ActionContext context) {
8791

88-
return Chat.getResponse(CHAT, inputParameters, connectionParameters);
92+
return Chat.getResponse(CHAT, inputParameters, connectionParameters, context);
8993
}
9094

9195
private static final Chat CHAT = new Chat() {

server/libs/modules/components/llm/anthropic/src/main/java/com/bytechef/component/anthropic/action/AnthropicChatAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import static com.bytechef.component.llm.constant.LLMConstants.MESSAGE_PROPERTY;
2828
import static com.bytechef.component.llm.constant.LLMConstants.MODEL;
2929
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_FORMAT_PROPERTY;
30+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_ARRAY_PROPERTY;
31+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_OBJECT_PROPERTY;
3032
import static com.bytechef.component.llm.constant.LLMConstants.STOP;
3133
import static com.bytechef.component.llm.constant.LLMConstants.STOP_PROPERTY;
3234
import static com.bytechef.component.llm.constant.LLMConstants.TEMPERATURE;
@@ -77,6 +79,8 @@ public class AnthropicChatAction {
7779
.description("The maximum number of tokens to generate in the chat completion.")
7880
.required(true),
7981
RESPONSE_FORMAT_PROPERTY,
82+
RESPONSE_SCHEMA_OBJECT_PROPERTY,
83+
RESPONSE_SCHEMA_ARRAY_PROPERTY,
8084
TEMPERATURE_PROPERTY,
8185
TOP_P_PROPERTY,
8286
TOP_K_PROPERTY,
@@ -90,7 +94,7 @@ private AnthropicChatAction() {
9094

9195
public static Object perform(
9296
Parameters inputParameters, Parameters connectionParameters, ActionContext context) {
93-
return Chat.getResponse(CHAT, inputParameters, connectionParameters);
97+
return Chat.getResponse(CHAT, inputParameters, connectionParameters, context);
9498
}
9599

96100
private static final Chat CHAT = new Chat() {

server/libs/modules/components/llm/azure-openai/src/main/java/com/bytechef/component/azure/openai/action/AzureOpenAIChatAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
import static com.bytechef.component.llm.constant.LLMConstants.PRESENCE_PENALTY_PROPERTY;
3838
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_FORMAT;
3939
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_FORMAT_PROPERTY;
40+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_ARRAY_PROPERTY;
41+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_OBJECT_PROPERTY;
4042
import static com.bytechef.component.llm.constant.LLMConstants.STOP;
4143
import static com.bytechef.component.llm.constant.LLMConstants.STOP_PROPERTY;
4244
import static com.bytechef.component.llm.constant.LLMConstants.TEMPERATURE;
@@ -77,6 +79,8 @@ public class AzureOpenAIChatAction {
7779
.required(true),
7880
MESSAGE_PROPERTY,
7981
RESPONSE_FORMAT_PROPERTY,
82+
RESPONSE_SCHEMA_OBJECT_PROPERTY,
83+
RESPONSE_SCHEMA_ARRAY_PROPERTY,
8084
MAX_TOKENS_PROPERTY,
8185
N_PROPERTY,
8286
TEMPERATURE_PROPERTY,
@@ -96,7 +100,7 @@ private AzureOpenAIChatAction() {
96100
public static Object perform(
97101
Parameters inputParameters, Parameters connectionParameters, ActionContext context) {
98102

99-
return Chat.getResponse(CHAT, inputParameters, connectionParameters);
103+
return Chat.getResponse(CHAT, inputParameters, connectionParameters, context);
100104
}
101105

102106
private static final Chat CHAT = new Chat() {

server/libs/modules/components/llm/groq/src/main/java/com/bytechef/component/groq/action/GroqChatAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import static com.bytechef.component.llm.constant.LLMConstants.PRESENCE_PENALTY;
3636
import static com.bytechef.component.llm.constant.LLMConstants.PRESENCE_PENALTY_PROPERTY;
3737
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_FORMAT_PROPERTY;
38+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_ARRAY_PROPERTY;
39+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_OBJECT_PROPERTY;
3840
import static com.bytechef.component.llm.constant.LLMConstants.STOP;
3941
import static com.bytechef.component.llm.constant.LLMConstants.STOP_PROPERTY;
4042
import static com.bytechef.component.llm.constant.LLMConstants.TEMPERATURE;
@@ -73,6 +75,8 @@ public class GroqChatAction {
7375
.required(true),
7476
MESSAGE_PROPERTY,
7577
RESPONSE_FORMAT_PROPERTY,
78+
RESPONSE_SCHEMA_OBJECT_PROPERTY,
79+
RESPONSE_SCHEMA_ARRAY_PROPERTY,
7680
MAX_TOKENS_PROPERTY,
7781
N_PROPERTY,
7882
TEMPERATURE_PROPERTY,
@@ -91,7 +95,7 @@ private GroqChatAction() {
9195

9296
public static Object perform(
9397
Parameters inputParameters, Parameters connectionParameters, ActionContext context) {
94-
return Chat.getResponse(CHAT, inputParameters, connectionParameters);
98+
return Chat.getResponse(CHAT, inputParameters, connectionParameters, context);
9599
}
96100

97101
private static final Chat CHAT = new Chat() {

server/libs/modules/components/llm/hugging-face/src/main/java/com/bytechef/component/hugging/face/action/HuggingFaceChatAction.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import static com.bytechef.component.llm.constant.LLMConstants.ASK;
2424
import static com.bytechef.component.llm.constant.LLMConstants.MESSAGE_PROPERTY;
2525
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_FORMAT_PROPERTY;
26+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_ARRAY_PROPERTY;
27+
import static com.bytechef.component.llm.constant.LLMConstants.RESPONSE_SCHEMA_OBJECT_PROPERTY;
2628

2729
import com.bytechef.component.definition.ActionContext;
2830
import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition;
@@ -45,7 +47,9 @@ public class HuggingFaceChatAction {
4547
.label("URL")
4648
.description("Url of the inference endpoint"),
4749
MESSAGE_PROPERTY,
48-
RESPONSE_FORMAT_PROPERTY)
50+
RESPONSE_FORMAT_PROPERTY,
51+
RESPONSE_SCHEMA_OBJECT_PROPERTY,
52+
RESPONSE_SCHEMA_ARRAY_PROPERTY)
4953
.output()
5054
.perform(HuggingFaceChatAction::perform);
5155

@@ -54,7 +58,7 @@ private HuggingFaceChatAction() {
5458

5559
public static Object perform(
5660
Parameters inputParameters, Parameters connectionParameters, ActionContext context) {
57-
return Chat.getResponse(CHAT, inputParameters, connectionParameters);
61+
return Chat.getResponse(CHAT, inputParameters, connectionParameters, context);
5862
}
5963

6064
public static final Chat CHAT = new Chat() {

0 commit comments

Comments
 (0)