@@ -281,21 +281,21 @@ public void setToolContext(Map<String, Object> toolContext) {
281281
282282	@ Override 
283283	public  MoonshotChatOptions  copy () {
284- 		return  builder ().withModel (this .model )
285- 			.withMaxTokens (this .maxTokens )
286- 			.withTemperature (this .temperature )
287- 			.withTopP (this .topP )
288- 			.withN (this .n )
289- 			.withPresencePenalty (this .presencePenalty )
290- 			.withFrequencyPenalty (this .frequencyPenalty )
291- 			.withStop (this .stop )
292- 			.withUser (this .user )
293- 			.withTools (this .tools )
294- 			.withToolChoice (this .toolChoice )
295- 			.withFunctionCallbacks (this .functionCallbacks )
296- 			.withFunctions (this .functions )
297- 			.withProxyToolCalls (this .proxyToolCalls )
298- 			.withToolContext (this .toolContext )
284+ 		return  builder ().model (this .model )
285+ 			.maxTokens (this .maxTokens )
286+ 			.temperature (this .temperature )
287+ 			.topP (this .topP )
288+ 			.N (this .n )
289+ 			.presencePenalty (this .presencePenalty )
290+ 			.frequencyPenalty (this .frequencyPenalty )
291+ 			.stop (this .stop )
292+ 			.user (this .user )
293+ 			.tools (this .tools )
294+ 			.toolChoice (this .toolChoice )
295+ 			.functionCallbacks (this .functionCallbacks )
296+ 			.functions (this .functions )
297+ 			.proxyToolCalls (this .proxyToolCalls )
298+ 			.toolContext (this .toolContext )
299299			.build ();
300300	}
301301
@@ -416,94 +416,89 @@ else if (!this.toolContext.equals(other.toolContext)) {
416416
417417	public  static  class  Builder  {
418418
419- 		protected   MoonshotChatOptions  options ;
419+ 		private   final   MoonshotChatOptions  options  =  new   MoonshotChatOptions () ;
420420
421- 		public  Builder () {
422- 			this .options  = new  MoonshotChatOptions ();
423- 		}
424- 
425- 		public  Builder (MoonshotChatOptions  options ) {
426- 			this .options  = options ;
427- 		}
428- 
429- 		public  Builder  withModel (String  model ) {
421+ 		public  Builder  model (String  model ) {
430422			this .options .model  = model ;
431423			return  this ;
432424		}
433425
434- 		public  Builder  withMaxTokens (Integer  maxTokens ) {
426+ 		public  Builder  maxTokens (Integer  maxTokens ) {
435427			this .options .maxTokens  = maxTokens ;
436428			return  this ;
437429		}
438430
439- 		public  Builder  withTemperature (Double  temperature ) {
431+ 		public  Builder  temperature (Double  temperature ) {
440432			this .options .temperature  = temperature ;
441433			return  this ;
442434		}
443435
444- 		public  Builder  withTopP (Double  topP ) {
436+ 		public  Builder  topP (Double  topP ) {
445437			this .options .topP  = topP ;
446438			return  this ;
447439		}
448440
449- 		public  Builder  withN (Integer  n ) {
441+ 		public  Builder  N (Integer  n ) {
450442			this .options .n  = n ;
451443			return  this ;
452444		}
453445
454- 		public  Builder  withPresencePenalty (Double  presencePenalty ) {
446+ 		public  Builder  presencePenalty (Double  presencePenalty ) {
455447			this .options .presencePenalty  = presencePenalty ;
456448			return  this ;
457449		}
458450
459- 		public  Builder  withFrequencyPenalty (Double  frequencyPenalty ) {
451+ 		public  Builder  frequencyPenalty (Double  frequencyPenalty ) {
460452			this .options .frequencyPenalty  = frequencyPenalty ;
461453			return  this ;
462454		}
463455
464- 		public  Builder  withStop (List <String > stop ) {
456+ 		public  Builder  stop (List <String > stop ) {
465457			this .options .stop  = stop ;
466458			return  this ;
467459		}
468460
469- 		public  Builder  withUser (String  user ) {
461+ 		public  Builder  user (String  user ) {
470462			this .options .user  = user ;
471463			return  this ;
472464		}
473465
474- 		public  Builder  withTools (List <MoonshotApi .FunctionTool > tools ) {
466+ 		public  Builder  tools (List <MoonshotApi .FunctionTool > tools ) {
475467			this .options .tools  = tools ;
476468			return  this ;
477469		}
478470
479- 		public  Builder  withToolChoice (String  toolChoice ) {
471+ 		public  Builder  toolChoice (String  toolChoice ) {
480472			this .options .toolChoice  = toolChoice ;
481473			return  this ;
482474		}
483475
484- 		public  Builder  withFunctionCallbacks (List <FunctionCallback > functionCallbacks ) {
476+ 		public  Builder  functionCallbacks (List <FunctionCallback > functionCallbacks ) {
485477			this .options .functionCallbacks  = functionCallbacks ;
486478			return  this ;
487479		}
488480
489- 		public  Builder  withFunctions (Set <String > functionNames ) {
481+ 		public  Builder  functions (Set <String > functionNames ) {
490482			Assert .notNull (functionNames , "Function names must not be null" );
491483			this .options .functions  = functionNames ;
492484			return  this ;
493485		}
494486
495- 		public  Builder  withFunction (String  functionName ) {
487+ 		public  Builder  function (String  functionName ) {
496488			Assert .hasText (functionName , "Function name must not be empty" );
489+ 			if  (this .options .functions  == null ) {
490+ 				this .options .functions  = new  HashSet <>();
491+ 			}
497492			this .options .functions .add (functionName );
498493			return  this ;
499494		}
500495
501- 		public  Builder  withProxyToolCalls (Boolean  proxyToolCalls ) {
496+ 		public  Builder  proxyToolCalls (Boolean  proxyToolCalls ) {
502497			this .options .proxyToolCalls  = proxyToolCalls ;
503498			return  this ;
504499		}
505500
506- 		public  Builder  withToolContext (Map <String , Object > toolContext ) {
501+ 		public  Builder  toolContext (Map <String , Object > toolContext ) {
507502			if  (this .options .toolContext  == null ) {
508503				this .options .toolContext  = toolContext ;
509504			}
@@ -513,6 +508,134 @@ public Builder withToolContext(Map<String, Object> toolContext) {
513508			return  this ;
514509		}
515510
511+ 		/** 
512+ 		 * @deprecated use {@link #functions(Set)} instead. 
513+ 		 */ 
514+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
515+ 		public  Builder  withFunctions (Set <String > functionNames ) {
516+ 			return  functions (functionNames );
517+ 		}
518+ 
519+ 		/** 
520+ 		 * @deprecated use {@link #function(String)} instead. 
521+ 		 */ 
522+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
523+ 		public  Builder  withFunction (String  functionName ) {
524+ 			return  function (functionName );
525+ 		}
526+ 
527+ 		/** 
528+ 		 * @deprecated use {@link #model(String)} instead. 
529+ 		 */ 
530+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
531+ 		public  Builder  withModel (String  model ) {
532+ 			return  model (model );
533+ 		}
534+ 
535+ 		/** 
536+ 		 * @deprecated use {@link #maxTokens(Integer)} instead. 
537+ 		 */ 
538+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
539+ 		public  Builder  withMaxTokens (Integer  maxTokens ) {
540+ 			return  maxTokens (maxTokens );
541+ 		}
542+ 
543+ 		/** 
544+ 		 * @deprecated use {@link #temperature(Double)} instead. 
545+ 		 */ 
546+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
547+ 		public  Builder  withTemperature (Double  temperature ) {
548+ 			return  temperature (temperature );
549+ 		}
550+ 
551+ 		/** 
552+ 		 * @deprecated use {@link #topP(Double)} instead. 
553+ 		 */ 
554+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
555+ 		public  Builder  withTopP (Double  topP ) {
556+ 			return  topP (topP );
557+ 		}
558+ 
559+ 		/** 
560+ 		 * @deprecated use {@link #N(Integer)} instead. 
561+ 		 */ 
562+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
563+ 		public  Builder  withN (Integer  n ) {
564+ 			return  N (n );
565+ 		}
566+ 
567+ 		/** 
568+ 		 * @deprecated use {@link #presencePenalty(Double)} instead. 
569+ 		 */ 
570+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
571+ 		public  Builder  withPresencePenalty (Double  presencePenalty ) {
572+ 			return  presencePenalty (presencePenalty );
573+ 		}
574+ 
575+ 		/** 
576+ 		 * @deprecated use {@link #frequencyPenalty(Double)} instead. 
577+ 		 */ 
578+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
579+ 		public  Builder  withFrequencyPenalty (Double  frequencyPenalty ) {
580+ 			return  frequencyPenalty (frequencyPenalty );
581+ 		}
582+ 
583+ 		/** 
584+ 		 * @deprecated use {@link #stop(List)} instead. 
585+ 		 */ 
586+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
587+ 		public  Builder  withStop (List <String > stop ) {
588+ 			return  stop (stop );
589+ 		}
590+ 
591+ 		/** 
592+ 		 * @deprecated use {@link #user(String)} instead. 
593+ 		 */ 
594+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
595+ 		public  Builder  withUser (String  user ) {
596+ 			return  user (user );
597+ 		}
598+ 
599+ 		/** 
600+ 		 * @deprecated use {@link #tools(List)} instead. 
601+ 		 */ 
602+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
603+ 		public  Builder  withTools (List <MoonshotApi .FunctionTool > tools ) {
604+ 			return  tools (tools );
605+ 		}
606+ 
607+ 		/** 
608+ 		 * @deprecated use {@link #toolChoice(String)} instead. 
609+ 		 */ 
610+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
611+ 		public  Builder  withToolChoice (String  toolChoice ) {
612+ 			return  toolChoice (toolChoice );
613+ 		}
614+ 
615+ 		/** 
616+ 		 * @deprecated use {@link #functionCallbacks(List)} instead. 
617+ 		 */ 
618+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
619+ 		public  Builder  withFunctionCallbacks (List <FunctionCallback > functionCallbacks ) {
620+ 			return  functionCallbacks (functionCallbacks );
621+ 		}
622+ 
623+ 		/** 
624+ 		 * @deprecated use {@link #proxyToolCalls(Boolean)} instead. 
625+ 		 */ 
626+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
627+ 		public  Builder  withProxyToolCalls (Boolean  proxyToolCalls ) {
628+ 			return  proxyToolCalls (proxyToolCalls );
629+ 		}
630+ 
631+ 		/** 
632+ 		 * @deprecated use {@link #toolContext(Map)} instead. 
633+ 		 */ 
634+ 		@ Deprecated (forRemoval  = true , since  = "1.0.0-M5" )
635+ 		public  Builder  withToolContext (Map <String , Object > toolContext ) {
636+ 			return  toolContext (toolContext );
637+ 		}
638+ 
516639		public  MoonshotChatOptions  build () {
517640			return  this .options ;
518641		}
0 commit comments