Skip to content

Commit

Permalink
feat: added tests for the lamacpp client
Browse files Browse the repository at this point in the history
  • Loading branch information
umbertogriffo committed May 4, 2024
1 parent 22d5082 commit 6f734ad
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/test_lamacpp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ def test_start_answer_iterator_streamer(lamacpp_client):
assert "rome" in generated_answer.lower()


def test_parse_token(lamacpp_client):
prompt = "What is the capital city of Italy?"
stream = lamacpp_client.start_answer_iterator_streamer(prompt, max_new_tokens=10)
generated_answer = ""
for output in stream:
generated_answer += lamacpp_client.parse_token(output)
assert "rome" in generated_answer.lower()


@pytest.mark.asyncio
async def test_async_generate_answer(lamacpp_client):
prompt = "What is the capital city of Italy?"
Expand All @@ -76,12 +85,3 @@ async def test_async_start_answer_iterator_streamer(lamacpp_client):
for output in stream[0]:
generated_answer += output["choices"][0]["text"]
assert "rome" in generated_answer.lower()


def test_parse_token(lamacpp_client):
prompt = "What is the capital city of Italy?"
stream = lamacpp_client.start_answer_iterator_streamer(prompt, max_new_tokens=10)
generated_answer = ""
for output in stream:
generated_answer += lamacpp_client.parse_token(output)
assert "rome" in generated_answer.lower()

0 comments on commit 6f734ad

Please sign in to comment.