|
42 | 42 | * @see ChatOptions |
43 | 43 | * @author Geng Rong |
44 | 44 | * @author Thomas Vitale |
| 45 | + * @author Ilayaperumal Gopinathan |
45 | 46 | * @since 1.0.0 M1 |
46 | 47 | */ |
47 | 48 | @JsonInclude(Include.NON_NULL) |
@@ -154,23 +155,23 @@ public static Builder builder() { |
154 | 155 | } |
155 | 156 |
|
156 | 157 | public static MiniMaxChatOptions fromOptions(MiniMaxChatOptions fromOptions) { |
157 | | - return builder().withModel(fromOptions.getModel()) |
158 | | - .withFrequencyPenalty(fromOptions.getFrequencyPenalty()) |
159 | | - .withMaxTokens(fromOptions.getMaxTokens()) |
160 | | - .withN(fromOptions.getN()) |
161 | | - .withPresencePenalty(fromOptions.getPresencePenalty()) |
162 | | - .withResponseFormat(fromOptions.getResponseFormat()) |
163 | | - .withSeed(fromOptions.getSeed()) |
164 | | - .withStop(fromOptions.getStop()) |
165 | | - .withTemperature(fromOptions.getTemperature()) |
166 | | - .withTopP(fromOptions.getTopP()) |
167 | | - .withMaskSensitiveInfo(fromOptions.getMaskSensitiveInfo()) |
168 | | - .withTools(fromOptions.getTools()) |
169 | | - .withToolChoice(fromOptions.getToolChoice()) |
170 | | - .withFunctionCallbacks(fromOptions.getFunctionCallbacks()) |
171 | | - .withFunctions(fromOptions.getFunctions()) |
172 | | - .withProxyToolCalls(fromOptions.getProxyToolCalls()) |
173 | | - .withToolContext(fromOptions.getToolContext()) |
| 158 | + return builder().model(fromOptions.getModel()) |
| 159 | + .frequencyPenalty(fromOptions.getFrequencyPenalty()) |
| 160 | + .maxTokens(fromOptions.getMaxTokens()) |
| 161 | + .N(fromOptions.getN()) |
| 162 | + .presencePenalty(fromOptions.getPresencePenalty()) |
| 163 | + .responseFormat(fromOptions.getResponseFormat()) |
| 164 | + .seed(fromOptions.getSeed()) |
| 165 | + .stop(fromOptions.getStop()) |
| 166 | + .temperature(fromOptions.getTemperature()) |
| 167 | + .topP(fromOptions.getTopP()) |
| 168 | + .maskSensitiveInfo(fromOptions.getMaskSensitiveInfo()) |
| 169 | + .tools(fromOptions.getTools()) |
| 170 | + .toolChoice(fromOptions.getToolChoice()) |
| 171 | + .functionCallbacks(fromOptions.getFunctionCallbacks()) |
| 172 | + .functions(fromOptions.getFunctions()) |
| 173 | + .proxyToolCalls(fromOptions.getProxyToolCalls()) |
| 174 | + .toolContext(fromOptions.getToolContext()) |
174 | 175 | .build(); |
175 | 176 | } |
176 | 177 |
|
@@ -515,93 +516,264 @@ public Builder(MiniMaxChatOptions options) { |
515 | 516 | this.options = options; |
516 | 517 | } |
517 | 518 |
|
| 519 | + public Builder model(String model) { |
| 520 | + this.options.model = model; |
| 521 | + return this; |
| 522 | + } |
| 523 | + |
| 524 | + public Builder frequencyPenalty(Double frequencyPenalty) { |
| 525 | + this.options.frequencyPenalty = frequencyPenalty; |
| 526 | + return this; |
| 527 | + } |
| 528 | + |
| 529 | + public Builder maxTokens(Integer maxTokens) { |
| 530 | + this.options.maxTokens = maxTokens; |
| 531 | + return this; |
| 532 | + } |
| 533 | + |
| 534 | + public Builder N(Integer n) { |
| 535 | + this.options.n = n; |
| 536 | + return this; |
| 537 | + } |
| 538 | + |
| 539 | + public Builder presencePenalty(Double presencePenalty) { |
| 540 | + this.options.presencePenalty = presencePenalty; |
| 541 | + return this; |
| 542 | + } |
| 543 | + |
| 544 | + public Builder responseFormat(MiniMaxApi.ChatCompletionRequest.ResponseFormat responseFormat) { |
| 545 | + this.options.responseFormat = responseFormat; |
| 546 | + return this; |
| 547 | + } |
| 548 | + |
| 549 | + public Builder seed(Integer seed) { |
| 550 | + this.options.seed = seed; |
| 551 | + return this; |
| 552 | + } |
| 553 | + |
| 554 | + public Builder stop(List<String> stop) { |
| 555 | + this.options.stop = stop; |
| 556 | + return this; |
| 557 | + } |
| 558 | + |
| 559 | + public Builder temperature(Double temperature) { |
| 560 | + this.options.temperature = temperature; |
| 561 | + return this; |
| 562 | + } |
| 563 | + |
| 564 | + public Builder topP(Double topP) { |
| 565 | + this.options.topP = topP; |
| 566 | + return this; |
| 567 | + } |
| 568 | + |
| 569 | + public Builder maskSensitiveInfo(Boolean maskSensitiveInfo) { |
| 570 | + this.options.maskSensitiveInfo = maskSensitiveInfo; |
| 571 | + return this; |
| 572 | + } |
| 573 | + |
| 574 | + public Builder tools(List<MiniMaxApi.FunctionTool> tools) { |
| 575 | + this.options.tools = tools; |
| 576 | + return this; |
| 577 | + } |
| 578 | + |
| 579 | + public Builder toolChoice(String toolChoice) { |
| 580 | + this.options.toolChoice = toolChoice; |
| 581 | + return this; |
| 582 | + } |
| 583 | + |
| 584 | + public Builder functionCallbacks(List<FunctionCallback> functionCallbacks) { |
| 585 | + this.options.functionCallbacks = functionCallbacks; |
| 586 | + return this; |
| 587 | + } |
| 588 | + |
| 589 | + public Builder functions(Set<String> functionNames) { |
| 590 | + Assert.notNull(functionNames, "Function names must not be null"); |
| 591 | + this.options.functions = functionNames; |
| 592 | + return this; |
| 593 | + } |
| 594 | + |
| 595 | + public Builder function(String functionName) { |
| 596 | + Assert.hasText(functionName, "Function name must not be empty"); |
| 597 | + this.options.functions.add(functionName); |
| 598 | + return this; |
| 599 | + } |
| 600 | + |
| 601 | + public Builder proxyToolCalls(Boolean proxyToolCalls) { |
| 602 | + this.options.proxyToolCalls = proxyToolCalls; |
| 603 | + return this; |
| 604 | + } |
| 605 | + |
| 606 | + public Builder toolContext(Map<String, Object> toolContext) { |
| 607 | + if (this.options.toolContext == null) { |
| 608 | + this.options.toolContext = toolContext; |
| 609 | + } |
| 610 | + else { |
| 611 | + this.options.toolContext.putAll(toolContext); |
| 612 | + } |
| 613 | + return this; |
| 614 | + } |
| 615 | + |
| 616 | + /** |
| 617 | + * @deprecated use {@link #model(String)} instead. |
| 618 | + */ |
| 619 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
518 | 620 | public Builder withModel(String model) { |
519 | 621 | this.options.model = model; |
520 | 622 | return this; |
521 | 623 | } |
522 | 624 |
|
| 625 | + /** |
| 626 | + * @deprecated use {@link #frequencyPenalty(Double)} instead. |
| 627 | + */ |
| 628 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
523 | 629 | public Builder withFrequencyPenalty(Double frequencyPenalty) { |
524 | 630 | this.options.frequencyPenalty = frequencyPenalty; |
525 | 631 | return this; |
526 | 632 | } |
527 | 633 |
|
| 634 | + /** |
| 635 | + * @deprecated use {@link #maxTokens(Integer)} instead. |
| 636 | + */ |
| 637 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
528 | 638 | public Builder withMaxTokens(Integer maxTokens) { |
529 | 639 | this.options.maxTokens = maxTokens; |
530 | 640 | return this; |
531 | 641 | } |
532 | 642 |
|
| 643 | + /** |
| 644 | + * @deprecated use {@link #N(Integer)} instead. |
| 645 | + */ |
| 646 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
533 | 647 | public Builder withN(Integer n) { |
534 | 648 | this.options.n = n; |
535 | 649 | return this; |
536 | 650 | } |
537 | 651 |
|
| 652 | + /** |
| 653 | + * @deprecated use {@link #presencePenalty(Double)} instead. |
| 654 | + */ |
| 655 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
538 | 656 | public Builder withPresencePenalty(Double presencePenalty) { |
539 | 657 | this.options.presencePenalty = presencePenalty; |
540 | 658 | return this; |
541 | 659 | } |
542 | 660 |
|
| 661 | + /** |
| 662 | + * @deprecated use |
| 663 | + * {@link #responseFormat(MiniMaxApi.ChatCompletionRequest.ResponseFormat)} |
| 664 | + * instead. |
| 665 | + */ |
| 666 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
543 | 667 | public Builder withResponseFormat(MiniMaxApi.ChatCompletionRequest.ResponseFormat responseFormat) { |
544 | 668 | this.options.responseFormat = responseFormat; |
545 | 669 | return this; |
546 | 670 | } |
547 | 671 |
|
| 672 | + /** |
| 673 | + * @deprecated use {@link #seed(Integer)} instead. |
| 674 | + */ |
| 675 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
548 | 676 | public Builder withSeed(Integer seed) { |
549 | 677 | this.options.seed = seed; |
550 | 678 | return this; |
551 | 679 | } |
552 | 680 |
|
| 681 | + /** |
| 682 | + * @deprecated use {@link #stop(List)} instead. |
| 683 | + */ |
| 684 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
553 | 685 | public Builder withStop(List<String> stop) { |
554 | 686 | this.options.stop = stop; |
555 | 687 | return this; |
556 | 688 | } |
557 | 689 |
|
| 690 | + /** |
| 691 | + * @deprecated use {@link #temperature(Double)} instead. |
| 692 | + */ |
| 693 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
558 | 694 | public Builder withTemperature(Double temperature) { |
559 | 695 | this.options.temperature = temperature; |
560 | 696 | return this; |
561 | 697 | } |
562 | 698 |
|
| 699 | + /** |
| 700 | + * @deprecated use {@link #topP(Double)} instead. |
| 701 | + */ |
| 702 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
563 | 703 | public Builder withTopP(Double topP) { |
564 | 704 | this.options.topP = topP; |
565 | 705 | return this; |
566 | 706 | } |
567 | 707 |
|
| 708 | + /** |
| 709 | + * @deprecated use {@link #maskSensitiveInfo(Boolean)} instead. |
| 710 | + */ |
| 711 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
568 | 712 | public Builder withMaskSensitiveInfo(Boolean maskSensitiveInfo) { |
569 | 713 | this.options.maskSensitiveInfo = maskSensitiveInfo; |
570 | 714 | return this; |
571 | 715 | } |
572 | 716 |
|
| 717 | + /** |
| 718 | + * @deprecated use {@link #tools(List)} instead. |
| 719 | + */ |
| 720 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
573 | 721 | public Builder withTools(List<MiniMaxApi.FunctionTool> tools) { |
574 | 722 | this.options.tools = tools; |
575 | 723 | return this; |
576 | 724 | } |
577 | 725 |
|
| 726 | + /** |
| 727 | + * @deprecated use {@link #toolChoice(String)} instead. |
| 728 | + */ |
| 729 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
578 | 730 | public Builder withToolChoice(String toolChoice) { |
579 | 731 | this.options.toolChoice = toolChoice; |
580 | 732 | return this; |
581 | 733 | } |
582 | 734 |
|
| 735 | + /** |
| 736 | + * @deprecated use {@link #functionCallbacks(List)} instead. |
| 737 | + */ |
| 738 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
583 | 739 | public Builder withFunctionCallbacks(List<FunctionCallback> functionCallbacks) { |
584 | 740 | this.options.functionCallbacks = functionCallbacks; |
585 | 741 | return this; |
586 | 742 | } |
587 | 743 |
|
| 744 | + /** |
| 745 | + * @deprecated use {@link #functions(Set)} instead. |
| 746 | + */ |
| 747 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
588 | 748 | public Builder withFunctions(Set<String> functionNames) { |
589 | 749 | Assert.notNull(functionNames, "Function names must not be null"); |
590 | 750 | this.options.functions = functionNames; |
591 | 751 | return this; |
592 | 752 | } |
593 | 753 |
|
| 754 | + /** |
| 755 | + * @deprecated use {@link #function(String)} instead. |
| 756 | + */ |
| 757 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
594 | 758 | public Builder withFunction(String functionName) { |
595 | 759 | Assert.hasText(functionName, "Function name must not be empty"); |
596 | 760 | this.options.functions.add(functionName); |
597 | 761 | return this; |
598 | 762 | } |
599 | 763 |
|
| 764 | + /** |
| 765 | + * @deprecated use {@link #proxyToolCalls(Boolean)} instead. |
| 766 | + */ |
| 767 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
600 | 768 | public Builder withProxyToolCalls(Boolean proxyToolCalls) { |
601 | 769 | this.options.proxyToolCalls = proxyToolCalls; |
602 | 770 | return this; |
603 | 771 | } |
604 | 772 |
|
| 773 | + /** |
| 774 | + * @deprecated use {@link #toolContext(Map)} instead. |
| 775 | + */ |
| 776 | + @Deprecated(forRemoval = true, since = "1.0.0-M5") |
605 | 777 | public Builder withToolContext(Map<String, Object> toolContext) { |
606 | 778 | if (this.options.toolContext == null) { |
607 | 779 | this.options.toolContext = toolContext; |
|
0 commit comments