Merge pull request #5428 from continuedev/dallin/tei-api-key-yohannze
@yohannze Huggingface TEI apiKey fix
This commit is contained in:
commit
2f24dfe30f
2 changed files with 12 additions and 4 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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>"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue