fixbug: OpenAIGPTAPI:_achat_completion_stream

This commit is contained in:
莘权 马 2023-12-22 17:43:59 +08:00
parent b445c3f4b6
commit 5d97a20e08
4 changed files with 358 additions and 357 deletions

View file

@ -19,7 +19,8 @@ def llm():
@pytest.mark.asyncio
async def test_llm_aask(llm):
assert len(await llm.aask("hello world")) > 0
rsp = await llm.aask("hello world", stream=False)
assert len(rsp) > 0
@pytest.mark.asyncio
@ -30,7 +31,8 @@ async def test_llm_aask_batch(llm):
@pytest.mark.asyncio
async def test_llm_acompletion(llm):
hello_msg = [{"role": "user", "content": "hello"}]
assert len(await llm.acompletion(hello_msg)) > 0
rsp = await llm.acompletion(hello_msg)
assert len(rsp.choices[0].message.content) > 0
assert len(await llm.acompletion_batch([hello_msg])) > 0
assert len(await llm.acompletion_batch_text([hello_msg])) > 0