Skip to main content

Crate wesichain_server

Crate wesichain_server 

Source
Expand description

HTTP server integration for wesichain.

Provides a one-liner server builder that exposes LLMs and agents over HTTP.

§Quick start

use wesichain_server::WesichainServer;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    WesichainServer::new()
        .with_chat(my_llm, "claude-3-5-sonnet-20241022")
        .with_auth_token("my-secret-token")
        .serve("0.0.0.0:3000".parse()?)
        .await
}

Re-exports§

pub use agent_endpoint::agent_router;
pub use agent_endpoint::AgentHandler;
pub use chat_endpoint::chat_router;
pub use sse::stream_to_sse;

Modules§

agent_endpoint
Agent streaming endpoint: POST /agent/chat → SSE stream.
chat_endpoint
OpenAI-compatible /v1/chat/completions endpoint.
sse
SSE helpers: convert a BoxStream<StreamEvent> into an Axum SSE response.

Structs§

WesichainServer
One-liner builder for a wesichain HTTP server.