add retry

This commit is contained in:
Adil Hafeez 2025-09-17 17:53:19 -07:00
parent 71658ddbd9
commit a3f93de85d
No known key found for this signature in database
GPG key ID: 9B18EF7691369645
7 changed files with 29 additions and 9 deletions

View file

@ -1,7 +1,7 @@
use std::collections::HashMap;
use common::configuration::{Agent, AgentPipeline};
use common::consts::ARCH_UPSTREAM_HOST_HEADER;
use common::consts::{ARCH_UPSTREAM_HOST_HEADER, ENVOY_RETRY_HEADER};
use hermesllm::apis::openai::{ChatCompletionsRequest, Message};
use hyper::header::HeaderMap;
use tracing::{debug, warn};
@ -112,6 +112,11 @@ impl PipelineProcessor {
.map_err(|_| PipelineError::AgentNotFound(agent.name.clone()))?,
);
agent_headers.insert(
ENVOY_RETRY_HEADER,
hyper::header::HeaderValue::from_str("3").unwrap(),
);
let response = self
.client
.post(&self.llm_endpoint)
@ -160,6 +165,11 @@ impl PipelineProcessor {
.map_err(|_| PipelineError::AgentNotFound(terminal_agent.name.clone()))?,
);
agent_headers.insert(
ENVOY_RETRY_HEADER,
hyper::header::HeaderValue::from_str("3").unwrap(),
);
let response = self
.client
.post(&self.llm_endpoint)

View file

@ -29,3 +29,4 @@ pub const HALLUCINATION_TEMPLATE: &str =
pub const OTEL_COLLECTOR_HTTP: &str = "opentelemetry_collector_http";
pub const OTEL_POST_PATH: &str = "/v1/traces";
pub const LLM_ROUTE_HEADER: &str = "x-arch-llm-route";
pub const ENVOY_RETRY_HEADER: &str = "x-envoy-max-retries";