Merge pull request #5428 from continuedev/dallin/tei-api-key-yohannze

@yohannze Huggingface TEI apiKey fix
This commit is contained in:
Nate Sesti 2025-04-29 15:12:56 -07:00 • committed by GitHub
commit 2f24dfe30f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View file

@ -35,14 +35,20 @@ class HuggingFaceTEIEmbeddingsProvider extends BaseLLM {
}
async doEmbedRequest(batch: string[]): Promise<number[][]> {
const headers: Record<string, string> = {
"Content-Type": "application/json",
};
if (this.apiKey) {
headers["Authorization"] = `Bearer ${this.apiKey}`;
}
const resp = await this.fetch(new URL("embed", this.apiBase), {
method: "POST",
body: JSON.stringify({
inputs: batch,
}),
headers: {
"Content-Type": "application/json",
},
headers,
});
if (!resp.ok) {
const text = await resp.text();

View file

@ -100,6 +100,7 @@ See [here](../model-providers/top-level/ollama.mdx#embeddings-model) for instruc
- name: Huggingface TEI Embedder
provider: huggingface-tei
apiBase: http://localhost:8080
apiKey: <YOUR_TEI_API_KEY>
roles: [embed]
```
</TabItem>
@ -108,7 +109,8 @@ See [here](../model-providers/top-level/ollama.mdx#embeddings-model) for instruc
{
"embeddingsProvider": {
"provider": "huggingface-tei",
"apiBase": "http://localhost:8080"
"apiBase": "http://localhost:8080",
"apiKey": "<YOUR_TEI_API_KEY>"
}
}
```