ai-core-api-client/docs/swagger.json
2024-08-27 18:43:29 +03:00

803 lines
25 KiB
JSON

{
"schemes": [],
"swagger": "2.0",
"info": {
"description": "This API gives you the ability to interact with AISF's neural networks",
"title": "AISF API",
"contact": {},
"version": "1.0"
},
"host": "",
"basePath": "/api/v1",
"paths": {
"/chats": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "This endpoint returns all client chats of company.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"chats"
],
"summary": "Get all client chats of company",
"parameters": [
{
"type": "integer",
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Limit of chats per page",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.GetChatsResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
}
}
}
},
"/company": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "This endpoint returns a list of all companies in the database",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"company"
],
"summary": "Returns a list of companies",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.Company"
}
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "This endpoint creates a new company record in the database.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"company"
],
"summary": "Adds a company to the database",
"parameters": [
{
"description": "Company Create Request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/domain.CompanyCreateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.SuccessResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
}
}
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "This endpoint update a company record in the database.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"company"
],
"summary": "Update a company in the database",
"parameters": [
{
"description": "Company Update Request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/domain.CompanyUpdateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.SuccessResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
}
}
}
},
"/company/{id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "This endpoint returns details of a specific company by its ID in the database.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"company"
],
"summary": "Get company details",
"parameters": [
{
"type": "string",
"description": "Company ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.Company"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
}
}
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "This endpoint removes the company from the database.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"company"
],
"summary": "Delete company from the database",
"parameters": [
{
"type": "string",
"description": "Company ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.SuccessResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
}
}
}
},
"/conversation": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "This endpoint generates a response from an AI model based on the provided conversation.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"ai"
],
"summary": "Generate response from AI model",
"parameters": [
{
"description": "Conversation Request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/domain.ConversationRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.ConversationResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
}
}
}
},
"/get-me": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "This endpoint returns details of a specific company by its tokeb in the database.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"get-me"
],
"summary": "Get company details",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.GetMeResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
}
}
}
},
"/metrics": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "This endpoint returns metrics of a specific company by its token in the database.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"metrics"
],
"summary": "Get company metrics",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.MetricsResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/domain.ErrorResponse"
}
}
}
}
}
},
"definitions": {
"domain.AIFunction": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"parameters": {
"$ref": "#/definitions/domain.AIFunctionParameters"
}
}
},
"domain.AIFunctionCall": {
"type": "object",
"properties": {
"arguments": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"domain.AIFunctionParameterProperty": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"domain.AIFunctionParameters": {
"type": "object",
"properties": {
"properties": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/domain.AIFunctionParameterProperty"
}
},
"required": {
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"type": "string"
}
}
},
"domain.AIMessage": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"role": {
"type": "string"
}
}
},
"domain.AITool": {
"type": "object",
"properties": {
"function": {
"$ref": "#/definitions/domain.AIFunctionCall"
},
"id": {
"type": "string"
},
"index": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"domain.ClientChat": {
"type": "object",
"properties": {
"client_id": {
"type": "integer"
},
"messages": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.ClientMessage"
}
}
}
},
"domain.ClientMessage": {
"type": "object",
"properties": {
"client_id": {
"type": "integer"
},
"content": {
"type": "string"
},
"date": {
"type": "string"
},
"event_id": {
"type": "integer"
},
"message_id": {
"type": "integer"
}
}
},
"domain.Company": {
"type": "object",
"properties": {
"functions": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.CompanyFunction"
}
},
"id": {
"type": "string"
},
"integration_url": {
"type": "string"
},
"name": {
"type": "string"
},
"prompt_blocks": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.PromptBlock"
}
},
"token": {
"type": "string"
}
}
},
"domain.CompanyCreateRequest": {
"type": "object",
"required": [
"integration_url",
"name",
"token"
],
"properties": {
"functions": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.CompanyFunction"
}
},
"integration_url": {
"type": "string"
},
"name": {
"type": "string"
},
"prompt_blocks": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.PromptBlock"
}
},
"token": {
"type": "string"
}
}
},
"domain.CompanyFunction": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"level": {
"type": "integer"
},
"name": {
"type": "string"
}
}
},
"domain.CompanyUpdateRequest": {
"type": "object",
"required": [
"id"
],
"properties": {
"functions": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.CompanyFunction"
}
},
"id": {
"type": "string"
},
"integration_url": {
"type": "string"
},
"name": {
"type": "string"
},
"prompt_blocks": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.PromptBlock"
}
},
"token": {
"type": "string"
}
}
},
"domain.ConversationRequest": {
"type": "object",
"required": [
"messages",
"model"
],
"properties": {
"functions": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.AIFunction"
}
},
"messages": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.AIMessage"
}
},
"model": {
"type": "string"
}
}
},
"domain.ConversationResponse": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"tools": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.AITool"
}
}
}
},
"domain.ErrorResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"domain.GetChatsResponse": {
"type": "object",
"properties": {
"chats": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.ClientChat"
}
}
}
},
"domain.GetMeResponse": {
"type": "object",
"properties": {
"functions": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.CompanyFunction"
}
},
"id": {
"type": "string"
},
"level": {
"type": "integer"
},
"name": {
"type": "string"
},
"prompt_blocks": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.PromptBlock"
}
}
}
},
"domain.MetricsResponse": {
"type": "object",
"properties": {
"dialog_count": {
"type": "integer"
},
"message_count_per_day": {
"type": "integer"
},
"messsage_count_per_month": {
"type": "integer"
}
}
},
"domain.PromptBlock": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"domain.SuccessResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"BearerAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}