From 7452324ea5fccabf77445937e71e110cebf05f14 Mon Sep 17 00:00:00 2001 From: David Veszelovszki Date: Mon, 17 Jun 2024 18:16:32 +0200 Subject: [PATCH] fix(cody-gateway): Disable flagging Google requests (#63295) - Fixes https://github.com/sourcegraph/sourcegraph/issues/63294 This PR turns off flagging for all Google models entirely. ## Test plan Not tested yet. --- .../internal/httpapi/completions/google.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/cmd/cody-gateway/internal/httpapi/completions/google.go b/cmd/cody-gateway/internal/httpapi/completions/google.go index e44b206e9f0..07553a8d224 100644 --- a/cmd/cody-gateway/internal/httpapi/completions/google.go +++ b/cmd/cody-gateway/internal/httpapi/completions/google.go @@ -77,16 +77,9 @@ func (*GoogleHandlerMethods) validateRequest(_ context.Context, _ log.Logger, fe return nil } -func (g *GoogleHandlerMethods) shouldFlagRequest(_ context.Context, _ log.Logger, req googleRequest) (*flaggingResult, error) { - result, err := isFlaggedRequest( - nil, // tokenizer, meaning token counts aren't considered when for flagging consideration. - flaggingRequest{ - ModelName: req.Model, - FlattenedPrompt: req.BuildPrompt(), - MaxTokens: int(req.GenerationConfig.MaxOutputTokens), - }, - makeFlaggingConfig(g.config.FlaggingConfig)) - return result, err +func (g *GoogleHandlerMethods) shouldFlagRequest(_ context.Context, _ log.Logger, _ googleRequest) (*flaggingResult, error) { + // This entirely disables flagging for Google. + return nil, nil } // Used to modify the request body before it is sent to upstream.