@@ -53,7 +53,7 @@ pub struct OpenAI<C: async_openai::config::Config + Default = async_openai::conf
53
53
54
54
/// The `Options` struct holds configuration options for the `OpenAI` client.
55
55
/// It includes optional fields for specifying the embedding and prompt models.
56
- #[ derive( Debug , Default , Clone , Builder ) ]
56
+ #[ derive( Debug , Clone , Builder ) ]
57
57
#[ builder( setter( into, strip_option) ) ]
58
58
pub struct Options {
59
59
/// The default embedding model to use, if specified.
@@ -62,6 +62,22 @@ pub struct Options {
62
62
/// The default prompt model to use, if specified.
63
63
#[ builder( default ) ]
64
64
pub prompt_model : Option < String > ,
65
+
66
+ #[ builder( default = true ) ]
67
+ /// Option to enable or disable parallel tool calls for completions.
68
+ ///
69
+ /// At this moment, o1 and o3-mini do not support it.
70
+ pub parallel_tool_calls : bool ,
71
+ }
72
+
73
+ impl Default for Options {
74
+ fn default ( ) -> Self {
75
+ Self {
76
+ embed_model : None ,
77
+ prompt_model : None ,
78
+ parallel_tool_calls : true ,
79
+ }
80
+ }
65
81
}
66
82
67
83
impl Options {
@@ -110,6 +126,23 @@ impl<C: async_openai::config::Config + Default + Sync + Send + std::fmt::Debug>
110
126
self
111
127
}
112
128
129
+ /// Enable or disable parallel tool calls for completions.
130
+ ///
131
+ /// Note that currently reasoning models do not support parallel tool calls
132
+ ///
133
+ /// Defaults to `true`
134
+ pub fn parallel_tool_calls ( & mut self , parallel_tool_calls : bool ) -> & mut Self {
135
+ if let Some ( options) = self . default_options . as_mut ( ) {
136
+ options. parallel_tool_calls = parallel_tool_calls;
137
+ } else {
138
+ self . default_options = Some ( Options {
139
+ parallel_tool_calls,
140
+ ..Default :: default ( )
141
+ } ) ;
142
+ }
143
+ self
144
+ }
145
+
113
146
/// Sets the default prompt model for the `OpenAI` instance.
114
147
///
115
148
/// # Parameters
0 commit comments