Documentation
¶
Overview ¶
Package server implements the HTTP server and routing logic for the Hapax LLM service. It provides endpoints for LLM completions, health checks, and Prometheus metrics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router handles HTTP routing and middleware configuration. It sets up all endpoints and applies common middleware to requests.
func NewRouter ¶
NewRouter creates a new router with all endpoints configured. It: 1. Sets up common middleware (request ID, timing, panic recovery, CORS) 2. Configures the completion endpoint for LLM requests 3. Adds health check endpoint for container orchestration 4. Adds metrics endpoint for Prometheus monitoring
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents the HTTP server instance. It wraps the standard library's http.Server with our configuration. The running boolean tracks whether the server is operational, while the mu mutex protects concurrent access to this state. This ensures that multiple goroutines do not interfere with each other when checking or updating the server's status.
func NewServer ¶
NewServer creates a new server with the specified configuration and handler. It configures timeouts and limits based on the provided configuration.
func NewServerWithConfig ¶ added in v0.0.16
NewServerWithConfig for testing now takes care of the LLM
Directories
¶
| Path | Synopsis |
|---|---|
|
Package handlers provides HTTP handlers for the Hapax server.
|
Package handlers provides HTTP handlers for the Hapax server. |
|
Package middleware provides various middleware functions for HTTP handlers.
|
Package middleware provides various middleware functions for HTTP handlers. |
|
Package processing provides request processing and response formatting for LLM interactions.
|
Package processing provides request processing and response formatting for LLM interactions. |
|
Package routing provides dynamic HTTP routing with versioning and health checks.
|
Package routing provides dynamic HTTP routing with versioning and health checks. |