Code Scanner

(Input and Output scanner)

This scanner is designed to detect and validate code in the prompt.

It can be particularly useful in applications that need to accept only code snippets in specific languages.

How it works

Developers can configure the scanner to either allow or ban specific languages, thus retaining full control over which types of code can appear in user queries.

The scanner is currently limited to extracting and detecting code snippets from Markdown in the following languages:

  • ARM Assembly

  • AppleScript

  • C

  • C#

  • C++

  • COBOL

  • Erlang

  • Fortran

  • Go

  • Java

  • JavaScript

  • Kotlin

  • Lua

  • Mathematica/Wolfram Language

  • PHP

  • Pascal

  • Perl

  • PowerShell

  • Python

  • R

  • Ruby

  • Rust

  • Scala

  • Swift

  • Visual Basic .NET

  • jq

Code Detection Policy for AI Chatbot

Create a new policy as same as shown in LLM Guardrails Policy, for Code detection select scanner Code(Go selected).

Optionally, perform a test to ensure the policy is functioning as intended. Check that code is detected and blocked as specified.

Last updated