Skip to content

Let installed extensions check chat requests - #445

Merged
Priyanshu-u07 merged 1 commit into
mainfrom
feat/extension-request-check
Oct 26, 2026
Merged

Priyanshu-u07 merged 1 commit into
mainfrom
feat/extension-request-check

Conversation

@Priyanshu-u07

Copy link
Copy Markdown
Collaborator

Extensions (inferia.extensions, from #443) can mount routes, run migrations and add dashboard pages. This lets them check chat requests too.

  • common/extensions.py: before_request(**request) calls each installed extension's before_request. An HTTPException refuses the request and reaches the client like core's own refusals; any other error is logged and the request goes on, as with mount and migrate. With nothing installed it does nothing.
  • CompletionHandler.handle calls it after the quota check, before the engine, with the request ID (Give inference requests an X-Request-ID #442), caller, org, deployment, model, request type and the JSON body. /v1/messages goes through the same handler, so it is covered too.

Tests: extensions are called in order, a refusal stops the request before the engine and skips later extensions, a failing extension is skipped; the call happens after the quota check and before the engine.

After the quota check and before the engine, each installed extension's before_request gets the request ID, caller, org, deployment, model and JSON body. An HTTPException refuses the request like core's own refusals; any other error is logged and the request goes on. Covers /v1/chat/completions and /v1/messages.

Signed-off-by: Priyanshu-u07 <connect.priyanshu8271@gmail.com>
@Priyanshu-u07
Priyanshu-u07 merged commit 3d0fb41 into main Oct 26, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant