Skip to content

Commit

Permalink
Add tests for the LanguageModel Op
Browse files Browse the repository at this point in the history
  • Loading branch information
rlouf committed Mar 27, 2023
1 parent 9dc7e12 commit 3c80f2c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/text/test_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from outlines import string, compile
from outlines.text.models.model import LanguageModel

def test_initialize_model():

llm = LanguageModel(name="llm")

prompt = string()
out = llm(prompt)
assert isinstance(out.owner.op, LanguageModel)
assert out.owner.inputs[0] == prompt
assert out.name == "llm"


class MockLM(LanguageModel):
def sample(self, _):
return "test"


def test_sample():
llm = MockLM()
assert llm.perform("")[0] == "test"

0 comments on commit 3c80f2c

Please sign in to comment.