Repository navigation
Let installed extensions check chat requests - #445
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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'sbefore_request. AnHTTPExceptionrefuses 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.handlecalls 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/messagesgoes 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.