Skip to content

Commit cec9634

Browse files
authored
Fix authorization header setup logic in text embeddings inference (#19979)
1 parent e64cec7 commit cec9634

File tree

2 files changed

+4
-3
lines changed
  • llama-index-integrations/embeddings/llama-index-embeddings-text-embeddings-inference

2 files changed

+4
-3
lines changed

llama-index-integrations/embeddings/llama-index-embeddings-text-embeddings-inference/llama_index/embeddings/text_embeddings_inference/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@ async def _acall_api(self, texts: List[str]) -> List[List[float]]:
100100
headers = {"Content-Type": "application/json"}
101101
if self.auth_token is not None:
102102
if callable(self.auth_token):
103-
headers["Authorization"] = self.auth_token(self.base_url)
103+
auth_token = self.auth_token(self.base_url)
104104
else:
105-
headers["Authorization"] = self.auth_token
105+
auth_token = self.auth_token
106+
headers["Authorization"] = f"Bearer {auth_token}"
106107
json_data = {"inputs": texts, "truncate": self.truncate_text}
107108

108109
async with httpx.AsyncClient() as client:

llama-index-integrations/embeddings/llama-index-embeddings-text-embeddings-inference/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ dev = [
2626

2727
[project]
2828
name = "llama-index-embeddings-text-embeddings-inference"
29-
version = "0.4.1"
29+
version = "0.4.2"
3030
description = "llama-index embeddings text embeddings inference integration"
3131
authors = [{name = "Your Name", email = "[email protected]"}]
3232
requires-python = ">=3.9,<4.0"

0 commit comments

Comments
 (0)