Skip to content

Support server#44

Merged
InftyAI-Agent merged 12 commits into
InftyAI:mainfrom
kerthcet:feat/support-server
Apr 26, 2026
Merged

Support server#44
InftyAI-Agent merged 12 commits into
InftyAI:mainfrom
kerthcet:feat/support-server

Conversation

@kerthcet
Copy link
Copy Markdown
Member

What this PR does / why we need it

Which issue(s) this PR fixes

Fixes #43

Special notes for your reviewer

Does this PR introduce a user-facing change?


Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings April 26, 2026 11:27
@InftyAI-Agent InftyAI-Agent added needs-triage Indicates an issue or PR lacks a label and requires one. needs-priority Indicates a PR lacks a label and requires one. do-not-merge/needs-kind Indicates a PR lacks a label and requires one. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 26, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an Axum-based inference server to PUMA with OpenAI-compatible endpoints (chat completions, legacy completions, and model listing), exposed via a new puma serve CLI subcommand, plus integration tests and documentation to support Issue #43.

Changes:

  • Introduces HTTP API router + handlers for /v1/chat/completions, /v1/completions, /v1/models, /v1/models/:model, and /health.
  • Adds a new serve CLI command that starts the server using a MockEngine backend.
  • Adds API integration tests, a manual test script, and docs updates (README + logging guidelines).

Reviewed changes

Copilot reviewed 24 out of 25 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
tests/cli_test.rs Adds module-level doc comment for CLI integration tests.
tests/api_test.rs New Axum-router integration tests for health/models/completions endpoints.
src/storage/storage_trait.rs Requires ModelStorage to be Send + Sync for server state sharing.
src/main.rs Registers new api/backend modules; tweaks default logging filters; minor ordering change.
src/lib.rs Exposes internal modules publicly to support integration tests.
src/cli/serve.rs Implements puma serve to start the Axum server.
src/cli/mod.rs Exports new serve module.
src/cli/commands.rs Adds SERVE subcommand + args and dispatches to server startup.
src/backend/mod.rs Adds backend module structure and re-exports engine trait.
src/backend/engine.rs Defines InferenceEngine trait and GenerateResponse.
src/backend/mock.rs Implements MockEngine generate + streaming stubs.
src/api/types/request.rs Adds OpenAI-ish request DTOs for chat/completions.
src/api/types/response.rs Adds OpenAI-ish response/error DTOs.
src/api/types/mod.rs Exposes request/response types.
src/api/mod.rs Wires API submodules and re-exports create_router.
src/api/routes.rs Defines router, shared state, CORS, and health endpoint.
src/api/chat.rs Implements chat completions (SSE + non-streaming).
src/api/completions.rs Implements legacy text completions.
src/api/models.rs Implements list/get model endpoints.
hack/scripts/test_api.sh Adds a manual curl/jq script for endpoint testing.
hack/README.md Documents the hack/ directory and scripts.
README.md Documents the new API server and serve command.
LOGGING.md Adds logging conventions for CLI output vs internal logs.
Cargo.toml Adds web/server dependencies and test dependencies.
Cargo.lock Updates lockfile for new dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/api/models.rs
Comment thread src/api/completions.rs
Comment thread src/lib.rs Outdated
Comment thread README.md
Comment thread src/api/tests.rs Outdated
Comment thread src/api/chat.rs
Comment thread src/api/chat.rs
Comment thread hack/scripts/test_api.sh
Comment thread src/api/routes.rs
Comment thread src/api/chat.rs Outdated
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings April 26, 2026 12:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/cli/serve.rs Outdated
Comment thread src/api/tests.rs Outdated
Comment thread src/api/tests.rs
Comment thread src/api/tests.rs Outdated
Comment thread src/api/chat.rs
Comment thread Cargo.toml
Comment thread README.md Outdated
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings April 26, 2026 13:09
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 15 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/api/types/request.rs
Comment thread src/api/tests.rs
Comment on lines +116 to +120
#[tokio::test]
async fn test_chat_completion_non_streaming() {
let (app, _temp_dir) = create_test_app();
let request_body = json!({
"model": "test-model",
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s no test coverage for the streaming path of /v1/chat/completions ("stream": true). Add a test that asserts text/event-stream output and verifies the stream ends with [DONE].

Copilot uses AI. Check for mistakes.
Comment thread Cargo.toml
Comment thread src/api/chat.rs
Comment thread src/main.rs
Comment thread Cargo.toml
Comment thread src/api/tests.rs
Comment on lines +21 to +25
fn create_test_app() -> (axum::Router, TempDir) {
let engine = Arc::new(MockEngine::new());
let temp_dir = TempDir::new().unwrap();
let registry = Arc::new(ModelRegistry::new(Some(temp_dir.path().to_path_buf())));

Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests type the app as axum::Router (default state ()), but the router produced by create_router carries typed state (AppState<E>). After fixing create_router’s return type, update the test helpers to use Router<AppState<MockEngine>> (or make make_json_request generic over the router state) so the tests compile.

Copilot uses AI. Check for mistakes.
Comment thread src/cli/commands.rs
Comment thread src/api/completions.rs
Comment thread src/lib.rs Outdated
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings April 26, 2026 15:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/cli/commands.rs
Signed-off-by: kerthcet <kerthcet@gmail.com>
Signed-off-by: kerthcet <kerthcet@gmail.com>
Copilot AI review requested due to automatic review settings April 26, 2026 15:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 25 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/api/routes.rs Outdated
Comment thread hack/scripts/test_api.sh
Signed-off-by: kerthcet <kerthcet@gmail.com>
@kerthcet
Copy link
Copy Markdown
Member Author

/lgtm
/kind feature

@InftyAI-Agent InftyAI-Agent added lgtm Looks good to me, indicates that a PR is ready to be merged. feature Categorizes issue or PR as related to a new feature. and removed do-not-merge/needs-kind Indicates a PR lacks a label and requires one. labels Apr 26, 2026
@InftyAI-Agent InftyAI-Agent merged commit ff7a96d into InftyAI:main Apr 26, 2026
20 of 22 checks passed
@kerthcet kerthcet deleted the feat/support-server branch April 26, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. feature Categorizes issue or PR as related to a new feature. lgtm Looks good to me, indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a label and requires one. needs-triage Indicates an issue or PR lacks a label and requires one.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add OpenAI-compatible APIs support

3 participants