feat: parse assistant message to AssistantMessage by default (#528)
This commit is contained in:
@@ -11,6 +11,10 @@ class LettaRequest(BaseModel):
|
||||
|
||||
# Flags to support the use of AssistantMessage message types
|
||||
|
||||
use_assistant_message: bool = Field(
|
||||
default=True,
|
||||
description="Whether the server should parse specific tool call arguments (default `send_message`) as `AssistantMessage` objects.",
|
||||
)
|
||||
assistant_message_tool_name: str = Field(
|
||||
default=DEFAULT_MESSAGE_TOOL,
|
||||
description="The name of the designated message tool.",
|
||||
|
||||
@@ -493,6 +493,7 @@ async def send_message(
|
||||
stream_steps=False,
|
||||
stream_tokens=False,
|
||||
# Support for AssistantMessage
|
||||
use_assistant_message=request.use_assistant_message,
|
||||
assistant_message_tool_name=request.assistant_message_tool_name,
|
||||
assistant_message_tool_kwarg=request.assistant_message_tool_kwarg,
|
||||
)
|
||||
@@ -638,6 +639,7 @@ async def send_message_to_agent(
|
||||
chat_completion_mode: bool = False,
|
||||
timestamp: Optional[datetime] = None,
|
||||
# Support for AssistantMessage
|
||||
use_assistant_message: bool = True,
|
||||
assistant_message_tool_name: str = DEFAULT_MESSAGE_TOOL,
|
||||
assistant_message_tool_kwarg: str = DEFAULT_MESSAGE_TOOL_KWARG,
|
||||
) -> Union[StreamingResponse, LettaResponse]:
|
||||
@@ -668,7 +670,7 @@ async def send_message_to_agent(
|
||||
stream_tokens = False
|
||||
|
||||
# Create a new interface per request
|
||||
letta_agent.interface = StreamingServerInterface()
|
||||
letta_agent.interface = StreamingServerInterface(use_assistant_message)
|
||||
streaming_interface = letta_agent.interface
|
||||
if not isinstance(streaming_interface, StreamingServerInterface):
|
||||
raise ValueError(f"Agent has wrong type of interface: {type(streaming_interface)}")
|
||||
|
||||
Reference in New Issue
Block a user