Skip to content

Commit

Permalink
Implemented tests to check kwarg priority when calling
Browse files Browse the repository at this point in the history
  • Loading branch information
maykcaldas committed Dec 9, 2024
1 parent 5d3a3c9 commit 3f650fc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/test_llms.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ async def test_text_image_message(self, model_name: str) -> None:
), "Expected content in message, but got None"
assert "red" in result.messages[-1].content.lower()

# Test n = 1
@pytest.mark.parametrize(
"model_name", [CILLMModelNames.ANTHROPIC.value, "gpt-3.5-turbo"]
)
Expand All @@ -339,6 +338,13 @@ async def test_single_completion(self, model_name: str) -> None:
assert len(result.messages) == 1
assert result.messages[0].content

model = self.MODEL_CLS(name=model_name, config={"n": 2})
result = await model.call(messages, n=1)
assert isinstance(result, LLMResult)
assert result.messages
assert len(result.messages) == 1
assert result.messages[0].content

@pytest.mark.asyncio
@pytest.mark.vcr
@pytest.mark.parametrize(
Expand All @@ -365,6 +371,10 @@ async def test_multiple_completion(self, model_name: str, request) -> None:
results = await model.call(messages, n=self.NUM_COMPLETIONS)
assert len(results) == self.NUM_COMPLETIONS

model = self.MODEL_CLS(name=model_name, config={"n": 1})
results = await model.call(messages, n=self.NUM_COMPLETIONS)
assert len(results) == self.NUM_COMPLETIONS


def test_json_schema_validation() -> None:
# Invalid JSON
Expand Down

0 comments on commit 3f650fc

Please sign in to comment.