🐛 remove hardcoded path from HF Inference API provider
This commit is contained in:
parent
ce36f0f030
commit
51e1de6fb7
1 changed files with 8 additions and 11 deletions
|
|
@ -12,17 +12,14 @@ class HuggingFaceInferenceAPI extends BaseLLM {
|
|||
prompt: string,
|
||||
options: CompletionOptions
|
||||
): AsyncGenerator<string> {
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue