Skip to content

Instantly share code, notes, and snippets.

@ouvreboite
Last active March 4, 2024 16:28
Show Gist options
  • Save ouvreboite/389c0aca5550677c2eb244ce5529f75c to your computer and use it in GitHub Desktop.
Save ouvreboite/389c0aca5550677c2eb244ce5529f75c to your computer and use it in GitHub Desktop.
Simple API to test's chatGPT API proficiency
openapi: 3.0.0
info:
version: 1.0.0
title: Bots API
servers:
- url: http://example.com/v1
paths:
/chatbot:
get:
summary: List all chatbots
operationId: listChatbots
tags:
- chatbots
parameters:
- name: availability
in: query
description: The availability of the bots to returns
required: false
schema:
type: string
enum: [public, private]
responses:
'200':
description: The chatbots
content:
application/json:
schema:
$ref: '#/components/schemas/ChatBots'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
post:
summary: Create a chatbot
operationId: createChatbots
tags:
- chatbots
requestBody:
description: The chatbot to create
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ChatBot'
responses:
'201':
description: The chatbot created
content:
application/json:
schema:
$ref: '#/components/schemas/ChatBot'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/chatbots/{botId}:
get:
summary: Info for a specific chatbot
operationId: showBotById
tags:
- chatbots
parameters:
- name: botId
in: path
required: true
description: The id of the chatbot to retrieve
schema:
type: string
responses:
'200':
description: The chatbot
content:
application/json:
schema:
$ref: '#/components/schemas/ChatBot'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/chatbots/{botId}/generate-response:
post:
summary: This will generate a chatbot response.
operationId: generateResponse
tags:
- chatbots
- message
parameters:
- name: botId
in: path
required: true
description: The unique name of the chatbot to retrieve
schema:
type: string
requestBody:
description: The query
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BotQuery'
responses:
'200':
description: The chatbot's reponse
content:
application/json:
schema:
$ref: '#/components/schemas/BotResponse'
default:
description: unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
ChatBot:
description: A chatbot. Can be used to generate responses from messages.
type: object
required:
- id
- tokensLimit
- availabily
properties:
id:
description: unique name of the bot
type: string
tokensLimit:
description: max number of tokens that can be processed by the bot in a single query
type: integer
format: int64
availabily:
description: The availability of the bots to returns
type: string
enum: [public, on-demand, private]
ChatBots:
type: array
maxItems: 100
items:
$ref: '#/components/schemas/ChatBot'
BotQuery:
type: object
required:
- queryMessage
properties:
queryMessage:
type: string
maxLength: 1000
example: Hello, how are you?
BotResponse:
type: object
required:
- responseMessage
properties:
responseMessage:
type: string
maxLength: 1000
example: I'm fine, thank you!
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment