Skip to content

Commit

Permalink
Update the URL and API desc (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
irfanpena authored Jun 28, 2024
1 parent cc5d7ce commit bd8968a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
11 changes: 9 additions & 2 deletions cortex-js/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ export class ModelsController {
}

@ApiOperation({
summary: 'Abort model download',
description: 'Abort the model download operation.',
parameters: [
{
in: 'path',
Expand All @@ -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.',
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ export class CreateChatCompletionDto {

@ApiProperty({
description: 'The unique identifier of the model.',
example: 'gpt-4',
})
@IsString()
model: string;

@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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -61,20 +66,23 @@ export class CreateChatCompletionDto {
@ApiProperty({
description:
'Reduces the likelihood of repeating tokens, promoting novelty in the output.',
example: 0.6,
})
@IsOptional()
@IsNumber()
presence_penalty?: number;

@ApiProperty({
description: "Influences the randomness of the model's output.",
example: 0.8,
})
@IsOptional()
@IsNumber()
temperature?: number;

@ApiProperty({
description: 'Sets probability threshold for more relevant outputs.',
example: 0.95,
})
@IsOptional()
@IsNumber()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions cortex-js/src/infrastructure/dtos/engines/engines.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class EngineDto implements Partial<Extension> {
@ApiProperty({
type: String,
example: 'Cortex',
description: 'The display name of the engine',
description: 'The display name of the engine.',
})
@IsString()
@IsOptional()
Expand All @@ -25,7 +25,7 @@ export class EngineDto implements Partial<Extension> {
@ApiProperty({
type: String,
example: 'Cortex engine',
description: 'The description of the engine',
description: 'The description of the engine.',
})
@IsString()
@IsOptional()
Expand All @@ -34,7 +34,7 @@ export class EngineDto implements Partial<Extension> {
@ApiProperty({
type: String,
example: '0.0.1',
description: 'The version of the engine',
description: 'The version of the engine.',
})
@IsString()
@IsOptional()
Expand Down

0 comments on commit bd8968a

Please sign in to comment.