fix another type ignore

This commit is contained in:
Abi Raja 2024-06-05 15:18:54 -04:00
parent 8de0e95c54
commit 7cd9b294c3

View File

@ -24,15 +24,14 @@ async def generate_image(
prompt: str, api_key: str, base_url: str | None prompt: str, api_key: str, base_url: str | None
) -> Union[str, None]: ) -> Union[str, None]:
client = AsyncOpenAI(api_key=api_key, base_url=base_url) client = AsyncOpenAI(api_key=api_key, base_url=base_url)
image_params: Dict[str, Union[str, int]] = { res = await client.images.generate(
"model": "dall-e-3", model="dall-e-3",
"quality": "standard", quality="standard",
"style": "natural", style="natural",
"n": 1, n=1,
"size": "1024x1024", size="1024x1024",
"prompt": prompt, prompt=prompt,
} )
res = await client.images.generate(**image_params) # type: ignore
await client.close() await client.close()
return res.data[0].url return res.data[0].url