Skip to content

Commit 1330206

Browse files
JAORMXblkt
authored andcommitted
Handle API key for ollama servers (#1257)
This was missed. Signed-off-by: Juan Antonio Osorio <[email protected]>
1 parent b155aa5 commit 1330206

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/codegate/types/ollama/_generators.py

+5
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,18 @@ async def generate_streaming(request, api_key, base_url):
5555

5656

5757
async def streaming(request, api_key, url, cls):
58+
headers = dict()
59+
60+
if api_key:
61+
headers["Authorization"] = f"Bearer {api_key}"
5862
payload = request.json(exclude_defaults=True)
5963
if os.getenv("CODEGATE_DEBUG_OLLAMA") is not None:
6064
print(payload)
6165

6266
client = httpx.AsyncClient()
6367
async with client.stream(
6468
"POST", url,
69+
headers=headers,
6570
content=payload,
6671
timeout=300, # TODO this should not be hardcoded
6772
) as resp:

0 commit comments

Comments
 (0)