Add printed out responses for easier debugging from tests
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
from typing import List, Union
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
@@ -23,6 +24,16 @@ class LettaResponse(BaseModel):
|
||||
messages: Union[List[Message], List[LettaMessage]] = Field(..., description="The messages returned by the agent.")
|
||||
usage: LettaUsageStatistics = Field(..., description="The usage statistics of the agent.")
|
||||
|
||||
def __str__(self):
|
||||
return json.dumps(
|
||||
{
|
||||
"messages": [message.model_dump() for message in self.messages],
|
||||
# Assume `Message` and `LettaMessage` have a `dict()` method
|
||||
"usage": self.usage.model_dump(), # Assume `LettaUsageStatistics` has a `dict()` method
|
||||
},
|
||||
indent=4,
|
||||
)
|
||||
|
||||
|
||||
# The streaming response is either [DONE], [DONE_STEP], [DONE], an error, or a LettaMessage
|
||||
LettaStreamingResponse = Union[LettaMessage, MessageStreamStatus]
|
||||
|
||||
Reference in New Issue
Block a user