From 51e1de6fb7a226abdb91004558aa632d8d3fe38b Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 20 Feb 2024 19:15:16 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20remove=20hardcoded=20path=20from?= =?UTF-8?q?=20HF=20Inference=20API=20provider?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/llm/llms/HuggingFaceInferenceAPI.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/core/llm/llms/HuggingFaceInferenceAPI.ts b/core/llm/llms/HuggingFaceInferenceAPI.ts index ba6286b95..d6de99445 100644 --- a/core/llm/llms/HuggingFaceInferenceAPI.ts +++ b/core/llm/llms/HuggingFaceInferenceAPI.ts @@ -12,17 +12,14 @@ class HuggingFaceInferenceAPI extends BaseLLM { prompt: string, options: CompletionOptions ): AsyncGenerator { - const response = await this.fetch( - `${this.apiBase}/models/${options.model}`, - { - headers: { Authorization: `Bearer ${this.apiKey}` }, - method: "POST", - body: JSON.stringify({ - inputs: prompt, - stream: true, - }), - } - ); + const response = await this.fetch(`${this.apiBase}`, { + headers: { Authorization: `Bearer ${this.apiKey}` }, + method: "POST", + body: JSON.stringify({ + inputs: prompt, + stream: true, + }), + }); for await (const chunk of streamResponse(response)) { yield chunk; }