@@ -215,29 +215,32 @@ where
215215 fn post_audio_generation ( & self , deployment_id : & str ) -> http_client:: Builder {
216216 let url = format ! (
217217 "{}/openai/deployments/{}/audio/speech?api-version={}" ,
218- self . azure_endpoint, deployment_id, self . api_version
219- )
220- . replace ( "//" , "/" ) ;
218+ self . azure_endpoint,
219+ deployment_id. trim_start_matches( '/' ) ,
220+ self . api_version
221+ ) ;
221222
222223 self . post ( url)
223224 }
224225
225226 fn post_chat_completion ( & self , deployment_id : & str ) -> http_client:: Builder {
226227 let url = format ! (
227228 "{}/openai/deployments/{}/chat/completions?api-version={}" ,
228- self . azure_endpoint, deployment_id, self . api_version
229- )
230- . replace ( "//" , "/" ) ;
229+ self . azure_endpoint,
230+ deployment_id. trim_start_matches( '/' ) ,
231+ self . api_version
232+ ) ;
231233
232234 self . post ( url)
233235 }
234236
235237 fn post_transcription ( & self , deployment_id : & str ) -> http_client:: Builder {
236238 let url = format ! (
237239 "{}/openai/deployments/{}/audio/translations?api-version={}" ,
238- self . azure_endpoint, deployment_id, self . api_version
239- )
240- . replace ( "//" , "/" ) ;
240+ self . azure_endpoint,
241+ deployment_id. trim_start_matches( '/' ) ,
242+ self . api_version
243+ ) ;
241244
242245 self . post ( url)
243246 }
@@ -246,9 +249,10 @@ where
246249 fn post_image_generation ( & self , deployment_id : & str ) -> http_client:: Builder {
247250 let url = format ! (
248251 "{}/openai/deployments/{}/images/generations?api-version={}" ,
249- self . azure_endpoint, deployment_id, self . api_version
250- )
251- . replace ( "//" , "/" ) ;
252+ self . azure_endpoint,
253+ deployment_id. trim_start_matches( '/' ) ,
254+ self . api_version
255+ ) ;
252256
253257 self . post ( url)
254258 }
0 commit comments