🐍Python library

Use Vigil as a Python library

Vigil can also be used within your own Python application as a library. This allows you to access the input and output scanners, canary token, and vector database functionality.

The Vigil library must be installed via

pip install -e .

Then import the Vigil class and pass it your config file.

Initialize scanners

from vigil.vigil import Vigil

app = Vigil.from_config('conf/openai.conf')

Pass your configuration file to Vigil.from_config. This exposes the following functions:

  • input_scanner.perform_scan(prompt)

  • output_scanner.perform_scan(prompt, response)

  • canary_tokens.add

  • canary_tokens.check

  • vectordb.add_texts

  • vectordb.add_embeddings

  • embedder.generate

Scan Prompts and Responses

The scanners return a Python dictionary with the full results and any metadata.

Canary Tokens

Last updated