From ae71c83adc4b690c1266d24fa40c8bcf237f8f7b Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 20 Feb 2024 22:01:34 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20add=20json=20headers=20to=20hf?= =?UTF-8?q?=20inference=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/llm/llms/HuggingFaceInferenceAPI.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/llm/llms/HuggingFaceInferenceAPI.ts b/core/llm/llms/HuggingFaceInferenceAPI.ts index d6de99445..9edb29568 100644 --- a/core/llm/llms/HuggingFaceInferenceAPI.ts +++ b/core/llm/llms/HuggingFaceInferenceAPI.ts @@ -13,7 +13,11 @@ class HuggingFaceInferenceAPI extends BaseLLM { options: CompletionOptions ): AsyncGenerator { const response = await this.fetch(`${this.apiBase}`, { - headers: { Authorization: `Bearer ${this.apiKey}` }, + headers: { + Authorization: `Bearer ${this.apiKey}`, + "Content-Type": "application/json", + Accept: "application/json", + }, method: "POST", body: JSON.stringify({ inputs: prompt,