mirror of
https://github.com/katanemo/plano.git
synced 2026-06-26 15:39:40 +02:00
add ability to specify custom http headers in api endpoint (#386)
This commit is contained in:
parent
e82f8f216f
commit
2bd61d628c
11 changed files with 179 additions and 10 deletions
|
|
@ -135,6 +135,10 @@ properties:
|
|||
enum:
|
||||
- GET
|
||||
- POST
|
||||
http_headers:
|
||||
type: object
|
||||
additionalProperties:
|
||||
type: string
|
||||
additionalProperties: false
|
||||
required:
|
||||
- name
|
||||
|
|
|
|||
|
|
@ -486,14 +486,14 @@ static_resources:
|
|||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
|
||||
sni: api.mistral.ai
|
||||
{% for internal_clustrer in ["arch_fc", "model_server"] %}
|
||||
- name: {{ internal_clustrer }}
|
||||
{% for internal_cluster in ["arch_fc", "model_server"] %}
|
||||
- name: {{ internal_cluster }}
|
||||
connect_timeout: 5s
|
||||
type: STRICT_DNS
|
||||
dns_lookup_family: V4_ONLY
|
||||
lb_policy: ROUND_ROBIN
|
||||
load_assignment:
|
||||
cluster_name: {{ internal_clustrer }}
|
||||
cluster_name: {{ internal_cluster }}
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
|
|
@ -501,7 +501,7 @@ static_resources:
|
|||
socket_address:
|
||||
address: host.docker.internal
|
||||
port_value: $MODEL_SERVER_PORT
|
||||
hostname: {{ internal_clustrer }}
|
||||
hostname: {{ internal_cluster }}
|
||||
{% endfor %}
|
||||
- name: mistral_7b_instruct
|
||||
connect_timeout: 5s
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue