Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add assistants api reference #801

Merged
merged 15 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions docs/openapi/jan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,74 @@ paths:
- lang: "curl"
source: |
curl http://localhost:1337/v1/threads/{thread_id}
### ASSISTANTS
/assistants/:
get:
operationId: listAssistants
tags:
- Assistants
summary: List assistants
description: |
Return a list of assistants. <a href = "https://platform.openai.com/docs/api-reference/assistants/listAssistants"> Equivalent to OpenAI's list assistants. </a>
responses:
"200":
description:
content:
application/json:
schema:
$ref: "specs/assistants.yaml#/components/schemas/ListAssistantsResponse"
post:
operationId: createAssistant
tags:
- Assistants
summary: Create assistant
description: |
Create an assistant with a model and instructions. <a href = "https://platform.openai.com/docs/api-reference/assistants/createAssistant"> Equivalent to OpenAI's create assistants. </a>
responses:
"200":
description:
content:
application/json:
schema:
$ref: "specs/assistants.yaml#/components/schemas/CreateAssistantResponse"

/assistants/{assistant_id}:
get:
operationId: getAssistant
tags:
- Assistants
summary: Retrieve assistant
description: |
Retrieves an assistant. <a href = "https://platform.openai.com/docs/api-reference/assistants/getAssistant"> Equivalent to OpenAI's retrieve assistants. </a>
responses:
"200":
description:
content:
application/json:
schema:
$ref: "specs/assistants.yaml#/components/schemas/RetrieveAssistantResponse"

post:
operationId: modifyAssistant
tags:
- Assistants
summary: Modify assistant
description: |
Modifies an assistant. <a href = "https://platform.openai.com/docs/api-reference/assistants/modifyAssistant"> Equivalent to OpenAI's modify assistant. </a>
delete:
operationId: deleteAssistant
tags:
- Assistants
summary: Delete assistant
description: |
Delete an assistant. <a href = "https://platform.openai.com/docs/api-reference/assistants/deleteAssistant"> Equivalent to OpenAI's delete assistant. </a>
responses:
"200":
description:
content:
application/json:
schema:
$ref: "specs/assistants.yaml#/components/schemas/ModifyAssistantResponse"

### MESSAGES
/threads/{thread_id}/messages:
Expand Down Expand Up @@ -709,6 +777,19 @@ x-webhooks:
application/json:
schema:
$ref: 'specs/models.yaml#/components/schemas/ModelObject'
AssistantObject:
post:
summary: The assistant object
description: |
Build assistants that can call models and use tools to perform tasks. <a href = "https://platform.openai.com/docs/api-reference/assistants"> Equivalent to OpenAI's assistants object. </a>
operationId: AssistantObjects
tags:
- Assistants
requestBody:
content:
application/json:
schema:
$ref: 'specs/assistants.yaml#/components/schemas/AssistantObject'
MessageObject:
post:
summary: The message object
Expand Down
59 changes: 0 additions & 59 deletions docs/openapi/specs/assistant.yaml

This file was deleted.

141 changes: 141 additions & 0 deletions docs/openapi/specs/assistants.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
components:
schemas:
AssistantObject:
type: object
properties:
avatar:
type: string
description: "URL of the assistant's avatar. Jan-specific property."
example: "https://lala.png"
id:
type: string
description: "The identifier of the assistant."
example: "asst_abc123"
object:
type: string
description: "Type of the object, indicating it's an assistant."
default: "assistant"
version:
type: integer
description: "Version number of the assistant."
example: 1
created_at:
type: integer
format: int64
description: "Unix timestamp representing the creation time of the assistant."
name:
type: string
description: "Name of the assistant."
example: "Math Tutor"
description:
type: string
description: "Description of the assistant. Can be null."
models:
type: array
description: "List of models associated with the assistant. Jan-specific property."
items:
type: object
properties:
model_id:
type: string
# Additional properties for models can be added here
events:
type: object
description: "Event subscription settings for the assistant."
properties:
in:
type: array
items:
type: string
out:
type: array
items:
type: string
# If there are specific event types, they can be detailed here
metadata:
type: object
description: "Metadata associated with the assistant."
required:
0xHieu01 marked this conversation as resolved.
Show resolved Hide resolved
- name
- models
- events

ListAssistantsResponse:
type: object
properties:
id:
type: string
description: "The identifier of the model that was deleted."
example: "model-zephyr-7B"
object:
type: string
description: "Type of the object, indicating it's a model."
default: "model"
deleted:
type: boolean
description: "Indicates whether the model was successfully deleted."
example: true

CreateAssistantResponse:
type: object
properties:
id:
type: string
description: "The identifier of the model that was deleted."
example: "model-zephyr-7B"
object:
type: string
description: "Type of the object, indicating it's a model."
default: "model"
deleted:
type: boolean
description: "Indicates whether the model was successfully deleted."
example: true

RetrieveAssistantResponse:
type: object
properties:
id:
type: string
description: "The identifier of the model that was deleted."
example: "model-zephyr-7B"
object:
type: string
description: "Type of the object, indicating it's a model."
default: "model"
deleted:
type: boolean
description: "Indicates whether the model was successfully deleted."
example: true

ModifyAssistantResponse:
type: object
properties:
id:
type: string
description: "The identifier of the model that was deleted."
example: "model-zephyr-7B"
object:
type: string
description: "Type of the object, indicating it's a model."
default: "model"
deleted:
type: boolean
description: "Indicates whether the model was successfully deleted."
example: true

DeleteAssistantResponse:
type: object
properties:
id:
type: string
description: "The identifier of the model that was deleted."
example: "model-zephyr-7B"
object:
type: string
description: "Type of the object, indicating it's a model."
default: "model"
deleted:
type: boolean
description: "Indicates whether the model was successfully deleted."
example: true