feat: +unit test

This commit is contained in:
莘权 马 2023-12-30 14:42:58 +08:00
parent c73911af82
commit 143d51b3b5

View file

@ -17,14 +17,15 @@ from metagpt.tools.prompt_writer import (
)
@pytest.mark.asyncio
@pytest.mark.usefixtures("llm_api")
def test_gpt_prompt_generator(llm_api):
async def test_gpt_prompt_generator(llm_api):
generator = GPTPromptGenerator()
example = (
"商品名称:WonderLab 新肌果味代餐奶昔 小胖瓶 胶原蛋白升级版 饱腹代餐粉6瓶 75g/瓶(6瓶/盒) 店铺名称:金力宁食品专营店 " "品牌:WonderLab 保质期:1年 产地:中国 净含量:450g"
)
results = llm_api.ask_batch(generator.gen(example))
results = await llm_api.aask_batch(generator.gen(example))
logger.info(results)
assert len(results) > 0
@ -58,3 +59,7 @@ def test_beagec_template():
assert any(
"Edit and revise this document to improve its grammar, vocabulary, spelling, and style." in r for r in results
)
if __name__ == "__main__":
pytest.main([__file__, "-s"])