ShareGPTMessage

class ShareGPTMessage(BaseModel):

A single message in ShareGPT format with enhanced validation

ShareGPTConversation

class ShareGPTConversation(RootModel):

A full conversation in ShareGPT format with validation

validate_conversation_flow

def validate_conversation_flow(self):

Validate the conversation follows logical message order

model_dump

def model_dump(self, **kwargs):

iter

def __iter__(self):

ToolCall

class ToolCall(BaseModel):

Represents a single tool/function call with validation

validate_arguments

def validate_arguments(cls, v: Dict[str, Any]):

Validate argument structure and content

ToolResponse

class ToolResponse(BaseModel):

Represents a tool/function response with validation. This is a base class and default implementation for tool responses, for the purpose of converting between different formats.

validate_content

def validate_content(cls, v: Dict[str, Any]):

Validate response content structure