update messages and threads
This commit is contained in:
parent
d81fa7f04e
commit
00b583659a
@ -57,12 +57,12 @@ See [Jan Messages API](https://jan.ai/api-reference#tag/Messages)
|
||||
|
||||
### Get list message
|
||||
|
||||
> OpenAI Equivalent: https://platform.openai.com/docs/api-reference/messages/getMessage
|
||||
> OpenAI Equivalent: https://platform.openai.com/docs/api-reference/messages/listMessages
|
||||
|
||||
- Example request
|
||||
|
||||
```shell
|
||||
curl {JAN_URL}/v1/threads/{thread_id}/messages/{message_id} \
|
||||
curl {JAN_URL}/v1/threads/{thread_id}/messages \
|
||||
-H "Content-Type: application/json"
|
||||
```
|
||||
|
||||
@ -70,24 +70,54 @@ See [Jan Messages API](https://jan.ai/api-reference#tag/Messages)
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "msg_abc123",
|
||||
"object": "thread.message",
|
||||
"created_at": 1699017614,
|
||||
"thread_id": "thread_abc123",
|
||||
"role": "user",
|
||||
"content": [
|
||||
"object": "list",
|
||||
"data": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"value": "How does AI work? Explain it in simple terms.",
|
||||
"annotations": []
|
||||
}
|
||||
"id": "msg_abc123",
|
||||
"object": "thread.message",
|
||||
"created_at": 1699016383,
|
||||
"thread_id": "thread_abc123",
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"value": "How does AI work? Explain it in simple terms.",
|
||||
"annotations": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"file_ids": [],
|
||||
"assistant_id": null,
|
||||
"run_id": null,
|
||||
"metadata": {}
|
||||
},
|
||||
{
|
||||
"id": "msg_abc456",
|
||||
"object": "thread.message",
|
||||
"created_at": 1699016383,
|
||||
"thread_id": "thread_abc123",
|
||||
"role": "user",
|
||||
"content": [
|
||||
{
|
||||
"type": "text",
|
||||
"text": {
|
||||
"value": "Hello, what is AI?",
|
||||
"annotations": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"file_ids": [
|
||||
"file-abc123"
|
||||
],
|
||||
"assistant_id": null,
|
||||
"run_id": null,
|
||||
"metadata": {}
|
||||
}
|
||||
],
|
||||
"file_ids": [],
|
||||
"assistant_id": null,
|
||||
"run_id": null,
|
||||
"metadata": {}
|
||||
"first_id": "msg_abc123",
|
||||
"last_id": "msg_abc456",
|
||||
"has_more": false
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ x-tagGroups:
|
||||
- Messages
|
||||
- Threads
|
||||
paths:
|
||||
### MODELS
|
||||
/models:
|
||||
get:
|
||||
operationId: listModels
|
||||
@ -46,7 +47,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/models/models.yaml#/components/schemas/ListModelsResponse"
|
||||
$ref: "specs/models.yaml#/components/schemas/ListModelsResponse"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
@ -63,7 +64,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/models/models.yaml#/components/schemas/DownloadModelResponse"
|
||||
$ref: "specs/models.yaml#/components/schemas/DownloadModelResponse"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
@ -90,7 +91,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/models/models.yaml#/components/schemas/GetModelResponse"
|
||||
$ref: "specs/models.yaml#/components/schemas/GetModelResponse"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
@ -115,7 +116,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/models/models.yaml#/components/schemas/DeleteModelResponse"
|
||||
$ref: "specs/models.yaml#/components/schemas/DeleteModelResponse"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
@ -142,7 +143,7 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/models/models.yaml#/components/schemas/StartModelResponse"
|
||||
$ref: "specs/models.yaml#/components/schemas/StartModelResponse"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
@ -169,12 +170,359 @@ paths:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/models/models.yaml#/components/schemas/StopModelResponse"
|
||||
$ref: "specs/models.yaml#/components/schemas/StopModelResponse"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
curl -X PUT https://localhost:1337/v1/models/zephyr-7b/stop
|
||||
|
||||
### THREADS
|
||||
/threads:
|
||||
post:
|
||||
operationId: createThread
|
||||
tags:
|
||||
- Threads
|
||||
summary: Create a new thread
|
||||
description: Creates a new thread with an initial set of messages.
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
messages:
|
||||
type: array
|
||||
description: "Initial set of messages for the thread."
|
||||
items:
|
||||
$ref: 'specs/threads.yaml#/components/schemas/ThreadMessageObject'
|
||||
required:
|
||||
- messages
|
||||
responses:
|
||||
"200":
|
||||
description: Thread created successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'specs/threads.yaml#/components/schemas/CreateThreadResponse'
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
curl -X POST {JAN_URL}/v1/threads \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"messages": [{"role": "user", "content": "Hello, what is AI?", "file_ids": ["file-abc123"]}, {"role": "user", "content": "How does AI work? Explain it in simple terms."}]}'
|
||||
get:
|
||||
operationId: listThreads
|
||||
tags:
|
||||
- Threads
|
||||
summary: List all threads
|
||||
description: Retrieves a list of all threads available in the system.
|
||||
responses:
|
||||
"200":
|
||||
description: List of threads retrieved successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: 'specs/threads.yaml#/components/schemas/ThreadObject'
|
||||
example:
|
||||
- id: "thread_abc123"
|
||||
object: "thread"
|
||||
created_at: 1699014083
|
||||
assistants: ["assistant-001"]
|
||||
metadata: {}
|
||||
messages: []
|
||||
- id: "thread_abc456"
|
||||
object: "thread"
|
||||
created_at: 1699014083
|
||||
assistants: ["assistant-002", "assistant-003"]
|
||||
metadata: {}
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
curl {JAN_URL}/v1/threads \
|
||||
-H "Content-Type: application/json"
|
||||
|
||||
/threads/{thread_id}:
|
||||
get:
|
||||
operationId: getThread
|
||||
tags:
|
||||
- Threads
|
||||
summary: Get details of a specific thread
|
||||
description: Retrieves detailed information about a specific thread using its thread_id.
|
||||
parameters:
|
||||
- in: path
|
||||
name: thread_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: thread_abc123
|
||||
description: The ID of the thread to retrieve.
|
||||
responses:
|
||||
"200":
|
||||
description: Thread details retrieved successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/threads.yaml#/components/schemas/GetThreadResponse"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
curl {JAN_URL}/v1/threads/{thread_id}
|
||||
post:
|
||||
operationId: modifyThread
|
||||
tags:
|
||||
- Threads
|
||||
summary: Modify an existing thread
|
||||
description: Updates a thread with new or modified messages.
|
||||
parameters:
|
||||
- in: path
|
||||
name: thread_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: thread_abc123
|
||||
description: The ID of the thread to be modified.
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
messages:
|
||||
type: array
|
||||
description: "Set of messages to update in the thread."
|
||||
items:
|
||||
$ref: 'specs/threads.yaml#/components/schemas/ThreadMessageObject'
|
||||
required:
|
||||
- messages
|
||||
responses:
|
||||
"200":
|
||||
description: Thread modified successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'specs/threads.yaml#/components/schemas/ModifyThreadResponse'
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
curl -X POST {JAN_URL}/v1/threads/{thread_id} \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"messages": [{"role": "user", "content": "Hello, what is AI?", "file_ids": ["file-abc123"]}, {"role": "user", "content": "How does AI work? Explain it in simple terms."}]}'
|
||||
delete:
|
||||
operationId: deleteThread
|
||||
tags:
|
||||
- Threads
|
||||
summary: Delete a specific thread
|
||||
description: Deletes a thread identified by its thread_id.
|
||||
parameters:
|
||||
- in: path
|
||||
name: thread_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: thread_abc123
|
||||
description: The ID of the thread to be deleted.
|
||||
responses:
|
||||
"200":
|
||||
description: Thread deleted successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'specs/threads.yaml#/components/schemas/DeleteThreadResponse'
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
curl -X DELETE {JAN_URL}/v1/threads/{thread_id}
|
||||
### MESSAGES
|
||||
/threads/{thread_id}/messages:
|
||||
get:
|
||||
operationId: listMessages
|
||||
tags:
|
||||
- Messages
|
||||
summary: Get a list of messages from a thread
|
||||
description: Retrieves all messages from the specified thread.
|
||||
parameters:
|
||||
- in: path
|
||||
name: thread_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: thread_abc123
|
||||
description: The ID of the thread from which to retrieve messages.
|
||||
responses:
|
||||
"200":
|
||||
description: List of messages retrieved successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/messages.yaml#/components/schemas/ListMessagesResponse"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
curl {JAN_URL}/v1/threads/{thread_id}/messages \
|
||||
-H "Content-Type: application/json"
|
||||
post:
|
||||
operationId: createMessage
|
||||
tags:
|
||||
- Messages
|
||||
summary: Create a new message in a thread
|
||||
description: Sends a new message to the specified thread.
|
||||
parameters:
|
||||
- in: path
|
||||
name: thread_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: thread_abc123
|
||||
description: The ID of the thread to which the message will be posted.
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
role:
|
||||
type: string
|
||||
description: "Role of the sender, either 'user' or 'assistant'."
|
||||
example: "user"
|
||||
enum: ["user", "assistant"]
|
||||
content:
|
||||
type: string
|
||||
description: "Text content of the message."
|
||||
example: "How does AI work? Explain it in simple terms."
|
||||
required:
|
||||
- role
|
||||
- content
|
||||
responses:
|
||||
"200":
|
||||
description: Message created successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/messages.yaml#/components/schemas/CreateMessageResponse"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
curl -X POST {JAN_URL}/v1/threads/{thread_id}/messages \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"role": "user", "content": "How does AI work? Explain it in simple terms."}'
|
||||
|
||||
/threads/{thread_id}/messages/{message_id}:
|
||||
get:
|
||||
operationId: getMessage
|
||||
tags:
|
||||
- Messages
|
||||
summary: Retrieve Message
|
||||
description: Retrieve a specific message from a thread using its thread_id and message_id.
|
||||
parameters:
|
||||
- in: path
|
||||
name: thread_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: thread_abc123
|
||||
description: The ID of the thread containing the message.
|
||||
- in: path
|
||||
name: message_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: msg_abc123
|
||||
description: The ID of the message to retrieve.
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/messages.yaml#/components/schemas/GetMessageResponse"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
curl {JAN_URL}/v1/threads/{thread_id}/messages/{message_id} \
|
||||
-H "Content-Type: application/json"
|
||||
|
||||
/threads/{thread_id}/messages/{message_id}/files:
|
||||
get:
|
||||
operationId: listMessageFiles
|
||||
tags:
|
||||
- Messages
|
||||
summary: message files
|
||||
description: Retrieves a list of files associated with a specific message in a thread.
|
||||
parameters:
|
||||
- in: path
|
||||
name: thread_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: thread_abc123
|
||||
description: The ID of the thread containing the message.
|
||||
- in: path
|
||||
name: message_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: msg_abc123
|
||||
description: The ID of the message whose files are to be listed.
|
||||
responses:
|
||||
"200":
|
||||
description: List of files retrieved successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/messages.yaml#/components/schemas/ListMessageFilesResponse"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
curl {JAN_URL}/v1/threads/{thread_id}/messages/{message_id}/files \
|
||||
-H "Content-Type: application/json"
|
||||
|
||||
/threads/{thread_id}/messages/{message_id}/files/{file_id}:
|
||||
get:
|
||||
operationId: getMessageFile
|
||||
tags:
|
||||
- Messages
|
||||
summary: Get message file
|
||||
description: Retrieves a file associated with a specific message in a thread.
|
||||
parameters:
|
||||
- in: path
|
||||
name: thread_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: thread_abc123
|
||||
description: The ID of the thread containing the message.
|
||||
- in: path
|
||||
name: message_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: msg_abc123
|
||||
description: The ID of the message associated with the file.
|
||||
- in: path
|
||||
name: file_id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
example: file-abc123
|
||||
description: The ID of the file to retrieve.
|
||||
responses:
|
||||
"200":
|
||||
description: File retrieved successfully
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "specs/messages.yaml#/components/schemas/MessageFileObject"
|
||||
x-codeSamples:
|
||||
- lang: "curl"
|
||||
source: |
|
||||
curl {JAN_URL}/v1/threads/{thread_id}/messages/{message_id}/files/{file_id} \
|
||||
-H "Content-Type: application/json"
|
||||
|
||||
x-webhooks:
|
||||
ModelObject:
|
||||
post:
|
||||
@ -187,4 +535,30 @@ x-webhooks:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'specs/models/models.yaml#/components/schemas/ModelObject'
|
||||
$ref: 'specs/models.yaml#/components/schemas/ModelObject'
|
||||
|
||||
MessageObject:
|
||||
post:
|
||||
summary: The message object
|
||||
description: Information about a message in the thread
|
||||
operationId: MessageObject
|
||||
tags:
|
||||
- Messages
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'specs/messages.yaml#/components/schemas/MessageObject'
|
||||
|
||||
ThreadObject:
|
||||
post:
|
||||
summary: The thread object
|
||||
description: Information about a thread
|
||||
operationId: ThreadObject
|
||||
tags:
|
||||
- Threads
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: 'specs/threads.yaml#/components/schemas/ThreadObject'
|
||||
|
||||
326
docs/openapi/specs/messages.yaml
Normal file
326
docs/openapi/specs/messages.yaml
Normal file
@ -0,0 +1,326 @@
|
||||
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
|
||||
@ -46,7 +46,7 @@ components:
|
||||
description: "Description of the model."
|
||||
state:
|
||||
type: string
|
||||
enum: [null, "downloading", "available"]
|
||||
enum: [null, "downloading", "ready", "starting", "stopping"]
|
||||
description: "Current state of the model."
|
||||
format:
|
||||
type: string
|
||||
169
docs/openapi/specs/threads.yaml
Normal file
169
docs/openapi/specs/threads.yaml
Normal file
@ -0,0 +1,169 @@
|
||||
components:
|
||||
schemas:
|
||||
ThreadObject:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: "Identifier of the thread, defaults to folder name."
|
||||
example: "thread_...."
|
||||
object:
|
||||
type: string
|
||||
description: "Type of the object, typically 'thread'."
|
||||
default: "thread"
|
||||
summary:
|
||||
type: string
|
||||
description: "A brief summary or description of the thread, defaults to an empty string."
|
||||
example: "funny physics joke"
|
||||
assistants:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
description: "List of assistants involved in the thread, defaults to ['jan']."
|
||||
example: ["jan"]
|
||||
created:
|
||||
type: integer
|
||||
format: int64
|
||||
description: "Unix timestamp representing the creation time of the thread, defaults to file creation time."
|
||||
metadata:
|
||||
type: object
|
||||
description: "Metadata associated with the thread, defaults to an empty object."
|
||||
messages:
|
||||
type: array
|
||||
description: "List of messages within the thread."
|
||||
items:
|
||||
type: string
|
||||
model_id:
|
||||
type: string
|
||||
description: "Model identifier associated with the thread, defaults to assistant's model."
|
||||
example: "..."
|
||||
settings:
|
||||
type: object
|
||||
description: "Settings for the thread, defaults to and overrides assistant's settings."
|
||||
parameters:
|
||||
type: object
|
||||
description: "Parameters for the thread, defaults to and overrides assistant's settings."
|
||||
required:
|
||||
- id
|
||||
- object
|
||||
GetThreadResponse:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: "The identifier of the thread."
|
||||
example: "thread_abc123"
|
||||
object:
|
||||
type: string
|
||||
description: "Type of the object, indicating it's a thread."
|
||||
default: "thread"
|
||||
created_at:
|
||||
type: integer
|
||||
format: int64
|
||||
description: "Unix timestamp representing the creation time of the thread."
|
||||
assistants:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
description: "List of assistants involved in the thread."
|
||||
metadata:
|
||||
type: object
|
||||
description: "Metadata associated with the thread."
|
||||
messages:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
description: "List of messages within the thread."
|
||||
required:
|
||||
- id
|
||||
- object
|
||||
- created_at
|
||||
- assistants
|
||||
- metadata
|
||||
- messages
|
||||
CreateThreadResponse:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: "The identifier of the newly created thread."
|
||||
example: "thread_abc123"
|
||||
object:
|
||||
type: string
|
||||
description: "Type of the object, indicating it's a thread."
|
||||
default: "thread"
|
||||
created_at:
|
||||
type: integer
|
||||
format: int64
|
||||
description: "Unix timestamp representing the creation time of the thread."
|
||||
metadata:
|
||||
type: object
|
||||
description: "Metadata associated with the newly created thread."
|
||||
required:
|
||||
- id
|
||||
- object
|
||||
- created_at
|
||||
- metadata
|
||||
|
||||
ThreadMessageObject:
|
||||
type: object
|
||||
properties:
|
||||
role:
|
||||
type: string
|
||||
description: "Role of the sender, either 'user' or 'assistant'."
|
||||
enum: ["user", "assistant"]
|
||||
content:
|
||||
type: string
|
||||
description: "Text content of the message."
|
||||
file_ids:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
description: "Array of file IDs associated with the message, if any."
|
||||
required:
|
||||
- role
|
||||
- content
|
||||
|
||||
ModifyThreadResponse:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: "The identifier of the modified thread."
|
||||
example: "thread_abc123"
|
||||
object:
|
||||
type: string
|
||||
description: "Type of the object, indicating it's a thread."
|
||||
default: "thread"
|
||||
created_at:
|
||||
type: integer
|
||||
format: int64
|
||||
description: "Unix timestamp representing the creation time of the thread."
|
||||
metadata:
|
||||
type: object
|
||||
description: "Metadata associated with the modified thread."
|
||||
required:
|
||||
- id
|
||||
- object
|
||||
- created_at
|
||||
- metadata
|
||||
|
||||
DeleteThreadResponse:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: "The identifier of the deleted thread."
|
||||
example: "thread_abc123"
|
||||
object:
|
||||
type: string
|
||||
description: "Type of the object, indicating the thread has been deleted."
|
||||
default: "thread.deleted"
|
||||
deleted:
|
||||
type: boolean
|
||||
description: "Indicates whether the thread was successfully deleted."
|
||||
example: true
|
||||
required:
|
||||
- id
|
||||
- object
|
||||
- deleted
|
||||
Loading…
x
Reference in New Issue
Block a user