From e67d2a16387b5903ae27d5befa0caebc8e3aeaae Mon Sep 17 00:00:00 2001 From: ykdy3951 Date: Sun, 11 Feb 2024 20:19:15 +0900 Subject: [PATCH] Fix the intermittent occurrence of "AI:" bug --- cllm/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cllm/main.py b/cllm/main.py index 0b92f1e..de35d6b 100644 --- a/cllm/main.py +++ b/cllm/main.py @@ -63,6 +63,7 @@ def search(query : str): ("system", "I want you to act as generating a command for request tasks on {os_name}. \ Also please don't explain the commands, just generate the command."), FewShotChatMessagePromptTemplate(example_prompt=example_prompt, examples=examples).format(), + ("system", "Only generate the command, don't explain it."), ("human", "task : {task}"), ] @@ -76,6 +77,9 @@ def search(query : str): model = ChatOpenAI() output = model.invoke(prompt) + + if output.content[:4] == "AI: ": + output.content = output.content[4:] typer.echo(output.content)