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 11 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
4 changes: 4 additions & 0 deletions docs/docs/specs/engineering/assistants.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ In Jan, assistants are `primary` entities with the following capabilities:

## `assistant.json`

- Each `assistant` folder contains an `assistant.json` file, which is a representation of an assistant.
- `assistant.json` contains metadata and model parameter overrides
- There are no required fields.

```js
{
"id": "asst_abc123", // Defaults to foldername
Expand Down
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.

78 changes: 78 additions & 0 deletions docs/openapi/specs/assistants.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
components:
schemas:
AssistantObject:
type: object
properties:
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."
example: 1698984975
name:
type: string
description: "Name of the assistant."
example: "Math Tutor"
description:
type: string
description: "Description of the assistant. Can be null."
example: null
avatar:
type: string
description: "URL of the assistant's avatar. Jan-specific property."
example: "https://pic.png"
models:
type: array
description: "List of models associated with the assistant. Jan-specific property."
items:
type: object
properties:
model_id:
type: string
example: model_0
instructions:
type: string
description: "A system prompt for the assistant"
example: Be concise
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."

ListAssistantsResponse:
type: object

CreateAssistantResponse:
type: object

RetrieveAssistantResponse:
type: object

ModifyAssistantResponse:
type: object

DeleteAssistantResponse:
type: object