1
1
/*
2
- * Copyright 2023-2024 the original author or authors.
2
+ * Copyright 2023-2025 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
45
45
* @author Christian Tzolov
46
46
* @author Mariusz Bernacki
47
47
* @author Thomas Vitale
48
+ * @author Ilayaperumal Gopinathan
48
49
* @since 0.8.0
49
50
*/
50
51
@ JsonInclude (Include .NON_NULL )
@@ -173,7 +174,14 @@ public class OpenAiChatOptions implements FunctionCallingOptions {
173
174
* Defaults to true.
174
175
*/
175
176
private @ JsonProperty ("parallel_tool_calls" ) Boolean parallelToolCalls ;
176
-
177
+ /**
178
+ * Whether to store the output of this chat completion request for use in our model <a href="https://platform.openai.com/docs/guides/distillation">distillation</a> or <a href="https://platform.openai.com/docs/guides/evals">evals</a> products.
179
+ */
180
+ private @ JsonProperty ("store" ) Boolean store ;
181
+ /**
182
+ * Developer-defined tags and values used for filtering completions in the <a href="https://platform.openai.com/chat-completions">dashboard</a>.
183
+ */
184
+ private @ JsonProperty ("metadata" ) Map <String , String > metadata = new HashMap <>();
177
185
/**
178
186
* OpenAI Tool Function Callbacks to register with the ChatModel.
179
187
* For Prompt Options the functionCallbacks are automatically enabled for the duration of the prompt execution.
@@ -246,6 +254,8 @@ public static OpenAiChatOptions fromOptions(OpenAiChatOptions fromOptions) {
246
254
.httpHeaders (fromOptions .getHttpHeaders ())
247
255
.proxyToolCalls (fromOptions .getProxyToolCalls ())
248
256
.toolContext (fromOptions .getToolContext ())
257
+ .store (fromOptions .getStore ())
258
+ .metadata (fromOptions .getMetadata ())
249
259
.build ();
250
260
}
251
261
@@ -494,6 +504,22 @@ public void setToolContext(Map<String, Object> toolContext) {
494
504
this .toolContext = toolContext ;
495
505
}
496
506
507
+ public Boolean getStore () {
508
+ return this .store ;
509
+ }
510
+
511
+ public void setStore (Boolean store ) {
512
+ this .store = store ;
513
+ }
514
+
515
+ public Map <String , String > getMetadata () {
516
+ return this .metadata ;
517
+ }
518
+
519
+ public void setMetadata (Map <String , String > metadata ) {
520
+ this .metadata = metadata ;
521
+ }
522
+
497
523
@ Override
498
524
public OpenAiChatOptions copy () {
499
525
return OpenAiChatOptions .fromOptions (this );
@@ -505,7 +531,8 @@ public int hashCode() {
505
531
this .maxTokens , this .maxCompletionTokens , this .n , this .presencePenalty , this .responseFormat ,
506
532
this .streamOptions , this .seed , this .stop , this .temperature , this .topP , this .tools , this .toolChoice ,
507
533
this .user , this .parallelToolCalls , this .functionCallbacks , this .functions , this .httpHeaders ,
508
- this .proxyToolCalls , this .toolContext , this .outputModalities , this .outputAudio );
534
+ this .proxyToolCalls , this .toolContext , this .outputModalities , this .outputAudio , this .store ,
535
+ this .metadata );
509
536
}
510
537
511
538
@ Override
@@ -535,7 +562,8 @@ public boolean equals(Object o) {
535
562
&& Objects .equals (this .toolContext , other .toolContext )
536
563
&& Objects .equals (this .proxyToolCalls , other .proxyToolCalls )
537
564
&& Objects .equals (this .outputModalities , other .outputModalities )
538
- && Objects .equals (this .outputAudio , other .outputAudio );
565
+ && Objects .equals (this .outputAudio , other .outputAudio ) && Objects .equals (this .store , other .store )
566
+ && Objects .equals (this .metadata , other .metadata );
539
567
}
540
568
541
569
@ Override
@@ -702,6 +730,16 @@ public Builder toolContext(Map<String, Object> toolContext) {
702
730
return this ;
703
731
}
704
732
733
+ public Builder store (Boolean store ) {
734
+ this .options .store = store ;
735
+ return this ;
736
+ }
737
+
738
+ public Builder metadata (Map <String , String > metadata ) {
739
+ this .options .metadata = metadata ;
740
+ return this ;
741
+ }
742
+
705
743
public OpenAiChatOptions build () {
706
744
return this .options ;
707
745
}
0 commit comments