jan/docs/openapi/specs/messages.yaml
2023-11-22 12:46:09 +07:00

326 lines
10 KiB
YAML

components:
schemas:
MessageObject:
type: object
properties:
id:
type: string
description: "Sequential or UUID identifier of the message."
example: "0"
object:
type: string
description: "Type of the object, typically 'thread.message'."
default: "thread.message"
created_at:
type: integer
format: int64
description: "Unix timestamp representing the creation time of the message."
thread_id:
type: string
description: "Identifier of the thread to which this message belongs. Defaults to parent thread."
example: "thread_asdf"
assistant_id:
type: string
description: "Identifier of the assistant involved in the message. Defaults to parent thread."
example: "jan"
role:
type: string
enum: ["user", "assistant"]
description: "Role of the sender, either 'user' or 'assistant'."
content:
type: array
items:
type: object
properties:
type:
type: string
description: "Type of content, e.g., 'text'."
text:
type: object
properties:
value:
type: string
description: "Text content of the message."
annotations:
type: array
items:
type: string
description: "Annotations for the text content, if any."
metadata:
type: object
description: "Metadata associated with the message, defaults to an empty object."
chat_completion_id:
type: string
description: "Identifier of the chat completion, if applicable."
required:
- id
- object
- created_at
- thread_id
- assistant_id
- role
- content
GetMessageResponse:
type: object
properties:
id:
type: string
description: "The identifier of the message."
example: "msg_abc123"
object:
type: string
description: "Type of the object, indicating it's a thread message."
default: "thread.message"
created_at:
type: integer
format: int64
description: "Unix timestamp representing the creation time of the message."
thread_id:
type: string
description: "Identifier of the thread to which this message belongs."
example: "thread_abc123"
role:
type: string
description: "Role of the sender, either 'user' or 'assistant'."
example: "user"
content:
type: array
items:
type: object
properties:
type:
type: string
description: "Type of content, e.g., 'text'."
text:
type: object
properties:
value:
type: string
description: "Text content of the message."
example: "How does AI work? Explain it in simple terms."
annotations:
type: array
items:
type: string
description: "Annotations for the text content, if any."
file_ids:
type: array
items:
type: string
description: "Array of file IDs associated with the message, if any."
assistant_id:
type: string
description: "Identifier of the assistant involved in the message, if applicable."
run_id:
type: string
description: "Run ID associated with the message, if applicable."
metadata:
type: object
description: "Metadata associated with the message."
required:
- id
- object
- created_at
- thread_id
- role
- content
CreateMessageResponse:
type: object
properties:
id:
type: string
description: "The identifier of the created message."
example: "msg_abc123"
object:
type: string
description: "Type of the object, indicating it's a thread message."
default: "thread.message"
created_at:
type: integer
format: int64
description: "Unix timestamp representing the creation time of the message."
thread_id:
type: string
description: "Identifier of the thread to which this message belongs."
example: "thread_abc123"
role:
type: string
description: "Role of the sender, either 'user' or 'assistant'."
example: "user"
content:
type: array
items:
type: object
properties:
type:
type: string
description: "Type of content, e.g., 'text'."
text:
type: object
properties:
value:
type: string
description: "Text content of the message."
example: "How does AI work? Explain it in simple terms."
annotations:
type: array
items:
type: string
description: "Annotations for the text content, if any."
file_ids:
type: array
items:
type: string
description: "Array of file IDs associated with the message, if any."
assistant_id:
type: string
description: "Identifier of the assistant involved in the message, if applicable."
run_id:
type: string
description: "Run ID associated with the message, if applicable."
metadata:
type: object
description: "Metadata associated with the message."
required:
- id
- object
- created_at
- thread_id
- role
- content
ListMessagesResponse:
type: object
properties:
object:
type: string
description: "Type of the object, indicating it's a list."
default: "list"
data:
type: array
items:
$ref: '#/components/schemas/ListMessageObject'
first_id:
type: string
description: "Identifier of the first message in the list."
example: "msg_abc123"
last_id:
type: string
description: "Identifier of the last message in the list."
example: "msg_abc456"
has_more:
type: boolean
description: "Indicates whether there are more messages to retrieve."
example: false
required:
- object
- data
- first_id
- last_id
- has_more
ListMessageObject:
type: object
properties:
id:
type: string
description: "The identifier of the message."
example: "msg_abc123"
object:
type: string
description: "Type of the object, indicating it's a thread message."
default: "thread.message"
created_at:
type: integer
format: int64
description: "Unix timestamp representing the creation time of the message."
thread_id:
type: string
description: "Identifier of the thread to which this message belongs."
example: "thread_abc123"
role:
type: string
description: "Role of the sender, either 'user' or 'assistant'."
example: "user"
content:
type: array
items:
type: object
properties:
type:
type: string
description: "Type of content, e.g., 'text'."
text:
type: object
properties:
value:
type: string
description: "Text content of the message."
example: "How does AI work? Explain it in simple terms."
annotations:
type: array
items:
type: string
description: "Annotations for the text content, if any."
file_ids:
type: array
items:
type: string
description: "Array of file IDs associated with the message, if any."
assistant_id:
type: string
description: "Identifier of the assistant involved in the message, if applicable."
run_id:
type: string
description: "Run ID associated with the message, if applicable."
metadata:
type: object
description: "Metadata associated with the message."
required:
- id
- object
- created_at
- thread_id
- role
- content
MessageFileObject:
type: object
properties:
id:
type: string
description: "The identifier of the file."
example: "file-abc123"
object:
type: string
description: "Type of the object, indicating it's a thread message file."
default: "thread.message.file"
created_at:
type: integer
format: int64
description: "Unix timestamp representing the creation time of the file."
message_id:
type: string
description: "Identifier of the message to which this file is associated."
example: "msg_abc123"
required:
- id
- object
- created_at
- message_id
ListMessageFilesResponse:
type: object
properties:
object:
type: string
description: "Type of the object, indicating it's a list."
default: "list"
data:
type: array
items:
$ref: '#/components/schemas/MessageFileObject'
required:
- object
- data