Skip to content

Commit 745ed85

Browse files
committed
Update generative module references from "generative-palm" to "generative-google" and enhance JSON tests with additional parameters
1 parent 1f522f1 commit 745ed85

3 files changed

Lines changed: 46 additions & 16 deletions

File tree

src/main/java/io/weaviate/client6/v1/api/collections/Generative.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public enum Kind implements JsonEnum<Kind> {
3939
COHERE("generative-cohere"),
4040
DATABRICKS("generative-databricks"),
4141
FRIENDLIAI("generative-friendliai"),
42-
GOOGLE("generative-palm"),
42+
GOOGLE("generative-google"),
4343
MISTRAL("generative-mistral"),
4444
NVIDIA("generative-nvidia"),
4545
OLLAMA("generative-ollama"),
@@ -185,13 +185,13 @@ public static Generative friendliai(Function<FriendliaiGenerative.Builder, Objec
185185
return FriendliaiGenerative.of(fn);
186186
}
187187

188-
/** Configure a default {@code generative-palm} module. */
188+
/** Configure a default {@code generative-google} module. */
189189
public static Generative googleVertex(String projectId) {
190190
return GoogleGenerative.vertex(projectId);
191191
}
192192

193193
/**
194-
* Configure a {@code generative-palm} module.
194+
* Configure a {@code generative-google} module.
195195
*
196196
* @param projectId Project ID.
197197
* @param fn Lambda expression for optional parameters.
@@ -201,13 +201,13 @@ public static Generative googleVertex(String projectId,
201201
return GoogleGenerative.vertex(projectId, fn);
202202
}
203203

204-
/** Configure a default {@code generative-palm} module. */
204+
/** Configure a default {@code generative-google} module. */
205205
public static Generative googleAiStudio() {
206206
return GoogleGenerative.aiStudio();
207207
}
208208

209209
/**
210-
* Configure a {@code generative-palm} module.
210+
* Configure a {@code generative-google} module.
211211
*
212212
* @param fn Lambda expression for optional parameters.
213213
*/
@@ -399,7 +399,7 @@ default FriendliaiGenerative asFriendliai() {
399399
return _as(Generative.Kind.FRIENDLIAI);
400400
}
401401

402-
/** Is this a {@code generative-palm} provider? */
402+
/** Is this a {@code generative-google} provider? */
403403
default boolean isGoogle() {
404404
return _is(Generative.Kind.GOOGLE);
405405
}
@@ -408,7 +408,7 @@ default boolean isGoogle() {
408408
* Get as {@link GoogleGenerative} instance.
409409
*
410410
* @throws IllegalStateException if the current kind is not
411-
* {@code generative-palm}.
411+
* {@code generative-google}.
412412
*/
413413
default GoogleGenerative asGoogle() {
414414
return _as(Generative.Kind.GOOGLE);

src/main/java/io/weaviate/client6/v1/api/collections/generate/GenerativeProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public static GenerativeProvider friendliai(
100100
}
101101

102102
/**
103-
* Configure {@code generative-palm} as a dynamic provider.
103+
* Configure {@code generative-google} as a dynamic provider.
104104
*
105105
* @param fn Lambda expression for optional parameters.
106106
*/
@@ -110,7 +110,7 @@ public static GenerativeProvider googleAiStudio(
110110
}
111111

112112
/**
113-
* Configure {@code generative-palm} as a dynamic provider.
113+
* Configure {@code generative-google} as a dynamic provider.
114114
*
115115
* @param projectId Google project ID.
116116
* @param fn Lambda expression for optional parameters.

src/test/java/io/weaviate/client6/v1/internal/json/JSONTest.java

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,7 @@ public static Object[][] testCases() {
941941
{
942942
Generative.class,
943943
Generative.anthropic(cfg -> cfg
944+
.baseUrl("https://example.com")
944945
.topK(1)
945946
.maxTokens(2)
946947
.temperature(3f)
@@ -949,6 +950,7 @@ public static Object[][] testCases() {
949950
"""
950951
{
951952
"generative-anthropic": {
953+
"baseURL": "https://example.com",
952954
"topK": 1,
953955
"maxTokens": 2,
954956
"temperature": 3.0,
@@ -964,13 +966,23 @@ public static Object[][] testCases() {
964966
"aws-region",
965967
"example-model",
966968
cfg -> cfg
967-
.model("example-model")),
969+
.model("example-model"),
970+
.temperature(0.7f)
971+
.maxTokenCount(100)
972+
.topK(50)
973+
.topP(0.9f)
974+
.stopSequences("STOP", "END")),
968975
"""
969976
{
970977
"generative-aws": {
971978
"model": "example-model",
972979
"region": "aws-region",
973-
"service": "bedrock"
980+
"service": "bedrock",
981+
"temperature": 0.7,
982+
"maxTokenCount": 100,
983+
"topK": 50,
984+
"topP": 0.9,
985+
"stopSequences": ["STOP", "END"]
974986
}
975987
}
976988
""",
@@ -981,13 +993,21 @@ public static Object[][] testCases() {
981993
"aws-region",
982994
"https://example.com",
983995
cfg -> cfg
984-
.endpoint("https://example.com")),
996+
.endpoint("https://example.com")
997+
.targetModel("custom-model")
998+
.targetVariant("variant-1")
999+
.maxTokensToSample(200)
1000+
.stopSequences("STOP")),
9851001
"""
9861002
{
9871003
"generative-aws": {
9881004
"endpoint": "https://example.com",
9891005
"region": "aws-region",
990-
"service": "sagemaker"
1006+
"service": "sagemaker",
1007+
"targetModel": "custom-model",
1008+
"targetVariant": "variant-1",
1009+
"maxTokensToSample": 200,
1010+
"stopSequences": ["STOP"]
9911011
}
9921012
}
9931013
""",
@@ -1077,13 +1097,15 @@ public static Object[][] testCases() {
10771097
.baseUrl("https://example.com")
10781098
.maxTokens(2)
10791099
.temperature(3f)
1100+
.topP(0.95f)
10801101
.model("example-model")),
10811102
"""
10821103
{
10831104
"generative-nvidia": {
10841105
"baseURL": "https://example.com",
10851106
"maxTokens": 2,
10861107
"temperature": 3.0,
1108+
"topP": 0.95,
10871109
"model": "example-model"
10881110
}
10891111
}
@@ -1099,17 +1121,23 @@ public static Object[][] testCases() {
10991121
.temperature(3f)
11001122
.topK(4)
11011123
.topP(5f)
1102-
.modelId("example-model")),
1124+
.modelId("example-model")
1125+
.endpointId("endpoint-123")
1126+
.region("us-central1")
1127+
.model("gemini-pro")),
11031128
"""
11041129
{
1105-
"generative-palm": {
1130+
"generative-google": {
11061131
"apiEndpoint": "https://example.com",
11071132
"maxOutputTokens": 2,
11081133
"temperature": 3.0,
11091134
"topK": 4,
11101135
"topP": 5,
11111136
"projectId": "google-project",
1112-
"modelId": "example-model"
1137+
"modelId": "example-model",
1138+
"endpointId": "endpoint-123",
1139+
"region": "us-central1",
1140+
"model": "gemini-pro"
11131141
}
11141142
}
11151143
""",
@@ -1134,13 +1162,15 @@ public static Object[][] testCases() {
11341162
.baseUrl("https://example.com")
11351163
.maxTokens(2)
11361164
.temperature(3f)
1165+
.topP(0.9f)
11371166
.model("example-model")),
11381167
"""
11391168
{
11401169
"generative-xai": {
11411170
"baseURL": "https://example.com",
11421171
"maxTokens": 2,
11431172
"temperature": 3.0,
1173+
"topP": 0.9,
11441174
"model": "example-model"
11451175
}
11461176
}

0 commit comments

Comments
 (0)