Skip to content

Commit

Permalink
docs: update API Reference assistants_id endpoint from DevDocs (#2195)
Browse files Browse the repository at this point in the history
docs: update API Reference assistants_id endpoint from DevDocs
  • Loading branch information
0xHieu01 authored Mar 2, 2024
2 parents fde1207 + 497020c commit 7f2513f
Showing 1 changed file with 91 additions and 67 deletions.
158 changes: 91 additions & 67 deletions docs/openapi/jan.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
openapi: 3.0.0
info:
title: API Reference
description: >
# Introduction
Jan API is compatible with the [OpenAI
API](https://platform.openai.com/docs/api-reference).
Jan API is compatible with the [OpenAI API](https://platform.openai.com/docs/api-reference).
version: 0.1.8
contact:
name: Jan Discord
Expand All @@ -20,12 +20,12 @@ tags:
description: List and describe the various models available in the API.
- name: Chat
description: >
Given a list of messages comprising a conversation, the model will return
a response.
Given a list of messages comprising a conversation, the model will
return a response.
- name: Messages
description: >
Messages capture a conversation's content. This can include the content
from LLM responses and other metadata from [chat
Messages capture a conversation's content. This can include the
content from LLM responses and other metadata from [chat
completions](/specs/chats).
- name: Threads
- name: Assistants
Expand All @@ -49,16 +49,16 @@ paths:
summary: |
Create chat completion
description: >
Creates a model response for the given chat conversation. <a href =
"https://platform.openai.com/docs/api-reference/chat/create"> Equivalent
to OpenAI's create chat completion. </a>
Creates a model response for the given chat conversation. <a href
= "https://platform.openai.com/docs/api-reference/chat/create">
Equivalent to OpenAI's create chat completion. </a>
requestBody:
content:
application/json:
schema:
$ref: specs/chat.yaml#/components/schemas/ChatCompletionRequest
responses:
'200':
"200":
description: OK
content:
application/json:
Expand Down Expand Up @@ -192,9 +192,7 @@ paths:
}
response =
requests.post('http://localhost:1337/v1/chat/completions',
json=data)
response = requests.post('http://localhost:1337/v1/chat/completions', json=data)
print(response.json())
/models:
Expand All @@ -204,12 +202,12 @@ paths:
- Models
summary: List models
description: >
Lists the currently available models, and provides basic information
about each one such as the owner and availability. <a href =
"https://platform.openai.com/docs/api-reference/models/list"> Equivalent
to OpenAI's list model. </a>
Lists the currently available models, and provides basic
information about each one such as the owner and availability. <a href
= "https://platform.openai.com/docs/api-reference/models/list">
Equivalent to OpenAI's list model. </a>
responses:
'200':
"200":
description: OK
content:
application/json:
Expand All @@ -228,14 +226,6 @@ paths:
headers: {Accept: 'application/json'}
});
const data = await response.json();
- lang: Python
source: |-
import requests
url = 'http://localhost:1337/v1/models'
headers = {'Accept': 'application/json'}
response = requests.get(url, headers=headers)
data = response.json()
- lang: Node.js
source: |-
const fetch = require('node-fetch');
Expand All @@ -249,7 +239,15 @@ paths:
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json));
/models/download/{model_id}:
- lang: Python
source: |-
import requests
url = 'http://localhost:1337/v1/models'
headers = {'Accept': 'application/json'}
response = requests.get(url, headers=headers)
data = response.json()
"/models/download/{model_id}":
get:
operationId: downloadModel
tags:
Expand All @@ -267,7 +265,7 @@ paths:
description: |
The ID of the model to use for this request.
responses:
'200':
"200":
description: OK
content:
application/json:
Expand Down Expand Up @@ -304,20 +302,18 @@ paths:
import requests
response =
requests.get('http://localhost:1337/v1/models/download/{model_id}',
headers={'accept': 'application/json'})
response = requests.get('http://localhost:1337/v1/models/download/{model_id}', headers={'accept': 'application/json'})
data = response.json()
/models/{model_id}:
"/models/{model_id}":
get:
operationId: retrieveModel
tags:
- Models
summary: Retrieve model
description: >
Get a model instance, providing basic information about the model such
as the owner and permissioning. <a href =
Get a model instance, providing basic information about the model
such as the owner and permissioning. <a href =
"https://platform.openai.com/docs/api-reference/models/retrieve">
Equivalent to OpenAI's retrieve model. </a>
parameters:
Expand All @@ -330,7 +326,7 @@ paths:
description: |
The ID of the model to use for this request.
responses:
'200':
"200":
description: OK
content:
application/json:
Expand Down Expand Up @@ -374,9 +370,7 @@ paths:
model_id = 'mistral-ins-7b-q4'
response =
requests.get(f'http://localhost:1337/v1/models/{model_id}',
headers={'accept': 'application/json'})
response = requests.get(f'http://localhost:1337/v1/models/{model_id}', headers={'accept': 'application/json'})
print(response.json())
delete:
Expand All @@ -398,7 +392,7 @@ paths:
description: |
The model id to delete
responses:
'200':
"200":
description: OK
content:
application/json:
Expand Down Expand Up @@ -442,9 +436,7 @@ paths:
model_id = 'mistral-ins-7b-q4'
response =
requests.delete(f'http://localhost:1337/v1/models/{model_id}',
headers={'accept': 'application/json'})
response = requests.delete(f'http://localhost:1337/v1/models/{model_id}', headers={'accept': 'application/json'})
/threads:
post:
operationId: createThread
Expand All @@ -462,7 +454,7 @@ paths:
schema:
$ref: specs/threads.yaml#/components/schemas/CreateThreadObject
responses:
'200':
"200":
description: Thread created successfully
content:
application/json:
Expand Down Expand Up @@ -558,7 +550,7 @@ paths:
description: |
Retrieves a list of all threads available in the system.
responses:
'200':
"200":
description: List of threads retrieved successfully
content:
application/json:
Expand Down Expand Up @@ -613,7 +605,7 @@ paths:
response = requests.get(url, headers=headers)
print(response.json())
/threads/{thread_id}:
"/threads/{thread_id}":
get:
operationId: getThread
tags:
Expand All @@ -633,7 +625,7 @@ paths:
description: |
The ID of the thread to retrieve.
responses:
'200':
"200":
description: Thread details retrieved successfully
content:
application/json:
Expand Down Expand Up @@ -673,7 +665,7 @@ paths:
items:
$ref: specs/threads.yaml#/components/schemas/ThreadMessageObject
responses:
'200':
"200":
description: Thread modified successfully
content:
application/json:
Expand Down Expand Up @@ -712,7 +704,7 @@ paths:
description: |
The ID of the thread to be deleted.
responses:
'200':
"200":
description: Thread deleted successfully
content:
application/json:
Expand All @@ -733,7 +725,7 @@ paths:
"https://platform.openai.com/docs/api-reference/assistants/listAssistants">
Equivalent to OpenAI's list assistants. </a>
responses:
'200':
"200":
description: List of assistants retrieved successfully
content:
application/json:
Expand Down Expand Up @@ -799,7 +791,7 @@ paths:
headers = {'Content-Type': 'application/json'}
response = requests.get(url, headers=headers)
/assistants/{assistant_id}:
"/assistants/{assistant_id}":
get:
operationId: getAssistant
tags:
Expand All @@ -819,19 +811,51 @@ paths:
description: |
The ID of the assistant to retrieve.
responses:
'200':
"200":
description: null
content:
application/json:
schema:
$ref: >-
specs/assistants.yaml#/components/schemas/RetrieveAssistantResponse
$ref: specs/assistants.yaml#/components/schemas/RetrieveAssistantResponse
x-codeSamples:
- lang: cURL
source: |
source: |-
curl http://localhost:1337/v1/assistants/{assistant_id} \
-H "Content-Type: application/json" \
/threads/{thread_id}/messages:
-H "Content-Type: application/json"
- lang: JavaScript
source: |-
const fetch = require('node-fetch');
let assistantId = 'abc123';
fetch(`http://localhost:1337/v1/assistants/${assistantId}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})
- lang: Node.js
source: |-
const fetch = require('node-fetch');
let assistantId = 'abc123';
fetch(`http://localhost:1337/v1/assistants/${assistantId}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
})
- lang: Python
source: >-
import requests
assistant_id = 'abc123'
response = requests.get(f'http://localhost:1337/v1/assistants/{assistant_id}', headers={'Content-Type': 'application/json'})
"/threads/{thread_id}/messages":
get:
operationId: listMessages
tags:
Expand All @@ -850,7 +874,7 @@ paths:
description: |
The ID of the thread from which to retrieve messages.
responses:
'200':
"200":
description: List of messages retrieved successfully
content:
application/json:
Expand Down Expand Up @@ -902,7 +926,7 @@ paths:
- role
- content
responses:
'200':
"200":
description: Message created successfully
content:
application/json:
Expand All @@ -917,7 +941,7 @@ paths:
"role": "user",
"content": "How does AI work? Explain it in simple terms."
}'
/threads/{thread_id}/messages/{message_id}:
"/threads/{thread_id}/messages/{message_id}":
get:
operationId: retrieveMessage
tags:
Expand All @@ -944,7 +968,7 @@ paths:
description: |
The ID of the message to retrieve.
responses:
'200':
"200":
description: OK
content:
application/json:
Expand All @@ -953,8 +977,8 @@ paths:
x-codeSamples:
- lang: cURL
source: >
curl
http://localhost:1337/v1/threads/{thread_id}/messages/{message_id} \
curl http://localhost:1337/v1/threads/{thread_id}/messages/{message_id}
\
-H "Content-Type: application/json"
x-webhooks:
ModelObject:
Expand All @@ -976,9 +1000,10 @@ x-webhooks:
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>
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
Expand All @@ -1005,8 +1030,7 @@ x-webhooks:
ThreadObject:
post:
summary: The thread object
description: >-
Represents a thread that contains messages. <a href =
description: Represents a thread that contains messages. <a href =
"https://platform.openai.com/docs/api-reference/threads/object">
Equivalent to OpenAI's thread object. </a>
operationId: ThreadObject
Expand Down

0 comments on commit 7f2513f

Please sign in to comment.