mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-10-21 14:58:15 +00:00
feat(hf-transformer): dynamically load library
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { Embeddings, type EmbeddingsParams } from '@langchain/core/embeddings';
|
||||
import { chunkArray } from '@langchain/core/utils/chunk_array';
|
||||
import { pipeline } from '@huggingface/transformers';
|
||||
|
||||
export interface HuggingFaceTransformersEmbeddingsParams
|
||||
extends EmbeddingsParams {
|
||||
@@ -68,6 +67,7 @@ export class HuggingFaceTransformersEmbeddings
|
||||
}
|
||||
|
||||
private async runEmbedding(texts: string[]) {
|
||||
const { pipeline } = await import('@huggingface/transformers');
|
||||
const pipe = await pipeline('feature-extraction', this.model);
|
||||
|
||||
return this.caller.call(async () => {
|
||||
|
Reference in New Issue
Block a user