diff --git a/docs/openapi/jan.yaml b/docs/openapi/jan.yaml index e58c6a4f2..e3f1ff3b1 100644 --- a/docs/openapi/jan.yaml +++ b/docs/openapi/jan.yaml @@ -113,38 +113,10 @@ paths: $ref: specs/models.yaml#/components/schemas/ListModelsResponse x-codeSamples: - lang: cURL - source: |- + source: | curl -X 'GET' \ 'http://localhost:1337/v1/models' \ -H 'accept: application/json' - - 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: operationId: downloadModel @@ -204,10 +176,47 @@ paths: $ref: specs/models.yaml#/components/schemas/GetModelResponse x-codeSamples: - lang: cURL - source: | - curl -X 'GET' \ - 'http://localhost:1337/v1/models/{model_id}' \ + source: |- + curl -X 'GET' \ + 'http://localhost:1337/v1/models/{model_id}' \ -H 'accept: application/json' + - lang: JavaScript + source: |- + const fetch = require('node-fetch'); + + const modelId = 'mistral-ins-7b-q4'; + + fetch(`http://localhost:1337/v1/models/${modelId}`, { + method: 'GET', + headers: {'accept': 'application/json'} + }) + .then(res => res.json()) + .then(json => console.log(json)); + - lang: Node.js + source: |- + const fetch = require('node-fetch'); + + const modelId = 'mistral-ins-7b-q4'; + + fetch(`http://localhost:1337/v1/models/${modelId}`, { + method: 'GET', + headers: {'accept': 'application/json'} + }) + .then(res => res.json()) + .then(json => console.log(json)); + - lang: Python + source: >- + import requests + + + model_id = 'mistral-ins-7b-q4' + + + response = + requests.get(f'http://localhost:1337/v1/models/{model_id}', + headers={'accept': 'application/json'}) + + print(response.json()) delete: operationId: deleteModel tags: @@ -235,10 +244,45 @@ paths: $ref: specs/models.yaml#/components/schemas/DeleteModelResponse x-codeSamples: - lang: cURL - source: | + source: |- curl -X 'DELETE' \ 'http://localhost:1337/v1/models/{model_id}' \ -H 'accept: application/json' + - lang: JavaScript + source: |- + const fetch = require('node-fetch'); + + const modelId = 'mistral-ins-7b-q4'; + + fetch(`http://localhost:1337/v1/models/${modelId}`, { + method: 'DELETE', + headers: { 'accept': 'application/json' } + }) + .then(res => res.json()) + .then(json => console.log(json)); + - lang: Node.js + source: |- + const fetch = require('node-fetch'); + + const modelId = 'mistral-ins-7b-q4'; + + fetch(`http://localhost:1337/v1/models/${modelId}`, { + method: 'DELETE', + headers: { 'accept': 'application/json' } + }) + .then(res => res.json()) + .then(json => console.log(json)); + - lang: Python + source: >- + import requests + + + model_id = 'mistral-ins-7b-q4' + + + response = + requests.delete(f'http://localhost:1337/v1/models/{model_id}', + headers={'accept': 'application/json'}) /threads: post: operationId: createThread