Skip to content

Commit

Permalink
Add adapter_id and merged_adapters tests
Browse files Browse the repository at this point in the history
  • Loading branch information
claudioMontanari committed Apr 11, 2024
1 parent 6e90cde commit 7500b0a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions clients/python/tests/test_types.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from lorax.types import Parameters, Request
from lorax.types import Parameters, Request, MergedAdapters
from lorax.errors import ValidationError


Expand Down Expand Up @@ -68,6 +68,13 @@ def test_parameters_validation():
with pytest.raises(ValidationError):
Parameters(typical_p=1)

# Test adapter_id and merged_adapters
merged_adapters = MergedAdapters(ids=["test/adapter-id-1", "test/adapter-id-2"], weights=[0.5, 0.5], density=0.5)
Parameters(adapter_id="test/adapter-id")
Parameters(merged_adapters=merged_adapters)
with pytest.raises(ValidationError):
Parameters(adapter_id="test/adapter-id", merged_adapters=merged_adapters)


def test_request_validation():
Request(inputs="test")
Expand All @@ -79,6 +86,4 @@ def test_request_validation():
Request(inputs="test", parameters=Parameters(best_of=2, do_sample=True))

with pytest.raises(ValidationError):
Request(
inputs="test", parameters=Parameters(best_of=2, do_sample=True), stream=True
)
Request(inputs="test", parameters=Parameters(best_of=2, do_sample=True), stream=True)

0 comments on commit 7500b0a

Please sign in to comment.