adds code samples for list models
This commit is contained in:
parent
64ea290ca3
commit
d7bf98b68a
@ -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 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
|
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
|
Given a list of messages comprising a conversation, the model will return
|
||||||
return a response.
|
a response.
|
||||||
- name: Messages
|
- name: Messages
|
||||||
description: >
|
description: >
|
||||||
Messages capture a conversation's content. This can include the
|
Messages capture a conversation's content. This can include the content
|
||||||
content from LLM responses and other metadata from [chat
|
from LLM responses and other metadata from [chat
|
||||||
completions](/specs/chats).
|
completions](/specs/chats).
|
||||||
- name: Threads
|
- name: Threads
|
||||||
- name: Assistants
|
- name: Assistants
|
||||||
@ -49,16 +49,16 @@ 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">
|
"https://platform.openai.com/docs/api-reference/chat/create"> Equivalent
|
||||||
Equivalent to OpenAI's create chat completion. </a>
|
to OpenAI's create chat completion. </a>
|
||||||
requestBody:
|
requestBody:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: specs/chat.yaml#/components/schemas/ChatCompletionRequest
|
$ref: specs/chat.yaml#/components/schemas/ChatCompletionRequest
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -100,12 +100,12 @@ paths:
|
|||||||
- Models
|
- Models
|
||||||
summary: List models
|
summary: List models
|
||||||
description: >
|
description: >
|
||||||
Lists the currently available models, and provides basic
|
Lists the currently available models, and provides basic information
|
||||||
information about each one such as the owner and availability. <a href
|
about each one such as the owner and availability. <a href =
|
||||||
= "https://platform.openai.com/docs/api-reference/models/list">
|
"https://platform.openai.com/docs/api-reference/models/list"> Equivalent
|
||||||
Equivalent to OpenAI's list model. </a>
|
to OpenAI's list model. </a>
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -113,11 +113,39 @@ paths:
|
|||||||
$ref: specs/models.yaml#/components/schemas/ListModelsResponse
|
$ref: specs/models.yaml#/components/schemas/ListModelsResponse
|
||||||
x-codeSamples:
|
x-codeSamples:
|
||||||
- lang: cURL
|
- lang: cURL
|
||||||
source: |
|
source: |-
|
||||||
curl -X 'GET' \
|
curl -X 'GET' \
|
||||||
'http://localhost:1337/v1/models' \
|
'http://localhost:1337/v1/models' \
|
||||||
-H 'accept: application/json'
|
-H 'accept: application/json'
|
||||||
"/models/download/{model_id}":
|
- lang: JavaScript
|
||||||
|
source: |-
|
||||||
|
const response = await fetch('http://localhost:1337/v1/models', {
|
||||||
|
method: 'GET',
|
||||||
|
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');
|
||||||
|
|
||||||
|
const url = 'http://localhost:1337/v1/models';
|
||||||
|
const options = {
|
||||||
|
method: 'GET',
|
||||||
|
headers: { Accept: 'application/json' }
|
||||||
|
};
|
||||||
|
|
||||||
|
fetch(url, options)
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(json => console.log(json));
|
||||||
|
/models/download/{model_id}:
|
||||||
get:
|
get:
|
||||||
operationId: downloadModel
|
operationId: downloadModel
|
||||||
tags:
|
tags:
|
||||||
@ -135,7 +163,7 @@ paths:
|
|||||||
description: |
|
description: |
|
||||||
The ID of the model to use for this request.
|
The ID of the model to use for this request.
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -147,15 +175,15 @@ paths:
|
|||||||
curl -X 'GET' \
|
curl -X 'GET' \
|
||||||
'http://localhost:1337/v1/models/download/{model_id}' \
|
'http://localhost:1337/v1/models/download/{model_id}' \
|
||||||
-H 'accept: application/json'
|
-H 'accept: application/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
|
Get a model instance, providing basic information about the model such
|
||||||
such as the owner and permissioning. <a href =
|
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:
|
||||||
@ -168,7 +196,7 @@ paths:
|
|||||||
description: |
|
description: |
|
||||||
The ID of the model to use for this request.
|
The ID of the model to use for this request.
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -199,7 +227,7 @@ paths:
|
|||||||
description: |
|
description: |
|
||||||
The model id to delete
|
The model id to delete
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -228,7 +256,7 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: specs/threads.yaml#/components/schemas/CreateThreadObject
|
$ref: specs/threads.yaml#/components/schemas/CreateThreadObject
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: Thread created successfully
|
description: Thread created successfully
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -257,7 +285,7 @@ paths:
|
|||||||
description: |
|
description: |
|
||||||
Retrieves a list of all threads available in the system.
|
Retrieves a list of all threads available in the system.
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: List of threads retrieved successfully
|
description: List of threads retrieved successfully
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -285,7 +313,7 @@ paths:
|
|||||||
source: |
|
source: |
|
||||||
curl http://localhost:1337/v1/threads \
|
curl http://localhost:1337/v1/threads \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"/threads/{thread_id}":
|
/threads/{thread_id}:
|
||||||
get:
|
get:
|
||||||
operationId: getThread
|
operationId: getThread
|
||||||
tags:
|
tags:
|
||||||
@ -305,7 +333,7 @@ paths:
|
|||||||
description: |
|
description: |
|
||||||
The ID of the thread to retrieve.
|
The ID of the thread to retrieve.
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: Thread details retrieved successfully
|
description: Thread details retrieved successfully
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -345,7 +373,7 @@ paths:
|
|||||||
items:
|
items:
|
||||||
$ref: specs/threads.yaml#/components/schemas/ThreadMessageObject
|
$ref: specs/threads.yaml#/components/schemas/ThreadMessageObject
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: Thread modified successfully
|
description: Thread modified successfully
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -384,7 +412,7 @@ paths:
|
|||||||
description: |
|
description: |
|
||||||
The ID of the thread to be deleted.
|
The ID of the thread to be deleted.
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: Thread deleted successfully
|
description: Thread deleted successfully
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -405,7 +433,7 @@ paths:
|
|||||||
"https://platform.openai.com/docs/api-reference/assistants/listAssistants">
|
"https://platform.openai.com/docs/api-reference/assistants/listAssistants">
|
||||||
Equivalent to OpenAI's list assistants. </a>
|
Equivalent to OpenAI's list assistants. </a>
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: List of assistants retrieved successfully
|
description: List of assistants retrieved successfully
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -445,7 +473,7 @@ paths:
|
|||||||
source: |
|
source: |
|
||||||
curl http://localhost:1337/v1/assistants \
|
curl http://localhost:1337/v1/assistants \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"/assistants/{assistant_id}":
|
/assistants/{assistant_id}:
|
||||||
get:
|
get:
|
||||||
operationId: getAssistant
|
operationId: getAssistant
|
||||||
tags:
|
tags:
|
||||||
@ -465,18 +493,19 @@ paths:
|
|||||||
description: |
|
description: |
|
||||||
The ID of the assistant to retrieve.
|
The ID of the assistant to retrieve.
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: null
|
description: null
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: specs/assistants.yaml#/components/schemas/RetrieveAssistantResponse
|
$ref: >-
|
||||||
|
specs/assistants.yaml#/components/schemas/RetrieveAssistantResponse
|
||||||
x-codeSamples:
|
x-codeSamples:
|
||||||
- lang: cURL
|
- lang: cURL
|
||||||
source: |
|
source: |
|
||||||
curl http://localhost:1337/v1/assistants/{assistant_id} \
|
curl http://localhost:1337/v1/assistants/{assistant_id} \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
"/threads/{thread_id}/messages":
|
/threads/{thread_id}/messages:
|
||||||
get:
|
get:
|
||||||
operationId: listMessages
|
operationId: listMessages
|
||||||
tags:
|
tags:
|
||||||
@ -495,7 +524,7 @@ paths:
|
|||||||
description: |
|
description: |
|
||||||
The ID of the thread from which to retrieve messages.
|
The ID of the thread from which to retrieve messages.
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: List of messages retrieved successfully
|
description: List of messages retrieved successfully
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -547,7 +576,7 @@ paths:
|
|||||||
- role
|
- role
|
||||||
- content
|
- content
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: Message created successfully
|
description: Message created successfully
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -562,7 +591,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:
|
||||||
@ -589,7 +618,7 @@ paths:
|
|||||||
description: |
|
description: |
|
||||||
The ID of the message to retrieve.
|
The ID of the message to retrieve.
|
||||||
responses:
|
responses:
|
||||||
"200":
|
'200':
|
||||||
description: OK
|
description: OK
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
@ -598,8 +627,8 @@ paths:
|
|||||||
x-codeSamples:
|
x-codeSamples:
|
||||||
- lang: cURL
|
- lang: cURL
|
||||||
source: >
|
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"
|
-H "Content-Type: application/json"
|
||||||
x-webhooks:
|
x-webhooks:
|
||||||
ModelObject:
|
ModelObject:
|
||||||
@ -621,10 +650,9 @@ 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
|
Build assistants that can call models and use tools to perform tasks.
|
||||||
tasks. <a href =
|
<a href = "https://platform.openai.com/docs/api-reference/assistants">
|
||||||
"https://platform.openai.com/docs/api-reference/assistants"> Equivalent
|
Equivalent to OpenAI's assistants object. </a>
|
||||||
to OpenAI's assistants object. </a>
|
|
||||||
operationId: AssistantObjects
|
operationId: AssistantObjects
|
||||||
tags:
|
tags:
|
||||||
- Assistants
|
- Assistants
|
||||||
@ -651,7 +679,8 @@ x-webhooks:
|
|||||||
ThreadObject:
|
ThreadObject:
|
||||||
post:
|
post:
|
||||||
summary: The thread object
|
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">
|
"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