|
37 | 37 | * @author Pablo Sanchidrian Herrera |
38 | 38 | * @author John Jairo Moreno Rojas |
39 | 39 | * @author Thomas Vitale |
| 40 | + * @author Alexandros Pappas |
40 | 41 | * @since 1.0.0 |
41 | 42 | * @see <a href= |
42 | 43 | * "https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-model-parameters.html?context=wx&audience=wdp">watsonx.ai |
@@ -155,17 +156,17 @@ public static Map<String, Object> filterNonSupportedFields(Map<String, Object> o |
155 | 156 |
|
156 | 157 | public static WatsonxAiChatOptions fromOptions(WatsonxAiChatOptions fromOptions) { |
157 | 158 | return WatsonxAiChatOptions.builder() |
158 | | - .withTemperature(fromOptions.getTemperature()) |
159 | | - .withTopP(fromOptions.getTopP()) |
160 | | - .withTopK(fromOptions.getTopK()) |
161 | | - .withDecodingMethod(fromOptions.getDecodingMethod()) |
162 | | - .withMaxNewTokens(fromOptions.getMaxNewTokens()) |
163 | | - .withMinNewTokens(fromOptions.getMinNewTokens()) |
164 | | - .withStopSequences(fromOptions.getStopSequences()) |
165 | | - .withRepetitionPenalty(fromOptions.getRepetitionPenalty()) |
166 | | - .withRandomSeed(fromOptions.getRandomSeed()) |
167 | | - .withModel(fromOptions.getModel()) |
168 | | - .withAdditionalProperties(fromOptions.getAdditionalProperties()) |
| 159 | + .temperature(fromOptions.getTemperature()) |
| 160 | + .topP(fromOptions.getTopP()) |
| 161 | + .topK(fromOptions.getTopK()) |
| 162 | + .decodingMethod(fromOptions.getDecodingMethod()) |
| 163 | + .maxNewTokens(fromOptions.getMaxNewTokens()) |
| 164 | + .minNewTokens(fromOptions.getMinNewTokens()) |
| 165 | + .stopSequences(fromOptions.getStopSequences()) |
| 166 | + .repetitionPenalty(fromOptions.getRepetitionPenalty()) |
| 167 | + .randomSeed(fromOptions.getRandomSeed()) |
| 168 | + .model(fromOptions.getModel()) |
| 169 | + .additionalProperties(fromOptions.getAdditionalProperties()) |
169 | 170 | .build(); |
170 | 171 | } |
171 | 172 |
|
@@ -326,66 +327,162 @@ public static class Builder { |
326 | 327 |
|
327 | 328 | WatsonxAiChatOptions options = new WatsonxAiChatOptions(); |
328 | 329 |
|
329 | | - public Builder withTemperature(Double temperature) { |
| 330 | + public Builder temperature(Double temperature) { |
330 | 331 | this.options.temperature = temperature; |
331 | 332 | return this; |
332 | 333 | } |
333 | 334 |
|
334 | | - public Builder withTopP(Double topP) { |
| 335 | + public Builder topP(Double topP) { |
335 | 336 | this.options.topP = topP; |
336 | 337 | return this; |
337 | 338 | } |
338 | 339 |
|
339 | | - public Builder withTopK(Integer topK) { |
| 340 | + public Builder topK(Integer topK) { |
340 | 341 | this.options.topK = topK; |
341 | 342 | return this; |
342 | 343 | } |
343 | 344 |
|
344 | | - public Builder withDecodingMethod(String decodingMethod) { |
| 345 | + public Builder decodingMethod(String decodingMethod) { |
345 | 346 | this.options.decodingMethod = decodingMethod; |
346 | 347 | return this; |
347 | 348 | } |
348 | 349 |
|
349 | | - public Builder withMaxNewTokens(Integer maxNewTokens) { |
| 350 | + public Builder maxNewTokens(Integer maxNewTokens) { |
350 | 351 | this.options.maxNewTokens = maxNewTokens; |
351 | 352 | return this; |
352 | 353 | } |
353 | 354 |
|
354 | | - public Builder withMinNewTokens(Integer minNewTokens) { |
| 355 | + public Builder minNewTokens(Integer minNewTokens) { |
355 | 356 | this.options.minNewTokens = minNewTokens; |
356 | 357 | return this; |
357 | 358 | } |
358 | 359 |
|
359 | | - public Builder withStopSequences(List<String> stopSequences) { |
| 360 | + public Builder stopSequences(List<String> stopSequences) { |
360 | 361 | this.options.stopSequences = stopSequences; |
361 | 362 | return this; |
362 | 363 | } |
363 | 364 |
|
364 | | - public Builder withRepetitionPenalty(Double repetitionPenalty) { |
| 365 | + public Builder repetitionPenalty(Double repetitionPenalty) { |
365 | 366 | this.options.repetitionPenalty = repetitionPenalty; |
366 | 367 | return this; |
367 | 368 | } |
368 | 369 |
|
369 | | - public Builder withRandomSeed(Integer randomSeed) { |
| 370 | + public Builder randomSeed(Integer randomSeed) { |
370 | 371 | this.options.randomSeed = randomSeed; |
371 | 372 | return this; |
372 | 373 | } |
373 | 374 |
|
374 | | - public Builder withModel(String model) { |
| 375 | + public Builder model(String model) { |
375 | 376 | this.options.model = model; |
376 | 377 | return this; |
377 | 378 | } |
378 | 379 |
|
379 | | - public Builder withAdditionalProperty(String key, Object value) { |
| 380 | + public Builder additionalProperty(String key, Object value) { |
380 | 381 | this.options.additional.put(key, value); |
381 | 382 | return this; |
382 | 383 | } |
383 | 384 |
|
384 | | - public Builder withAdditionalProperties(Map<String, Object> properties) { |
| 385 | + public Builder additionalProperties(Map<String, Object> properties) { |
385 | 386 | this.options.additional.putAll(properties); |
386 | 387 | return this; |
387 | 388 | } |
388 | 389 |
|
| 390 | + /** |
| 391 | + * @deprecated use {@link #temperature(Double)} instead. |
| 392 | + */ |
| 393 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 394 | + public Builder withTemperature(Double temperature) { |
| 395 | + return temperature(temperature); |
| 396 | + } |
| 397 | + |
| 398 | + /** |
| 399 | + * @deprecated use {@link #topP(Double)} instead. |
| 400 | + */ |
| 401 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 402 | + public Builder withTopP(Double topP) { |
| 403 | + return topP(topP); |
| 404 | + } |
| 405 | + |
| 406 | + /** |
| 407 | + * @deprecated use {@link #topK(Integer)} instead. |
| 408 | + */ |
| 409 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 410 | + public Builder withTopK(Integer topK) { |
| 411 | + return topK(topK); |
| 412 | + } |
| 413 | + |
| 414 | + /** |
| 415 | + * @deprecated use {@link #decodingMethod(String)} instead. |
| 416 | + */ |
| 417 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 418 | + public Builder withDecodingMethod(String decodingMethod) { |
| 419 | + return decodingMethod(decodingMethod); |
| 420 | + } |
| 421 | + |
| 422 | + /** |
| 423 | + * @deprecated use {@link #maxNewTokens(Integer)} instead. |
| 424 | + */ |
| 425 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 426 | + public Builder withMaxNewTokens(Integer maxNewTokens) { |
| 427 | + return maxNewTokens(maxNewTokens); |
| 428 | + } |
| 429 | + |
| 430 | + /** |
| 431 | + * @deprecated use {@link #minNewTokens(Integer)} instead. |
| 432 | + */ |
| 433 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 434 | + public Builder withMinNewTokens(Integer minNewTokens) { |
| 435 | + return minNewTokens(minNewTokens); |
| 436 | + } |
| 437 | + |
| 438 | + /** |
| 439 | + * @deprecated use {@link #stopSequences(List)} instead. |
| 440 | + */ |
| 441 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 442 | + public Builder withStopSequences(List<String> stopSequences) { |
| 443 | + return stopSequences(stopSequences); |
| 444 | + } |
| 445 | + |
| 446 | + /** |
| 447 | + * @deprecated use {@link #repetitionPenalty(Double)} instead. |
| 448 | + */ |
| 449 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 450 | + public Builder withRepetitionPenalty(Double repetitionPenalty) { |
| 451 | + return repetitionPenalty(repetitionPenalty); |
| 452 | + } |
| 453 | + |
| 454 | + /** |
| 455 | + * @deprecated use {@link #randomSeed(Integer)} instead. |
| 456 | + */ |
| 457 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 458 | + public Builder withRandomSeed(Integer randomSeed) { |
| 459 | + return randomSeed(randomSeed); |
| 460 | + } |
| 461 | + |
| 462 | + /** |
| 463 | + * @deprecated use {@link #model(String)} instead. |
| 464 | + */ |
| 465 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 466 | + public Builder withModel(String model) { |
| 467 | + return model(model); |
| 468 | + } |
| 469 | + |
| 470 | + /** |
| 471 | + * @deprecated use {@link #additionalProperty(String, Object)} instead. |
| 472 | + */ |
| 473 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 474 | + public Builder withAdditionalProperty(String key, Object value) { |
| 475 | + return additionalProperty(key, value); |
| 476 | + } |
| 477 | + |
| 478 | + /** |
| 479 | + * @deprecated use {@link #additionalProperties(Map)} instead. |
| 480 | + */ |
| 481 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
| 482 | + public Builder withAdditionalProperties(Map<String, Object> properties) { |
| 483 | + return additionalProperties(properties); |
| 484 | + } |
| 485 | + |
389 | 486 | public WatsonxAiChatOptions build() { |
390 | 487 | return this.options; |
391 | 488 | } |
|
0 commit comments