mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
add fix to HF endpoint
This commit is contained in:
@@ -30,12 +30,11 @@ export class HuggingFaceInferenceEmbeddings extends Embeddings implements Huggin
|
||||
async _embed(texts: string[]): Promise<number[][]> {
|
||||
// replace newlines, which can negatively affect performance.
|
||||
const clean = texts.map((text) => text.replace(/\n/g, ' '))
|
||||
return this.caller.call(() =>
|
||||
this.client.featureExtraction({
|
||||
model: this.model,
|
||||
inputs: clean
|
||||
})
|
||||
) as Promise<number[][]>
|
||||
const obj: any = {
|
||||
inputs: clean
|
||||
}
|
||||
if (!this.endpoint) obj.model = this.model
|
||||
return this.caller.call(() => this.client.featureExtraction(obj)) as Promise<number[][]>
|
||||
}
|
||||
|
||||
embedQuery(document: string): Promise<number[]> {
|
||||
|
||||
Reference in New Issue
Block a user