add ability to specify custom http headers in api endpoint (#386)

This commit is contained in:
Adil Hafeez 2025-02-06 11:48:09 -08:00 committed by GitHub
parent e82f8f216f
commit 2bd61d628c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 179 additions and 10 deletions

View file

@ -89,6 +89,18 @@ def get_llm_provider_access_keys(arch_config_file):
if acess_key is not None:
access_key_list.append(acess_key)
for prompt_target in arch_config_yaml.get("prompt_targets", []):
for k, v in prompt_target.get("endpoint", {}).get("http_headers", {}).items():
if k.lower() == "authorization":
print(
f"found auth header: {k} for prompt_target: {prompt_target.get('name')}/{prompt_target.get('endpoint').get('name')}"
)
auth_tokens = v.split(" ")
if len(auth_tokens) > 1:
access_key_list.append(auth_tokens[1])
else:
access_key_list.append(v)
return access_key_list