chore: add CLI CI test (#1858)

Co-authored-by: Matt Zhou <mattzhou@Matts-MacBook-Pro.local>
This commit is contained in:
Matthew Zhou
2024-10-09 14:34:36 -07:00
committed by GitHub
parent b568830978
commit 5769e0c815
8 changed files with 135 additions and 43 deletions

View File

@@ -9,6 +9,10 @@ from rich.live import Live
from rich.markup import escape
from letta.interface import CLIInterface
from letta.local_llm.constants import (
ASSISTANT_MESSAGE_CLI_SYMBOL,
INNER_THOUGHTS_CLI_SYMBOL,
)
from letta.schemas.message import Message
from letta.schemas.openai.chat_completion_response import (
ChatCompletionChunkResponse,
@@ -296,7 +300,7 @@ class StreamingRefreshCLIInterface(AgentRefreshStreamingInterface):
def process_refresh(self, response: ChatCompletionResponse):
"""Process the response to rewrite the current output buffer."""
if not response.choices:
self.update_output("💭 [italic]...[/italic]")
self.update_output(f"{INNER_THOUGHTS_CLI_SYMBOL} [italic]...[/italic]")
return # Early exit if there are no choices
choice = response.choices[0]
@@ -304,7 +308,7 @@ class StreamingRefreshCLIInterface(AgentRefreshStreamingInterface):
tool_calls = choice.message.tool_calls if choice.message.tool_calls else []
if self.fancy:
message_string = f"💭 [italic]{inner_thoughts}[/italic]" if inner_thoughts else ""
message_string = f"{INNER_THOUGHTS_CLI_SYMBOL} [italic]{inner_thoughts}[/italic]" if inner_thoughts else ""
else:
message_string = "[inner thoughts] " + inner_thoughts if inner_thoughts else ""
@@ -326,7 +330,7 @@ class StreamingRefreshCLIInterface(AgentRefreshStreamingInterface):
message = function_args[len(prefix) :]
else:
message = function_args
message_string += f"🤖 [bold yellow]{message}[/bold yellow]"
message_string += f"{ASSISTANT_MESSAGE_CLI_SYMBOL} [bold yellow]{message}[/bold yellow]"
else:
message_string += f"{function_name}({function_args})"
@@ -336,7 +340,7 @@ class StreamingRefreshCLIInterface(AgentRefreshStreamingInterface):
if self.streaming:
print()
self.live.start() # Start the Live display context and keep it running
self.update_output("💭 [italic]...[/italic]")
self.update_output(f"{INNER_THOUGHTS_CLI_SYMBOL} [italic]...[/italic]")
def stream_end(self):
if self.streaming: