add openai dall-e support

This commit is contained in:
better629 2024-01-30 14:31:00 +08:00
parent 310687258e
commit e7cd90f7f8
4 changed files with 68 additions and 3 deletions

View file

@ -1,4 +1,5 @@
import pytest
from PIL import Image
from metagpt.const import TEST_DATA_PATH
from metagpt.llm import LLM
@ -62,6 +63,18 @@ async def test_speech_to_text():
assert "你好" == resp.text
@pytest.mark.asyncio
async def test_gen_image():
llm = LLM()
model = "dall-e-3"
prompt = 'a logo with word "MetaGPT"'
images: list[Image] = await llm.gen_image(model=model, prompt=prompt)
assert images[0].size == (1024, 1024)
images: list[Image] = await llm.gen_image(model=model, prompt=prompt, resp_format="b64_json")
assert images[0].size == (1024, 1024)
class TestOpenAI:
def test_make_client_kwargs_without_proxy(self):
instance = OpenAILLM(mock_llm_config)