-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #578 from janhq/chore/remove-start-cortex-cli
chore: remove start cortex cli command
- Loading branch information
Showing
30 changed files
with
596 additions
and
353 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
EXTENSIONS_PATH=<EXTENSIONS_PATH> | ||
CORTEX_MODELS_DIR=<CORTEX_MODELS_DIR> | ||
CORTEX_BINARY_PATH=<CORTEX_BINARY_PATH> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
export interface HuggingFaceRepoData { | ||
id: string; | ||
modelId: string; | ||
modelUrl?: string; | ||
author: string; | ||
sha: string; | ||
downloads: number; | ||
lastModified: string; | ||
private: boolean; | ||
disabled: boolean; | ||
gated: boolean; | ||
pipeline_tag: 'text-generation'; | ||
tags: Array<'transformers' | 'pytorch' | 'safetensors' | string>; | ||
cardData: Record<CardDataKeys | string, unknown>; | ||
siblings: { | ||
rfilename: string; | ||
downloadUrl?: string; | ||
fileSize?: number; | ||
quantization?: Quantization; | ||
stopWord?: string; | ||
}[]; | ||
createdAt: string; | ||
} | ||
|
||
const CardDataKeys = [ | ||
'base_model', | ||
'datasets', | ||
'inference', | ||
'language', | ||
'library_name', | ||
'license', | ||
'model_creator', | ||
'model_name', | ||
'model_type', | ||
'pipeline_tag', | ||
'prompt_template', | ||
'quantized_by', | ||
'tags', | ||
] as const; | ||
export type CardDataKeysTuple = typeof CardDataKeys; | ||
export type CardDataKeys = CardDataKeysTuple[number]; | ||
|
||
export const AllQuantizations = [ | ||
'Q3_K_S', | ||
'Q3_K_M', | ||
'Q3_K_L', | ||
'Q4_K_S', | ||
'Q4_K_M', | ||
'Q5_K_S', | ||
'Q5_K_M', | ||
'Q4_0', | ||
'Q4_1', | ||
'Q5_0', | ||
'Q5_1', | ||
'IQ2_XXS', | ||
'IQ2_XS', | ||
'Q2_K', | ||
'Q2_K_S', | ||
'Q6_K', | ||
'Q8_0', | ||
'F16', | ||
'F32', | ||
'COPY', | ||
]; | ||
export type QuantizationsTuple = typeof AllQuantizations; | ||
export type Quantization = QuantizationsTuple[number]; |
61 changes: 0 additions & 61 deletions
61
cortex-js/src/infrastructure/commanders/basic-command.commander.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,41 @@ | ||
import { ChatUsecases } from '@/usecases/chat/chat.usecases'; | ||
import { CommandRunner, SubCommand } from 'nest-commander'; | ||
import { CommandRunner, SubCommand, Option } from 'nest-commander'; | ||
import { ChatCliUsecases } from './usecases/chat.cli.usecases'; | ||
import { CortexUsecases } from '@/usecases/cortex/cortex.usecases'; | ||
import { exit } from 'node:process'; | ||
|
||
@SubCommand({ name: 'chat' }) | ||
type ChatOptions = { | ||
model?: string; | ||
}; | ||
|
||
@SubCommand({ name: 'chat', description: 'Start a chat with a model' }) | ||
export class ChatCommand extends CommandRunner { | ||
constructor(private readonly chatUsecases: ChatUsecases) { | ||
constructor( | ||
private readonly chatUsecases: ChatUsecases, | ||
private readonly cortexUsecases: CortexUsecases, | ||
) { | ||
super(); | ||
} | ||
|
||
async run(input: string[]): Promise<void> { | ||
const chatCliService = new ChatCliUsecases(this.chatUsecases); | ||
return chatCliService.run(input); | ||
async run(_input: string[], option: ChatOptions): Promise<void> { | ||
const modelId = option.model; | ||
if (!modelId) { | ||
console.error('Model ID is required'); | ||
exit(1); | ||
} | ||
|
||
const chatCliUsecases = new ChatCliUsecases( | ||
this.chatUsecases, | ||
this.cortexUsecases, | ||
); | ||
return chatCliUsecases.chat(modelId); | ||
} | ||
|
||
@Option({ | ||
flags: '--model <model_id>', | ||
description: 'Model Id to start chat with', | ||
}) | ||
parseModelId(value: string) { | ||
return value; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
cortex-js/src/infrastructure/commanders/cortex-command.commander.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { RootCommand, CommandRunner } from 'nest-commander'; | ||
import { ServeCommand } from './serve.command'; | ||
import { ChatCommand } from './chat.command'; | ||
import { ModelsCommand } from './models.command'; | ||
import { InitCommand } from './init.command'; | ||
import { RunCommand } from './shortcuts/run.command'; | ||
|
||
@RootCommand({ | ||
subCommands: [ | ||
ModelsCommand, | ||
ServeCommand, | ||
ChatCommand, | ||
InitCommand, | ||
RunCommand, | ||
], | ||
description: 'Cortex CLI', | ||
}) | ||
export class CortexCommand extends CommandRunner { | ||
async run(): Promise<void> {} | ||
} |
Oops, something went wrong.