Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

fix(cody-gateway): Fix Google flagging configuration#63305

Merged
chrsmith merged 2 commits into
mainfrom
chrsmith/fix-google-provider-flagging
Jun 17, 2024
Merged

fix(cody-gateway): Fix Google flagging configuration#63305
chrsmith merged 2 commits into
mainfrom
chrsmith/fix-google-provider-flagging

Conversation

@chrsmith

@chrsmith chrsmith commented Jun 17, 2024

Copy link
Copy Markdown
Contributor

We recently noticed that 100% of all LLM requests routed to Google-provided LLMs were getting flagged, and for the same reasons ["high_max_tokens_to_sample","blocked_phrase"].

After FAR, FAR more head scratching than I care to admit to. I realized the problem: that we were never actually initializing the Google.FlaggingConfig settings. So when we were inspecting Gemini requests for potential abuse, we were comparing them against the zero-state for flaggingConfig. e.g. does this prompt have a higher MaxTokensToSample than 0?

🤦 Super easy mistake to make. We now confirm that something is in the flaggingConfig before assuming it is legitimate.

Fixes https://github.com/sourcegraph/abuse-ban-bot/issues/32.

Test plan

CI/CD

@chrsmith chrsmith requested review from abeatrix and vdavid June 17, 2024 21:08
@cla-bot cla-bot Bot added the cla-signed label Jun 17, 2024

@abeatrix abeatrix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

havent tested it with a local instance but the code change lgtm!

@chrsmith chrsmith merged commit 692ceca into main Jun 17, 2024
@chrsmith chrsmith deleted the chrsmith/fix-google-provider-flagging branch June 17, 2024 21:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants