From b66d0b4fffdbab6b67820fd7f1e1db8b779da8f5 Mon Sep 17 00:00:00 2001 From: cosmic-snow <134004613+cosmic-snow@users.noreply.github.com> Date: Fri, 16 Jun 2023 22:06:22 +0200 Subject: [PATCH] Fix CLI app.py (#910) - the bindings API changed in 057b9, but the CLI was not updated - change 'std_passthrough' param to the renamed 'streaming' - remove '_cli_override_response_callback' as it breaks and is no longer needed - bump version to 0.3.4 --- gpt4all-bindings/cli/app.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/gpt4all-bindings/cli/app.py b/gpt4all-bindings/cli/app.py index f44df3b0..2c8021f5 100644 --- a/gpt4all-bindings/cli/app.py +++ b/gpt4all-bindings/cli/app.py @@ -17,7 +17,7 @@ SPECIAL_COMMANDS = { "/help": lambda _: print("Special commands: /reset, /exit, /help and /clear"), } -VERSION = "0.1.0" +VERSION = "0.3.4" CLI_START_MESSAGE = f""" @@ -33,12 +33,6 @@ Type /help for special commands. """ -def _cli_override_response_callback(token_id, response): - resp = response.decode("utf-8") - print(resp, end="", flush=True) - return True - - # create typer app app = typer.Typer() @@ -68,9 +62,6 @@ def repl( else: print(f"\nUsing {gpt4all_instance.model.thread_count()} threads", end="") - # overwrite _response_callback on model - gpt4all_instance.model._response_callback = _cli_override_response_callback - print(CLI_START_MESSAGE) while True: @@ -103,7 +94,7 @@ def repl( context_erase=0.0, # required kwargs for cli ux (incremental response) verbose=False, - std_passthrough=True, + streaming=True, ) # record assistant's response to messages MESSAGES.append(full_response.get("choices")[0].get("message")) @@ -112,7 +103,7 @@ def repl( @app.command() def version(): - print("gpt4all-cli v0.1.0") + print("gpt4all-cli v0.3.4") if __name__ == "__main__":