Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: Added the description for the new endpoints #724

Merged
merged 6 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.",
louis-jan marked this conversation as resolved.
Show resolved Hide resolved
})
@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
Loading