docs: re-order language support consistency
This commit is contained in:
parent
5a6c20c4c9
commit
02f2536410
@ -1,11 +1,11 @@
|
|||||||
|
---
|
||||||
openapi: 3.0.0
|
openapi: 3.0.0
|
||||||
info:
|
info:
|
||||||
title: API Reference
|
title: API Reference
|
||||||
description: >
|
description: >
|
||||||
# Introduction
|
# Introduction
|
||||||
|
|
||||||
Jan API is compatible with the [OpenAI
|
Jan API is compatible with the [OpenAI API](https://platform.openai.com/docs/api-reference).
|
||||||
API](https://platform.openai.com/docs/api-reference).
|
|
||||||
version: 0.1.8
|
version: 0.1.8
|
||||||
contact:
|
contact:
|
||||||
name: Jan Discord
|
name: Jan Discord
|
||||||
@ -20,12 +20,12 @@ tags:
|
|||||||
description: List and describe the various models available in the API.
|
description: List and describe the various models available in the API.
|
||||||
- name: Chat
|
- name: Chat
|
||||||
description: >
|
description: >
|
||||||
Given a list of messages comprising a conversation, the model will return
|
Given a list of messages comprising a conversation, the model will
|
||||||
a response.
|
return a response.
|
||||||
- name: Messages
|
- name: Messages
|
||||||
description: >
|
description: >
|
||||||
Messages capture a conversation's content. This can include the content
|
Messages capture a conversation's content. This can include the
|
||||||
from LLM responses and other metadata from [chat
|
content from LLM responses and other metadata from [chat
|
||||||
completions](/specs/chats).
|
completions](/specs/chats).
|
||||||
- name: Threads
|
- name: Threads
|
||||||
- name: Assistants
|
- name: Assistants
|
||||||
@ -49,9 +49,9 @@ paths:
|
|||||||
summary: |
|
summary: |
|
||||||
Create chat completion
|
Create chat completion
|
||||||
description: >
|
description: >
|
||||||
Creates a model response for the given chat conversation. <a href =
|
Creates a model response for the given chat conversation. <a href
|
||||||
"https://platform.openai.com/docs/api-reference/chat/create"> Equivalent
|
= "https://platform.openai.com/docs/api-reference/chat/create">
|
||||||
to OpenAI's create chat completion. </a>
|
Equivalent to OpenAI's create chat completion. </a>
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -192,9 +192,7 @@ paths:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
response =
|
response = requests.post('http://localhost:1337/v1/chat/completions', json=data)
|
||||||
requests.post('http://localhost:1337/v1/chat/completions',
|
|
||||||
json=data)
|
|
||||||
|
|
||||||
print(response.json())
|
print(response.json())
|
||||||
/models:
|
/models:
|
||||||
@ -204,10 +202,10 @@ paths:
|
|||||||
- Models
|
- Models
|
||||||
summary: List models
|
summary: List models
|
||||||
description: >
|
description: >
|
||||||
Lists the currently available models, and provides basic information
|
Lists the currently available models, and provides basic
|
||||||
about each one such as the owner and availability. <a href =
|
information about each one such as the owner and availability. <a href
|
||||||
"https://platform.openai.com/docs/api-reference/models/list"> Equivalent
|
= "https://platform.openai.com/docs/api-reference/models/list">
|
||||||
to OpenAI's list model. </a>
|
Equivalent to OpenAI's list model. </a>
|
||||||
responses:
|
responses:
|
||||||
'200':
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
@ -228,14 +226,7 @@ paths:
|
|||||||
headers: {Accept: 'application/json'}
|
headers: {Accept: 'application/json'}
|
||||||
});
|
});
|
||||||
const data = await response.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
|
- lang: Node.js
|
||||||
source: |-
|
source: |-
|
||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
@ -249,7 +240,15 @@ paths:
|
|||||||
fetch(url, options)
|
fetch(url, options)
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(json => console.log(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:
|
get:
|
||||||
operationId: downloadModel
|
operationId: downloadModel
|
||||||
tags:
|
tags:
|
||||||
@ -304,20 +303,18 @@ paths:
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
response =
|
response = requests.get('http://localhost:1337/v1/models/download/{model_id}', headers={'accept': 'application/json'})
|
||||||
requests.get('http://localhost:1337/v1/models/download/{model_id}',
|
|
||||||
headers={'accept': 'application/json'})
|
|
||||||
|
|
||||||
data = response.json()
|
data = response.json()
|
||||||
/models/{model_id}:
|
'/models/{model_id}':
|
||||||
get:
|
get:
|
||||||
operationId: retrieveModel
|
operationId: retrieveModel
|
||||||
tags:
|
tags:
|
||||||
- Models
|
- Models
|
||||||
summary: Retrieve model
|
summary: Retrieve model
|
||||||
description: >
|
description: >
|
||||||
Get a model instance, providing basic information about the model such
|
Get a model instance, providing basic information about the model
|
||||||
as the owner and permissioning. <a href =
|
such as the owner and permissioning. <a href =
|
||||||
"https://platform.openai.com/docs/api-reference/models/retrieve">
|
"https://platform.openai.com/docs/api-reference/models/retrieve">
|
||||||
Equivalent to OpenAI's retrieve model. </a>
|
Equivalent to OpenAI's retrieve model. </a>
|
||||||
parameters:
|
parameters:
|
||||||
@ -374,9 +371,7 @@ paths:
|
|||||||
model_id = 'mistral-ins-7b-q4'
|
model_id = 'mistral-ins-7b-q4'
|
||||||
|
|
||||||
|
|
||||||
response =
|
response = requests.get(f'http://localhost:1337/v1/models/{model_id}', headers={'accept': 'application/json'})
|
||||||
requests.get(f'http://localhost:1337/v1/models/{model_id}',
|
|
||||||
headers={'accept': 'application/json'})
|
|
||||||
|
|
||||||
print(response.json())
|
print(response.json())
|
||||||
delete:
|
delete:
|
||||||
@ -442,9 +437,7 @@ paths:
|
|||||||
model_id = 'mistral-ins-7b-q4'
|
model_id = 'mistral-ins-7b-q4'
|
||||||
|
|
||||||
|
|
||||||
response =
|
response = requests.delete(f'http://localhost:1337/v1/models/{model_id}', headers={'accept': 'application/json'})
|
||||||
requests.delete(f'http://localhost:1337/v1/models/{model_id}',
|
|
||||||
headers={'accept': 'application/json'})
|
|
||||||
/threads:
|
/threads:
|
||||||
post:
|
post:
|
||||||
operationId: createThread
|
operationId: createThread
|
||||||
@ -613,7 +606,7 @@ paths:
|
|||||||
|
|
||||||
response = requests.get(url, headers=headers)
|
response = requests.get(url, headers=headers)
|
||||||
print(response.json())
|
print(response.json())
|
||||||
/threads/{thread_id}:
|
'/threads/{thread_id}':
|
||||||
get:
|
get:
|
||||||
operationId: getThread
|
operationId: getThread
|
||||||
tags:
|
tags:
|
||||||
@ -799,7 +792,7 @@ paths:
|
|||||||
headers = {'Content-Type': 'application/json'}
|
headers = {'Content-Type': 'application/json'}
|
||||||
|
|
||||||
response = requests.get(url, headers=headers)
|
response = requests.get(url, headers=headers)
|
||||||
/assistants/{assistant_id}:
|
'/assistants/{assistant_id}':
|
||||||
get:
|
get:
|
||||||
operationId: getAssistant
|
operationId: getAssistant
|
||||||
tags:
|
tags:
|
||||||
@ -824,8 +817,7 @@ paths:
|
|||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: >-
|
$ref: specs/assistants.yaml#/components/schemas/RetrieveAssistantResponse
|
||||||
specs/assistants.yaml#/components/schemas/RetrieveAssistantResponse
|
|
||||||
x-codeSamples:
|
x-codeSamples:
|
||||||
- lang: cURL
|
- lang: cURL
|
||||||
source: |-
|
source: |-
|
||||||
@ -863,10 +855,8 @@ paths:
|
|||||||
assistant_id = 'abc123'
|
assistant_id = 'abc123'
|
||||||
|
|
||||||
|
|
||||||
response =
|
response = requests.get(f'http://localhost:1337/v1/assistants/{assistant_id}', headers={'Content-Type': 'application/json'})
|
||||||
requests.get(f'http://localhost:1337/v1/assistants/{assistant_id}',
|
'/threads/{thread_id}/messages':
|
||||||
headers={'Content-Type': 'application/json'})
|
|
||||||
/threads/{thread_id}/messages:
|
|
||||||
get:
|
get:
|
||||||
operationId: listMessages
|
operationId: listMessages
|
||||||
tags:
|
tags:
|
||||||
@ -952,7 +942,7 @@ paths:
|
|||||||
"role": "user",
|
"role": "user",
|
||||||
"content": "How does AI work? Explain it in simple terms."
|
"content": "How does AI work? Explain it in simple terms."
|
||||||
}'
|
}'
|
||||||
/threads/{thread_id}/messages/{message_id}:
|
'/threads/{thread_id}/messages/{message_id}':
|
||||||
get:
|
get:
|
||||||
operationId: retrieveMessage
|
operationId: retrieveMessage
|
||||||
tags:
|
tags:
|
||||||
@ -988,8 +978,8 @@ paths:
|
|||||||
x-codeSamples:
|
x-codeSamples:
|
||||||
- lang: cURL
|
- lang: cURL
|
||||||
source: >
|
source: >
|
||||||
curl
|
curl http://localhost:1337/v1/threads/{thread_id}/messages/{message_id}
|
||||||
http://localhost:1337/v1/threads/{thread_id}/messages/{message_id} \
|
\
|
||||||
-H "Content-Type: application/json"
|
-H "Content-Type: application/json"
|
||||||
x-webhooks:
|
x-webhooks:
|
||||||
ModelObject:
|
ModelObject:
|
||||||
@ -1011,9 +1001,10 @@ x-webhooks:
|
|||||||
post:
|
post:
|
||||||
summary: The assistant object
|
summary: The assistant object
|
||||||
description: >
|
description: >
|
||||||
Build assistants that can call models and use tools to perform tasks.
|
Build assistants that can call models and use tools to perform
|
||||||
<a href = "https://platform.openai.com/docs/api-reference/assistants">
|
tasks. <a href =
|
||||||
Equivalent to OpenAI's assistants object. </a>
|
"https://platform.openai.com/docs/api-reference/assistants"> Equivalent
|
||||||
|
to OpenAI's assistants object. </a>
|
||||||
operationId: AssistantObjects
|
operationId: AssistantObjects
|
||||||
tags:
|
tags:
|
||||||
- Assistants
|
- Assistants
|
||||||
@ -1040,8 +1031,7 @@ x-webhooks:
|
|||||||
ThreadObject:
|
ThreadObject:
|
||||||
post:
|
post:
|
||||||
summary: The thread object
|
summary: The thread object
|
||||||
description: >-
|
description: Represents a thread that contains messages. <a href =
|
||||||
Represents a thread that contains messages. <a href =
|
|
||||||
"https://platform.openai.com/docs/api-reference/threads/object">
|
"https://platform.openai.com/docs/api-reference/threads/object">
|
||||||
Equivalent to OpenAI's thread object. </a>
|
Equivalent to OpenAI's thread object. </a>
|
||||||
operationId: ThreadObject
|
operationId: ThreadObject
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user