@@ -418,19 +418,19 @@ async def _poll(
418
418
async def _request (self , cast_to : Type [ResponseT ], options : FinalRequestOptions , ** kwargs : Any ) -> Any :
419
419
if options .url == "/images/generations" :
420
420
options .url = "openai/images/generations:submit"
421
- response = await super ().request (httpx .Response , ** kwargs )
422
- operation_id = cast (Mapping [str , Any ], getattr (response , 'model_extra' )) or {}
421
+ response = await super ()._request (cast_to = cast_to , options = options , ** kwargs )
422
+ model_extra = cast (Mapping [str , Any ], getattr (response , 'model_extra' )) or {}
423
+ operation_id = cast (str , model_extra ['id' ])
423
424
return await self ._poll (
424
425
"get" , f"openai/operations/images/{ operation_id } " ,
425
426
until = lambda response : response .json ()["status" ] in ["succeeded" ],
426
427
failed = lambda response : response .json ()["status" ] in ["failed" ],
427
428
)
428
429
if isinstance (options .json_data , Mapping ):
429
- model = cast (str , options .json_data ["model" ])
430
+ model = cast (str , options .json_data ["model" ])
430
431
if not options .url .startswith (f'openai/deployments/{ model } ' ):
431
432
if options .extra_json and options .extra_json .get ("dataSources" ):
432
433
options .url = f'openai/deployments/{ model } /extensions' + options .url
433
- else :
434
+ else :
434
435
options .url = f'openai/deployments/{ model } ' + options .url
435
- return await super ().request (cast_to = cast_to , options = options , ** kwargs )
436
-
436
+ return await super ()._request (cast_to = cast_to , options = options , ** kwargs )
0 commit comments