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

fix: wrong engine list #890

Merged
merged 3 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class EnginesGetCommand extends CommandRunner {
} else {
console.table({
...engine,
name: EngineNamesMap[engine.name as Engines],
name: EngineNamesMap[engine.name as Engines] || engine.name,
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CommandRunner, SubCommand } from 'nest-commander';
import { SetCommandContext } from '../decorators/CommandContext';
import { ContextService } from '@/infrastructure/services/context/context.service';
import { EnginesUsecases } from '@/usecases/engines/engines.usecase';
import { EngineNamesMap, Engines } from '../types/engine.interface';
import { EngineNamesMap } from '../types/engine.interface';

@SubCommand({
name: 'list',
Expand All @@ -21,7 +21,7 @@ export class EnginesListCommand extends CommandRunner {
return this.enginesUsecases.getEngines().then((engines) => {
const enginesTable = engines.map((engine) => ({
...engine,
name: EngineNamesMap[engine.name as Engines],
name: EngineNamesMap[engine.name as string] || engine.name,
}));
console.table(enginesTable);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { Module } from '@nestjs/common';
import CortexProvider from './cortex.provider';
import { HttpModule } from '@nestjs/axios';
import { FileManagerModule } from '@/infrastructure/services/file-manager/file-manager.module';
import Onnxprovider from './onnx.provider';
import LlamaCPPProvider from './llamacpp.provider';
import TensorrtLLMProvider from './tensorrtllm.provider';

@Module({
imports: [HttpModule, FileManagerModule],
Expand All @@ -10,12 +13,18 @@ import { FileManagerModule } from '@/infrastructure/services/file-manager/file-m
provide: 'CORTEX_PROVIDER',
useClass: CortexProvider,
},
Onnxprovider,
LlamaCPPProvider,
TensorrtLLMProvider,
],
exports: [
{
provide: 'CORTEX_PROVIDER',
useClass: CortexProvider,
},
Onnxprovider,
LlamaCPPProvider,
TensorrtLLMProvider,
],
})
export class CortexProviderModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Injectable } from '@nestjs/common';
import CortexProvider from './cortex.provider';

@Injectable()
export default class LlamaCPPProvider extends CortexProvider {
productName = 'LlamaCPP Inference Engine';
description =
'This extension enables chat completion API calls using the LlamaCPP engine';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Injectable } from '@nestjs/common';
import CortexProvider from './cortex.provider';

@Injectable()
export default class Onnxprovider extends CortexProvider {
productName = 'Onnx Inference Engine';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, please set name here

description =
'This extension enables chat completion API calls using the Onnx engine';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Injectable } from '@nestjs/common';
import CortexProvider from './cortex.provider';

@Injectable()
export default class TensorrtLLMProvider extends CortexProvider {
productName = 'TensorrtLLM Inference Engine';
description =
'This extension enables chat completion API calls using the TensorrtLLM engine';
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import { FileManagerService } from '@/infrastructure/services/file-manager/file-
import { existsSync } from 'fs';
import { Engines } from '@/infrastructure/commanders/types/engine.interface';
import { OAIEngineExtension } from '@/domain/abstracts/oai.abstract';
import CortexProvider from '@/infrastructure/providers/cortex/cortex.provider';
import { HttpService } from '@nestjs/axios';
import LlamaCPPProvider from '@/infrastructure/providers/cortex/llamacpp.provider';
import Onnxprovider from '@/infrastructure/providers/cortex/onnx.provider';
import TensorrtLLMProvider from '@/infrastructure/providers/cortex/tensorrtllm.provider';

@Injectable()
export class ExtensionRepositoryImpl implements ExtensionRepository {
Expand Down Expand Up @@ -44,7 +46,7 @@ export class ExtensionRepositoryImpl implements ExtensionRepository {
}

private async loadCoreExtensions() {
const llamaCPPEngine = new CortexProvider(
const llamaCPPEngine = new LlamaCPPProvider(
this.httpService,
this.fileManagerService,
);
Expand All @@ -56,7 +58,7 @@ export class ExtensionRepositoryImpl implements ExtensionRepository {
),
);

const onnxEngine = new CortexProvider(
const onnxEngine = new Onnxprovider(
this.httpService,
this.fileManagerService,
);
Expand All @@ -68,7 +70,7 @@ export class ExtensionRepositoryImpl implements ExtensionRepository {
),
);

const tensorrtLLMEngine = new CortexProvider(
const tensorrtLLMEngine = new TensorrtLLMProvider(
this.httpService,
this.fileManagerService,
);
Expand Down
Loading