Skip to content

Commit

Permalink
Upgraded for conversations, removed test for --no-stream and -o delay
Browse files Browse the repository at this point in the history
Refs #6
  • Loading branch information
simonw committed Jul 11, 2023
1 parent a043acf commit 855ee3c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
3 changes: 1 addition & 2 deletions llm_markov/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import time
from typing import Optional


DEFAULT_LENGTH = 100
DEFAULT_DELAY = 0.02

Expand Down Expand Up @@ -40,7 +39,7 @@ def validate_delay(cls, delay):
raise ValueError("delay must be between 0 and 10")
return delay

def execute(self, prompt, stream, response):
def execute(self, prompt, stream, response, conversation):
length = prompt.options.length or DEFAULT_LENGTH
delay = DEFAULT_DELAY
if prompt.options.delay is not None:
Expand Down
25 changes: 1 addition & 24 deletions tests/test_llm_markov.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,8 @@
import time


@pytest.mark.parametrize(
"no_stream,delay",
(
(True, None),
(False, 0),
(False, 0.01),
(False, 0.03),
),
)
@pytest.mark.parametrize("length", [10, 20])
def test_markov_prompt(length, no_stream, delay):
def test_markov_prompt(length):
runner = CliRunner()
prompt = "the quick brown fox jumped over the lazy dog"
args = [
Expand All @@ -25,21 +16,7 @@ def test_markov_prompt(length, no_stream, delay):
"length",
str(length),
]
if no_stream:
args.append("--no-stream")
if delay is not None:
args.extend(
[
"-o",
"delay",
str(delay),
]
)
start = time.monotonic()
result = runner.invoke(cli, args)
end = time.monotonic()
if no_stream:
assert end - start < 0.1
assert result.exit_code == 0, result.output
words = result.output.strip().split()
# ['lazy', 'dog', 'brown', 'fox', 'jumped', 'over', 'the', 'quick', 'brown']
Expand Down

0 comments on commit 855ee3c

Please sign in to comment.