Skip to content

Commit

Permalink
API: Added the description
Browse files Browse the repository at this point in the history
  • Loading branch information
irfanpena committed Jun 18, 2024
1 parent 4e7a8ab commit 86e6444
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
10 changes: 9 additions & 1 deletion cortex-js/src/infrastructure/controllers/events.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { DownloadManagerService } from '@/download-manager/download-manager.serv
import { ModelsUsecases } from '@/usecases/models/models.usecases';
import { Controller, Sse } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { ApiTags } from '@nestjs/swagger';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
import {
Observable,
combineLatest,
Expand All @@ -34,6 +34,10 @@ export class EventsController {
private readonly eventEmitter: EventEmitter2,
) {}

@ApiOperation({
summary: 'Get download status',
description: "Retrieves the model's download status.",
})
@Sse('download')
downloadEvent(): Observable<DownloadStateEvent> {
const latestDownloadState$: Observable<DownloadStateEvent> = of({
Expand All @@ -60,6 +64,10 @@ export class EventsController {
).pipe();
}

@ApiOperation({
summary: 'Get model status',
description: 'Retrieves all the available model statuses within Cortex.',
})
@Sse('model')
modelEvent(): Observable<ModelStatusAndEvent> {
const latestModelStatus$: Observable<Record<ModelId, ModelStatus>> = of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class ProcessController {

@ApiOperation({
summary: 'Terminate service',
description: 'Terminate service endpoint',
description: 'Terminates the Cortex API endpoint server for the detached mode.',
})
@Delete()
async delete() {
Expand Down
4 changes: 2 additions & 2 deletions cortex-js/src/infrastructure/controllers/status.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export class StatusController {
constructor() {}

@ApiOperation({
summary: 'Health check',
description: 'Health check endpoint.',
summary: "Get health status",
description: "Retrieves the health status of your Cortex's system.",
})
@HttpCode(200)
@ApiResponse({
Expand Down
12 changes: 12 additions & 0 deletions cortex-js/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ async function bootstrap() {
'Embeddings',
'Endpoint for creating and retrieving embedding vectors from text inputs using specified models.',
)
.addTag(
'Status',
"Endpoint for actively querying the health status of the Cortex.",
)
.addTag(
'Processes',
'Endpoint for terminating the Cortex API server processes.',
)
.addTag(
'Events',
'Endpoints for observing Cortex statuses through event notifications.',
)
.addServer('http://localhost:1337')
.addServer('http://localhost:1337/v1')
.build();
Expand Down

0 comments on commit 86e6444

Please sign in to comment.