From bd8968a52b2764f15c723cad3427fe7a798af32f Mon Sep 17 00:00:00 2001 From: irfanpena <137022864+irfanpena@users.noreply.github.com> Date: Fri, 28 Jun 2024 10:11:55 +0700 Subject: [PATCH] Update the URL and API desc (#785) --- cortex-js/src/app.ts | 11 +++++++++-- .../src/infrastructure/controllers/chat.controller.ts | 2 +- .../infrastructure/controllers/models.controller.ts | 4 +++- .../dtos/chat/chat-completion-message.dto.ts | 2 +- .../dtos/chat/create-chat-completion.dto.ts | 8 ++++++++ .../infrastructure/dtos/common/common-response.dto.ts | 2 +- .../src/infrastructure/dtos/engines/engines.dto.ts | 6 +++--- 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/cortex-js/src/app.ts b/cortex-js/src/app.ts index 9eb1d8d70..fd0db7123 100644 --- a/cortex-js/src/app.ts +++ b/cortex-js/src/app.ts @@ -63,10 +63,17 @@ export const getApp = async () => { ) .addTag( 'Events', - 'Endpoints for observing Cortex statuses through event notifications.', + 'Endpoints for observing Cortex statuses through event notifications.', + ) + .addTag( + 'Configurations', + "Endpoints for customizing the Cortex's configurations.", + ) + .addTag( + 'Engines', + 'Endpoints for managing the available engines within Cortex.', ) .addServer('http://localhost:1337') - .addServer('http://localhost:1337/v1') .build(); const document = SwaggerModule.createDocument(app, config); diff --git a/cortex-js/src/infrastructure/controllers/chat.controller.ts b/cortex-js/src/infrastructure/controllers/chat.controller.ts index 967e68cfa..25524bc10 100644 --- a/cortex-js/src/infrastructure/controllers/chat.controller.ts +++ b/cortex-js/src/infrastructure/controllers/chat.controller.ts @@ -12,7 +12,7 @@ export class ChatController { @ApiOperation({ summary: 'Create chat completion', - description: 'Creates a model response for the given conversation.', + description: 'Creates a model response for the given conversation. The following parameters are not working for the `TensorRT-LLM` engine:\n- `frequency_penalty`\n- `presence_penalty`\n- `top_p`', }) @HttpCode(200) @ApiResponse({ diff --git a/cortex-js/src/infrastructure/controllers/models.controller.ts b/cortex-js/src/infrastructure/controllers/models.controller.ts index 6d42e4733..7f2077525 100644 --- a/cortex-js/src/infrastructure/controllers/models.controller.ts +++ b/cortex-js/src/infrastructure/controllers/models.controller.ts @@ -115,6 +115,8 @@ export class ModelsController { } @ApiOperation({ + summary: 'Abort model download', + description: 'Abort the model download operation.', parameters: [ { in: 'path', @@ -136,7 +138,7 @@ export class ModelsController { type: DownloadModelResponseDto, }) @ApiOperation({ - summary: 'Pulls a remote model and download it', + summary: 'Download a remote model', description: 'Pulls a remote model template from cortex hub or huggingface and downloads it.', }) diff --git a/cortex-js/src/infrastructure/dtos/chat/chat-completion-message.dto.ts b/cortex-js/src/infrastructure/dtos/chat/chat-completion-message.dto.ts index 4845e1a2f..70c71b054 100644 --- a/cortex-js/src/infrastructure/dtos/chat/chat-completion-message.dto.ts +++ b/cortex-js/src/infrastructure/dtos/chat/chat-completion-message.dto.ts @@ -2,7 +2,7 @@ import { IsString } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; export class ChatCompletionMessage { - @ApiProperty({ description: 'The Content of the chat message.' }) + @ApiProperty({ description: 'The Content of the chat message.', }) @IsString() content: string; diff --git a/cortex-js/src/infrastructure/dtos/chat/create-chat-completion.dto.ts b/cortex-js/src/infrastructure/dtos/chat/create-chat-completion.dto.ts index e2ccbc542..2b215820f 100644 --- a/cortex-js/src/infrastructure/dtos/chat/create-chat-completion.dto.ts +++ b/cortex-js/src/infrastructure/dtos/chat/create-chat-completion.dto.ts @@ -22,6 +22,7 @@ export class CreateChatCompletionDto { @ApiProperty({ description: 'The unique identifier of the model.', + example: 'gpt-4', }) @IsString() model: string; @@ -29,6 +30,7 @@ export class CreateChatCompletionDto { @ApiProperty({ description: 'Determines the format for output generation. If set to `true`, the output is generated continuously, allowing for real-time streaming of responses. If set to `false`, the output is delivered in a single JSON file.', + example: true, }) @IsOptional() @IsBoolean() @@ -37,6 +39,7 @@ export class CreateChatCompletionDto { @ApiProperty({ description: 'Sets the upper limit on the number of tokens the model can generate in a single output.', + example: 4096, }) @IsOptional() @IsNumber() @@ -45,6 +48,7 @@ export class CreateChatCompletionDto { @ApiProperty({ description: 'Defines specific tokens or phrases that signal the model to stop producing further output.', + example: ["End"], }) @IsOptional() @IsArray() @@ -53,6 +57,7 @@ export class CreateChatCompletionDto { @ApiProperty({ description: 'Modifies the likelihood of the model repeating the same words or phrases within a single output.', + example: 0.2, }) @IsOptional() @IsNumber() @@ -61,6 +66,7 @@ export class CreateChatCompletionDto { @ApiProperty({ description: 'Reduces the likelihood of repeating tokens, promoting novelty in the output.', + example: 0.6, }) @IsOptional() @IsNumber() @@ -68,6 +74,7 @@ export class CreateChatCompletionDto { @ApiProperty({ description: "Influences the randomness of the model's output.", + example: 0.8, }) @IsOptional() @IsNumber() @@ -75,6 +82,7 @@ export class CreateChatCompletionDto { @ApiProperty({ description: 'Sets probability threshold for more relevant outputs.', + example: 0.95, }) @IsOptional() @IsNumber() diff --git a/cortex-js/src/infrastructure/dtos/common/common-response.dto.ts b/cortex-js/src/infrastructure/dtos/common/common-response.dto.ts index a98d1b56f..dd60f4892 100644 --- a/cortex-js/src/infrastructure/dtos/common/common-response.dto.ts +++ b/cortex-js/src/infrastructure/dtos/common/common-response.dto.ts @@ -3,7 +3,7 @@ import { IsString } from 'class-validator'; export class CommonResponseDto { @ApiProperty({ - description: 'The success or error message', + description: 'The response success or error message.', }) @IsString() message: string; diff --git a/cortex-js/src/infrastructure/dtos/engines/engines.dto.ts b/cortex-js/src/infrastructure/dtos/engines/engines.dto.ts index d222c15d1..4a1e67902 100644 --- a/cortex-js/src/infrastructure/dtos/engines/engines.dto.ts +++ b/cortex-js/src/infrastructure/dtos/engines/engines.dto.ts @@ -16,7 +16,7 @@ export class EngineDto implements Partial { @ApiProperty({ type: String, example: 'Cortex', - description: 'The display name of the engine', + description: 'The display name of the engine.', }) @IsString() @IsOptional() @@ -25,7 +25,7 @@ export class EngineDto implements Partial { @ApiProperty({ type: String, example: 'Cortex engine', - description: 'The description of the engine', + description: 'The description of the engine.', }) @IsString() @IsOptional() @@ -34,7 +34,7 @@ export class EngineDto implements Partial { @ApiProperty({ type: String, example: '0.0.1', - description: 'The version of the engine', + description: 'The version of the engine.', }) @IsString() @IsOptional()