mirror of
https://github.com/katanemo/plano.git
synced 2026-04-25 00:36:34 +02:00
Merge b85fab8696 into 22f332f62d
This commit is contained in:
commit
ca4a82533e
4 changed files with 22 additions and 0 deletions
|
|
@ -177,6 +177,11 @@ properties:
|
||||||
passthrough_auth:
|
passthrough_auth:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: "When true, forwards the client's Authorization header to upstream instead of using the configured access_key. Useful for routing to services like LiteLLM that validate their own virtual keys."
|
description: "When true, forwards the client's Authorization header to upstream instead of using the configured access_key. Useful for routing to services like LiteLLM that validate their own virtual keys."
|
||||||
|
http_headers:
|
||||||
|
type: object
|
||||||
|
description: "Custom HTTP headers to include in requests to this LLM provider. Useful for providers requiring non-standard authentication or telemetry headers."
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
http_host:
|
http_host:
|
||||||
type: string
|
type: string
|
||||||
provider_interface:
|
provider_interface:
|
||||||
|
|
@ -226,6 +231,11 @@ properties:
|
||||||
passthrough_auth:
|
passthrough_auth:
|
||||||
type: boolean
|
type: boolean
|
||||||
description: "When true, forwards the client's Authorization header to upstream instead of using the configured access_key. Useful for routing to services like LiteLLM that validate their own virtual keys."
|
description: "When true, forwards the client's Authorization header to upstream instead of using the configured access_key. Useful for routing to services like LiteLLM that validate their own virtual keys."
|
||||||
|
http_headers:
|
||||||
|
type: object
|
||||||
|
description: "Custom HTTP headers to include in requests to this LLM provider. Useful for providers requiring non-standard authentication or telemetry headers."
|
||||||
|
additionalProperties:
|
||||||
|
type: string
|
||||||
http_host:
|
http_host:
|
||||||
type: string
|
type: string
|
||||||
provider_interface:
|
provider_interface:
|
||||||
|
|
|
||||||
|
|
@ -481,6 +481,7 @@ pub struct LlmProvider {
|
||||||
pub base_url_path_prefix: Option<String>,
|
pub base_url_path_prefix: Option<String>,
|
||||||
pub internal: Option<bool>,
|
pub internal: Option<bool>,
|
||||||
pub passthrough_auth: Option<bool>,
|
pub passthrough_auth: Option<bool>,
|
||||||
|
pub http_headers: Option<HashMap<String, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait IntoModels {
|
pub trait IntoModels {
|
||||||
|
|
@ -524,6 +525,7 @@ impl Default for LlmProvider {
|
||||||
base_url_path_prefix: None,
|
base_url_path_prefix: None,
|
||||||
internal: None,
|
internal: None,
|
||||||
passthrough_auth: None,
|
passthrough_auth: None,
|
||||||
|
http_headers: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -277,6 +277,7 @@ mod tests {
|
||||||
internal: None,
|
internal: None,
|
||||||
stream: None,
|
stream: None,
|
||||||
passthrough_auth: None,
|
passthrough_auth: None,
|
||||||
|
http_headers: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,14 @@ impl StreamContext {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_custom_provider_headers(&mut self) {
|
||||||
|
if let Some(http_headers) = self.llm_provider().http_headers.clone() {
|
||||||
|
for (key, value) in &http_headers {
|
||||||
|
self.set_http_request_header(key.as_str(), Some(value.as_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn delete_content_length_header(&mut self) {
|
fn delete_content_length_header(&mut self) {
|
||||||
// Remove the Content-Length header because further body manipulations in the gateway logic will invalidate it.
|
// Remove the Content-Length header because further body manipulations in the gateway logic will invalidate it.
|
||||||
// Server's generally throw away requests whose body length do not match the Content-Length header.
|
// Server's generally throw away requests whose body length do not match the Content-Length header.
|
||||||
|
|
@ -891,6 +899,7 @@ impl HttpContext for StreamContext {
|
||||||
self.send_server_error(error, Some(StatusCode::BAD_REQUEST));
|
self.send_server_error(error, Some(StatusCode::BAD_REQUEST));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.set_custom_provider_headers();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.delete_content_length_header();
|
self.delete_content_length_header();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue