Messages
Messages are the individual interactions within a thread, representing the conversation between the user and the assistant.
The messages API in Superinterface tries to mirror OpenAI’s messages API as closely as possible and not introduce new concepts.
Endpoints
Manage thread messages with these REST endpoints.
Message
type
Message mirrors OpenAI’s message type.
MessageRole
Possible values for MessageRole
are:
ContentPart
ContentPart
is a type that mirrors OpenAI’s content parts.
It can be multiple types, like image_file
, image_url
, text
.
image_file
References an image File in the content of a message.
Example image_file
content part
const imageFileContentPart = {
type: 'image_file',
image_file: {
file_id: 'file-12345',
}
}
image_url
References an image URL in the content of a message.
Example image_url
content part
const imageUrlContentPart = {
type: 'image_url',
image_url: {
url: 'https://example.com/image.png',
}
}
text
Text content part represents a simple text.
Example text
content part
const textContentPart = {
type: 'text',
text: 'This is a text message.',
}
Attachment
Attachments mirror OpenAI’s attachments.
Example Attachment
type
const attachment = {
file_id: 'file-12345',
tools: [
{
type: 'file_search',
},
],
}
Example message
const message = {
id: '60cfe680-fee5-49b9-b386-6a7097eb8497',
role: 'ASSISTANT',
content: 'Hello! How can I assist you today?',
attachments: [
{
file_id: 'file-12345',
tools: [
{
type: 'file_search',
},
],
},
],
createdAt: '2024-01-15T10:30:00Z',
updatedAt: '2024-01-15T10:30:00Z',
}