feat: refactor the POST agent/messages API to take multiple messages (#1882)
This commit is contained in:
@@ -2,7 +2,7 @@ import copy
|
||||
import json
|
||||
import warnings
|
||||
from datetime import datetime, timezone
|
||||
from typing import List, Optional
|
||||
from typing import List, Literal, Optional
|
||||
|
||||
from pydantic import Field, field_validator
|
||||
|
||||
@@ -57,7 +57,11 @@ class BaseMessage(LettaBase):
|
||||
class MessageCreate(BaseMessage):
|
||||
"""Request to create a message"""
|
||||
|
||||
role: MessageRole = Field(..., description="The role of the participant.")
|
||||
# In the simplified format, only allow simple roles
|
||||
role: Literal[
|
||||
MessageRole.user,
|
||||
MessageRole.system,
|
||||
] = Field(..., description="The role of the participant.")
|
||||
text: str = Field(..., description="The text of the message.")
|
||||
name: Optional[str] = Field(None, description="The name of the participant.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user