Skip to content

utils

Classes

CodeForm

Bases: BaseModel

Form for code related operations.

Attributes

code
code: str

The code content to be formatted or executed.

MarkdownForm

Bases: BaseModel

Form for markdown to HTML conversion.

Attributes

md
md: str

The markdown content to convert to HTML.

ChatForm

Bases: BaseModel

Form structure for chat data, mirroring the backend definition.

Note: The actual PDF endpoint uses ChatTitleMessagesForm from models.chats, but this class exists in the backend utils.py router file.

Attributes

title
title: str

The title of the chat.

messages
messages: list[dict]

The list of messages in the chat.

Dict Fields
  • role (str, required): The role of the message sender. Valid values are "user", "assistant", or "system".
  • content (str or list[dict], required): The content of the message. Can be a string or a list of content blocks with "type" and "text" fields.
  • timestamp (float, optional): UNIX timestamp when the message was created.
  • model (str, optional): Model identifier for assistant messages, only applicable when role is "assistant".