File size: 676 Bytes
a6f8f24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
with open("gateway.py", "r") as f:
    code = f.read()

# So `llama-swap` is run WITHOUT `env -u`. It inherits `API_KEY`!
# `llama-swap` therefore expects an API Key for authentication if the environment variable `API_KEY` is present.
# My latest commit sets `llama_auth_headers()` to:
# ```python
# def llama_auth_headers() -> dict[str, str]:
#     internal_key = LLAMA_API_KEY or API_KEY
#     if internal_key:
#         return {"Authorization": f"Bearer {internal_key}"}
#     return {}
# ```
# It IS sending `Authorization: Bearer <API_KEY>`!
# Why does `llama-swap` reject it?
# Let's write a python script to hit `llama-swap` directly in the container to figure it out!