Skip to main content

risk classification chat assistant

Project description

Risk Detector

Minimal skeleton of dynamic risk classification chat assistant.

Installation

pip install -r requirements.txt
# or install the package
pip install .

CLI usage

The project exposes a command line interface providing helpers to manage rules and run the interactive dialog.

annex4risk-detector --help

Typical workflow:

# create database tables
annex4risk-detector init_db --db-url sqlite:///risk.db

# load YAML rules into the database
annex4risk-detector sync_rules --db-url sqlite:///risk.db --dir path/to/rules

# start an interactive classification chat
annex4risk-detector chat --db-url sqlite:///risk.db

See risk-detector --help for all available commands.

Demo script

For a quick demonstration with a temporary SQLite database and pre-filled answers that exercise all risk levels, run:

python demo_script.py

The script loads sample rules from test_rules/risk and shows how the dialog flows for scenarios ending in the prohibited, high_risk, not_high_risk (including Art. 6(3) derogation), and out_of_scope categories.

Serverless deployment

When deploying the Lambda handler, use a database reachable from the serverless environment (for example, an Amazon RDS PostgreSQL instance). Expose the connection string via the DB_URL environment variable – handler.py reads this variable and passes it to DialogOrchestrator.

Before deployment initialise the database and load the rules:

annex4risk-detector init_db --db-url "$DB_URL"
annex4risk-detector sync_rules --db-url "$DB_URL" --dir path/to/rules

These commands create tables including chat_answers and risk_outcomes which persist every answer and classification result.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

annex4risk_detector-1.4.4.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

annex4risk_detector-1.4.4-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file annex4risk_detector-1.4.4.tar.gz.

File metadata

  • Download URL: annex4risk_detector-1.4.4.tar.gz
  • Upload date:
  • Size: 31.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for annex4risk_detector-1.4.4.tar.gz
Algorithm Hash digest
SHA256 0e39959e6822f17396c6bbc33e12fa01915572fa41a64cc8cbf8efef7c953336
MD5 d5fac838437b04327dcde0c493d93703
BLAKE2b-256 2f8f6e60242f8aaa96a4897e6b1fc69c3b40c73434f8208f1369d22dc4aa0672

See more details on using hashes here.

File details

Details for the file annex4risk_detector-1.4.4-py3-none-any.whl.

File metadata

File hashes

Hashes for annex4risk_detector-1.4.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e852d7960d8a6902e4f6abe4fc8294d47685d245ecccf5687e8975f788f2013c
MD5 0debb2bddb5f98ce395acba01c9fe746
BLAKE2b-256 f35ed0ccfb5598e9b8fb171e66cfb0d13a6b005afbf19928f4185205f8503efb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page