-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat-adding-embedding-config' of https://github.com/Sma…
…1lboy/codefox into feat-adding-embedding-config
- Loading branch information
Showing
11 changed files
with
12,049 additions
and
14,832 deletions.
There are no files selected for viewing
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
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
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 |
---|---|---|
@@ -1,29 +1,27 @@ | ||
import { Logger } from '@nestjs/common'; | ||
import { EmbeddingModel} from "fastembed"; | ||
import { EmbeddingModel } from 'fastembed'; | ||
import { EmbeddingDownloader } from 'src/downloader/embedding-downloader'; | ||
|
||
export class localEmbProvider { | ||
private static logger = new Logger(localEmbProvider.name); | ||
|
||
static async generateEmbResponse( | ||
model: string, message: string[] | ||
){ | ||
let embLoader = EmbeddingDownloader.getInstance(); | ||
try{ | ||
static async generateEmbResponse(model: string, message: string[]) { | ||
const embLoader = EmbeddingDownloader.getInstance(); | ||
try { | ||
const embeddingModel = await embLoader.getPipeline(model); | ||
const embeddings = embeddingModel.embed(message); | ||
|
||
for await (const batch of embeddings) { | ||
console.log(batch); | ||
} | ||
}catch(error){ | ||
} catch (error) { | ||
this.logger.log(`error when using ${model} api`); | ||
} | ||
} | ||
|
||
static async getEmbList() { | ||
Object.values(EmbeddingModel).forEach((model) => { | ||
this.logger.log(model); | ||
}) | ||
}); | ||
} | ||
} |
Oops, something went wrong.