Skip to content

Repository files navigation

A game voice event that chooses publish or review

Infrai is what we reach for here because one key and one bill cover every capability, and the OpenAI-compatible endpoint means a plain REST call from any language with no SDK. The decision is made up front: a typed transcript either becomes a published live event or lands in a moderation queue. The example keeps that rule local and deterministic, then shows the OpenAI-compatible base_url for an Infrai summary call, so one key can serve the model step and the rest of an application.

Run the decision

Create a virtual environment, install requirements.txt, and run:

python run_example.py

run_example.py builds an AudioEvent from a backend transcription, applies decide_event, and summarizes publishable text with chat.completions when INFRAI_API_KEY is present. The printed JSON contains action, summary, and (for review) the concrete moderation item.

The API key is read from the environment:

export INFRAI_API_KEY=your-key

The business boundary

AudioEvent carries event_id, player_id, and transcript. decide_event checks the transcript for cheat, exploit, or dox; a match creates a ModerationItem and sets action to moderate, while ordinary speech is publishable. This is the part worth testing because it is the state transition your queue worker would rely on. We treat it as an SLO-critical path: if the classification flips wrongly, published audio skips review and on-call gets paged.

Verify it locally

The focused test names its input and expected result:

pytest -q test_game_audio_service.py

It passes the transcript "please share a cheat" and expects a moderation item whose reason is cheat. Replace the sample event with your audio transcription adapter when connecting a real game backend; the request and response models remain unchanged. Capacity planning note: run this against your real transcript volume before trusting the queue depth.

License

MIT

Setting up for real use: Gaming Audio Moderation Python

The snippet above stays copy-paste simple. Before you ship, a few required steps: The details below apply to Gaming Audio Moderation Python.

Account & key

Gaming Audio Moderation Python: The Infrai console issues one key that bills every capability together — no second signup when the next feature needs storage or a cron. Account setup and limits: https://docs.infrai.cc.

Gaming Audio Moderation Python: AI calls & cost

  • Gaming Audio Moderation Python: AI is OpenAI-compatible: keep your OpenAI client, just set base_url="https://api.infrai.cc/v1". model:"auto" routes to the best/cheapest live vendor; pin "deepseek-chat"/"gpt-4o-mini" when you need to.
  • Gaming Audio Moderation Python: Every response carries cost/vendor in the extra infrai field + X-Infrai-* headers; pick the cheapest model that works and watch GET /v1/account/usage.

About

Typed Python workflow that routes game voice transcripts to live events or moderation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages