@@ -64,10 +64,9 @@ macro_rules! openai_compatible_settings {
6464/// # Arguments
6565///
6666/// * `$provider_struct` - The name of the provider struct (e.g., `DeepSeek`)
67- /// * `$provider_display_name` - Display name for the provider (e.g., `"DeepSeek"`)
6867#[ macro_export]
6968macro_rules! openai_compatible_language_model {
70- ( $provider_struct: ident, $provider_display_name : literal ) => {
69+ ( $provider_struct: ident) => {
7170 pub mod language_model {
7271 //! Language model implementation for this provider.
7372
@@ -90,15 +89,15 @@ macro_rules! openai_compatible_language_model {
9089 self . inner. name( )
9190 }
9291
93- #[ doc = concat!( "Generates text using the " , $provider_display_name , " provider." ) ]
92+ #[ doc = concat!( "Generates text using the " , stringify! ( $provider_struct ) , " provider." ) ]
9493 async fn generate_text(
9594 & mut self ,
9695 options: LanguageModelOptions ,
9796 ) -> Result <LanguageModelResponse > {
9897 self . inner. generate_text( options) . await
9998 }
10099
101- #[ doc = concat!( "Streams text using the " , $provider_display_name , " provider." ) ]
100+ #[ doc = concat!( "Streams text using the " , stringify! ( $provider_struct ) , " provider." ) ]
102101 async fn stream_text(
103102 & mut self ,
104103 options: LanguageModelOptions ,
@@ -115,10 +114,9 @@ macro_rules! openai_compatible_language_model {
115114/// # Arguments
116115///
117116/// * `$provider_struct` - The name of the provider struct (e.g., `OpenRouter`)
118- /// * `$provider_display_name` - Display name for the provider (e.g., `"OpenRouter"`)
119117#[ macro_export]
120118macro_rules! openai_compatible_embedding_model {
121- ( $provider_struct: ident, $provider_display_name : literal ) => {
119+ ( $provider_struct: ident) => {
122120 pub mod embedding_model {
123121 //! Embedding model implementation for this provider.
124122
@@ -156,18 +154,14 @@ macro_rules! openai_compatible_embedding_model {
156154/// * `$provider_struct` - The name of the provider struct (e.g., `DeepSeek`)
157155/// * `$builder_struct` - The name of the builder struct (e.g., `DeepSeekBuilder`)
158156/// * `$settings_struct` - The name of the settings struct (e.g., `DeepSeekProviderSettings`)
159- /// * `$provider_display_name` - Display name for the provider (e.g., `"DeepSeek"`)
160157/// * `$example_model` - Example model identifier for docs (e.g., `"deepseek-chat"`)
161- /// * `$example_method` - Example constructor method for docs (e.g., `"deepseek_chat()"`)
162158#[ macro_export]
163159macro_rules! openai_compatible_provider {
164160 (
165161 $provider_struct: ident,
166162 $builder_struct: ident,
167163 $settings_struct: ident,
168- $provider_display_name: literal,
169- $example_model: literal,
170- $example_method: literal
164+ $example_model: literal
171165 ) => {
172166 use $crate:: Error ;
173167 use $crate:: core:: DynamicModel ;
@@ -177,32 +171,32 @@ macro_rules! openai_compatible_provider {
177171 use $crate:: providers:: openai_chat_completions:: OpenAIChatCompletions ;
178172 use settings:: $settings_struct;
179173
180- #[ doc = concat!( "The " , $provider_display_name , " provider, wrapping OpenAI Chat Completions API." ) ]
174+ #[ doc = concat!( "The " , stringify! ( $provider_struct ) , " provider, wrapping OpenAI Chat Completions API." ) ]
181175 #[ derive( Debug , Clone ) ]
182176 pub struct $provider_struct<M : ModelName > {
183- #[ doc = concat!( "Configuration settings for the " , $provider_display_name , " provider." ) ]
177+ #[ doc = concat!( "Configuration settings for the " , stringify! ( $provider_struct ) , " provider." ) ]
184178 pub settings: $settings_struct,
185179 pub ( crate ) inner: OpenAIChatCompletions <M >,
186180 }
187181
188182 impl <M : ModelName > $provider_struct<M > {
189- #[ doc = concat!( $provider_display_name , " provider setting builder." ) ]
183+ #[ doc = concat!( stringify! ( $provider_struct ) , " provider setting builder." ) ]
190184 pub fn builder( ) -> $builder_struct<M > {
191185 $builder_struct:: default ( )
192186 }
193187 }
194188
195189 impl $provider_struct<DynamicModel > {
196190 #[ doc = concat!(
197- "Creates a " , $provider_display_name , " provider with a dynamic model name using default settings.\n \n " ,
191+ "Creates a " , stringify! ( $provider_struct ) , " provider with a dynamic model name using default settings.\n \n " ,
198192 "This allows you to specify the model name as a string rather than\n " ,
199- "using methods like `" , stringify! ( $provider_struct ) , "::" , $example_method , "`, etc .\n \n ",
193+ "using typed constructor methods .\n \n " ,
200194 "**WARNING**: when using `DynamicModel`, model capabilities are not validated.\n " ,
201195 "This means there is no compile-time guarantee that the model supports requested features.\n \n " ,
202196 "For custom configuration (API key, base URL, etc.), use the builder pattern:\n " ,
203197 "`" , stringify!( $provider_struct) , "::<DynamicModel>::builder().model_name(...).api_key(...).build()`\n \n " ,
204198 "# Parameters\n \n " ,
205- "* `model_name` - The " , $provider_display_name , " model identifier (e.g., \" ", $example_model, "\" )\n \n " ,
199+ "* `model_name` - The model identifier (e.g., \" " , $example_model, "\" )\n \n " ,
206200 "# Returns\n \n " ,
207201 "A configured `" , stringify!( $provider_struct) , "<DynamicModel>` provider instance with default settings."
208202 ) ]
@@ -215,20 +209,20 @@ macro_rules! openai_compatible_provider {
215209 }
216210
217211 impl <M : ModelName > Default for $provider_struct<M > {
218- #[ doc = concat!( "Creates a new " , $provider_display_name , " provider with default settings." ) ]
212+ #[ doc = concat!( "Creates a new " , stringify! ( $provider_struct ) , " provider with default settings." ) ]
219213 fn default ( ) -> $provider_struct<M > {
220214 $builder_struct:: default ( ) . build( ) . unwrap( )
221215 }
222216 }
223217
224- #[ doc = concat!( $provider_display_name , " provider builder" ) ]
218+ #[ doc = concat!( stringify! ( $provider_struct ) , " provider builder" ) ]
225219 pub struct $builder_struct<M : ModelName > {
226220 settings: $settings_struct,
227221 inner: OpenAIChatCompletions <M >,
228222 }
229223
230224 impl <M : ModelName > Default for $builder_struct<M > {
231- #[ doc = concat!( "Creates a new " , $provider_display_name , " provider builder with default settings." ) ]
225+ #[ doc = concat!( "Creates a new " , stringify! ( $provider_struct ) , " provider builder with default settings." ) ]
232226 fn default ( ) -> Self {
233227 let settings = $settings_struct:: default ( ) ;
234228 let mut inner = OpenAIChatCompletions :: default ( ) ;
@@ -242,7 +236,7 @@ macro_rules! openai_compatible_provider {
242236
243237 impl <M : ModelName > $builder_struct<M > {
244238 #[ doc = concat!(
245- "Sets the provider name for the " , $provider_display_name , " provider.\n \n " ,
239+ "Sets the provider name for the " , stringify! ( $provider_struct ) , " provider.\n \n " ,
246240 "# Parameters\n \n " ,
247241 "* `provider_name` - The provider name string.\n \n " ,
248242 "# Returns\n \n " ,
@@ -256,7 +250,7 @@ macro_rules! openai_compatible_provider {
256250 }
257251
258252 #[ doc = concat!(
259- "Sets the base URL for the " , $provider_display_name , " provider.\n \n " ,
253+ "Sets the base URL for the " , stringify! ( $provider_struct ) , " provider.\n \n " ,
260254 "# Parameters\n \n " ,
261255 "* `base_url` - The base URL string for API requests.\n \n " ,
262256 "# Returns\n \n " ,
@@ -270,7 +264,7 @@ macro_rules! openai_compatible_provider {
270264 }
271265
272266 #[ doc = concat!(
273- "Sets the API key for the " , $provider_display_name , " provider.\n \n " ,
267+ "Sets the API key for the " , stringify! ( $provider_struct ) , " provider.\n \n " ,
274268 "# Parameters\n \n " ,
275269 "* `api_key` - The API key string for authentication.\n \n " ,
276270 "# Returns\n \n " ,
@@ -284,7 +278,7 @@ macro_rules! openai_compatible_provider {
284278 }
285279
286280 #[ doc = concat!(
287- "Builds the " , $provider_display_name , " provider.\n \n " ,
281+ "Builds the " , stringify! ( $provider_struct ) , " provider.\n \n " ,
288282 "Validates the configuration and creates the provider instance.\n \n " ,
289283 "# Returns\n \n " ,
290284 "A `Result` containing the configured `" , stringify!( $provider_struct) , "<M>` or an `Error`."
@@ -314,10 +308,9 @@ macro_rules! openai_compatible_provider {
314308 "Sets the model name from a string. e.g., \" " , $example_model, "\" \n \n " ,
315309 "**WARNING**: when using `DynamicModel`, model capabilities are not validated.\n " ,
316310 "This means there is no compile-time guarantee that the model supports requested features.\n \n " ,
317- "For compile-time model validation, use the constructor methods like `" ,
318- stringify!( $provider_struct) , "::" , $example_method, "`.\n \n " ,
311+ "For compile-time model validation, use typed constructor methods.\n \n " ,
319312 "# Parameters\n \n " ,
320- "* `model_name` - The " , $provider_display_name , " model identifier (e.g., \" ", $example_model, "\" )\n \n " ,
313+ "* `model_name` - The model identifier (e.g., \" " , $example_model, "\" )\n \n " ,
321314 "# Returns\n \n " ,
322315 "The builder with the model name set."
323316 ) ]
0 commit comments