🐛 add json headers to hf inference api

This commit is contained in:
Nate Sesti 2024-02-20 22:01:34 -08:00
parent a4c643bb20
commit ae71c83adc

View file

@ -13,7 +13,11 @@ class HuggingFaceInferenceAPI extends BaseLLM {
options: CompletionOptions
): AsyncGenerator<string> {
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,