docs: update threads

This commit is contained in:
hieu-jan 2023-11-23 10:12:38 +09:00
parent 00b583659a
commit 7a9cd83e80
2 changed files with 67 additions and 60 deletions

View File

@ -182,8 +182,8 @@ paths:
operationId: createThread
tags:
- Threads
summary: Create a new thread
description: Creates a new thread with an initial set of messages.
summary: Create thread
description: Create a thread
requestBody:
required: true
content:
@ -196,8 +196,6 @@ paths:
description: "Initial set of messages for the thread."
items:
$ref: 'specs/threads.yaml#/components/schemas/ThreadMessageObject'
required:
- messages
responses:
"200":
description: Thread created successfully
@ -206,16 +204,25 @@ paths:
schema:
$ref: 'specs/threads.yaml#/components/schemas/CreateThreadResponse'
x-codeSamples:
- lang: "curl"
- 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."}]}'
-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
summary: List threads
description: Retrieves a list of all threads available in the system.
responses:
"200":
@ -242,14 +249,14 @@ paths:
- lang: "curl"
source: |
curl {JAN_URL}/v1/threads \
-H "Content-Type: application/json"
-H "Content-Type: application/json" \
/threads/{thread_id}:
get:
operationId: getThread
tags:
- Threads
summary: Get details of a specific thread
summary: Get thread
description: Retrieves detailed information about a specific thread using its thread_id.
parameters:
- in: path
@ -274,8 +281,8 @@ paths:
operationId: modifyThread
tags:
- Threads
summary: Modify an existing thread
description: Updates a thread with new or modified messages.
summary: Modify thread
description: Modifies a thread
parameters:
- in: path
name: thread_id
@ -310,13 +317,22 @@ paths:
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."}]}'
-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.
summary: Delete thread
description: Delete a thread
parameters:
- in: path
name: thread_id
@ -336,6 +352,7 @@ paths:
- lang: "curl"
source: |
curl -X DELETE {JAN_URL}/v1/threads/{thread_id}
### MESSAGES
/threads/{thread_id}/messages:
get:
@ -553,7 +570,8 @@ x-webhooks:
ThreadObject:
post:
summary: The thread object
description: Information about a thread
description:
- Each thread folder contains a `thread.json` file, which is a representation of a thread.
operationId: ThreadObject
tags:
- Threads

View File

@ -5,12 +5,12 @@ components:
properties:
id:
type: string
description: "Identifier of the thread, defaults to folder name."
example: "thread_...."
description: "The identifier of the thread, defaults to foldername."
example: thread_....
object:
type: string
description: "Type of the object, typically 'thread'."
default: "thread"
description: "Type of the object, defaults to thread."
example: thread
summary:
type: string
description: "A brief summary or description of the thread, defaults to an empty string."
@ -19,91 +19,87 @@ components:
type: array
items:
type: string
description: "List of assistants involved in the thread, defaults to ['jan']."
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."
example: 1231231
metadata:
type: object
description: "Metadata associated with the thread, defaults to an empty object."
example: {}
messages:
type: array
description: "List of messages within the thread."
items:
type: string
example: []
model_id:
type: string
description: "Model identifier associated with the thread, defaults to assistant's model."
description: "Model identifier associated with the thread, defaults to assistant.model."
example: "..."
settings:
type: object
description: "Settings for the thread, defaults to and overrides assistant's settings."
description: "Settings for the thread, defaults to and overrides assistant.settings."
parameters:
type: object
description: "Parameters for the thread, defaults to and overrides assistant's settings."
required:
- id
- object
description: "Parameters for the thread, defaults to and overrides assistant.settings."
GetThreadResponse:
type: object
properties:
id:
type: string
description: "The identifier of the thread."
example: "thread_abc123"
example: thread_abc123
object:
type: string
description: "Type of the object, indicating it's a thread."
default: "thread"
description: "Type of the object"
example: thread
created_at:
type: integer
format: int64
description: "Unix timestamp representing the creation time of the thread."
example: 1699014083
assistants:
type: array
items:
type: string
description: "List of assistants involved in the thread."
example: ["assistant-001"]
metadata:
type: object
description: "Metadata associated with the thread."
example: {}
messages:
type: array
items:
type: string
description: "List of messages within the thread."
required:
- id
- object
- created_at
- assistants
- metadata
- messages
example: []
CreateThreadResponse:
type: object
properties:
id:
type: string
description: "The identifier of the newly created thread."
example: "thread_abc123"
example: thread_abc123
object:
type: string
description: "Type of the object, indicating it's a thread."
default: "thread"
example: thread
created_at:
type: integer
format: int64
description: "Unix timestamp representing the creation time of the thread."
example: 1699014083
metadata:
type: object
description: "Metadata associated with the newly created thread."
required:
- id
- object
- created_at
- metadata
example: {}
ThreadMessageObject:
type: object
@ -130,23 +126,20 @@ components:
id:
type: string
description: "The identifier of the modified thread."
example: "thread_abc123"
example: thread_abc123
object:
type: string
description: "Type of the object, indicating it's a thread."
default: "thread"
example: thread
created_at:
type: integer
format: int64
description: "Unix timestamp representing the creation time of the thread."
example: 1699014083
metadata:
type: object
description: "Metadata associated with the modified thread."
required:
- id
- object
- created_at
- metadata
example: {}
DeleteThreadResponse:
type: object
@ -154,16 +147,12 @@ components:
id:
type: string
description: "The identifier of the deleted thread."
example: "thread_abc123"
example: thread_abc123
object:
type: string
description: "Type of the object, indicating the thread has been deleted."
default: "thread.deleted"
example: thread.deleted
deleted:
type: boolean
description: "Indicates whether the thread was successfully deleted."
example: true
required:
- id
- object
- deleted