pub struct HTTPServer {
pub host: String,
pub port: u16,
pub serialize_requests: bool,
pub max_retries: i32,
pub rescue_enabled: bool,
pub model_name: String,
/* private fields */
}Expand description
HTTP server configuration for the OpenAI-compatible proxy.
Fields§
§host: StringHost to bind.
port: u16Port to bind.
serialize_requests: boolWhether to serialize requests (single-worker queue).
max_retries: i32Maximum retries for tool-call validation.
rescue_enabled: boolWhether rescue parsing is enabled.
model_name: StringThe model name reported in responses.
Implementations§
Source§impl HTTPServer
impl HTTPServer
Sourcepub fn new(
host: &str,
port: u16,
serialize_requests: bool,
max_retries: i32,
rescue_enabled: bool,
model_name: &str,
) -> Self
pub fn new( host: &str, port: u16, serialize_requests: bool, max_retries: i32, rescue_enabled: bool, model_name: &str, ) -> Self
Creates a new HTTPServer instance with the specified binding and validation options.
Sourcepub fn serve_blocking<C>(
self: Arc<Self>,
client: Arc<C>,
ctx: Arc<Mutex<ContextManager>>,
) -> Result<()>where
C: LLMClient + 'static,
pub fn serve_blocking<C>(
self: Arc<Self>,
client: Arc<C>,
ctx: Arc<Mutex<ContextManager>>,
) -> Result<()>where
C: LLMClient + 'static,
Serve the HTTP API using axum on a single-threaded local executor.
Binds to self.host:self.port. Because LLMClient async methods
produce non-Send futures (native AFIT), this server runs on a
tokio::task::LocalSet which removes the cross-thread Send requirement,
matching Python’s single-threaded asyncio model.
Requests are serialized through self.request_mutex when
serialize_requests=true, matching Python’s asyncio.Semaphore(1).
Sourcepub fn serve_blocking_with_shutdown<C>(
self: Arc<Self>,
client: Arc<C>,
ctx: Arc<Mutex<ContextManager>>,
shutdown_rx: Receiver<()>,
) -> Result<()>where
C: LLMClient + 'static,
pub fn serve_blocking_with_shutdown<C>(
self: Arc<Self>,
client: Arc<C>,
ctx: Arc<Mutex<ContextManager>>,
shutdown_rx: Receiver<()>,
) -> Result<()>where
C: LLMClient + 'static,
Serve with graceful shutdown triggered by shutdown_rx resolving.
Same single-threaded LocalSet model as serve_blocking.
Source§impl HTTPServer
impl HTTPServer
Sourcepub fn cors_headers() -> Vec<(&'static str, &'static str)>
pub fn cors_headers() -> Vec<(&'static str, &'static str)>
Build CORS headers for OPTIONS responses.
Auto Trait Implementations§
impl !RefUnwindSafe for HTTPServer
impl !UnwindSafe for HTTPServer
impl Freeze for HTTPServer
impl Send for HTTPServer
impl Sync for HTTPServer
impl Unpin for HTTPServer
impl UnsafeUnpin for HTTPServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more