Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for huggingface token classification #574

Merged
merged 6 commits into from
Mar 21, 2024

Conversation

typpo
Copy link
Collaborator

@typpo typpo commented Mar 21, 2024

This is useful e.g. for PII detection.

Here's an example that uses bigcode/starpii:

prompts:
  - 'Select a random {{person_type}} and introduce yourself as them'
providers: [openai:chat:gpt-4-0125-preview]
defaultTest:
  options:
    provider: 
      id: huggingface:token-classification:bigcode/starpii
      config:
        wait_for_model: true
  assert:
    - type: not-classifier
      # Assert that outputs are not PII, with a PII score of less than 0.5
      threshold: 0.75
tests:
  - vars:
      topic: scientist
  - vars:
      topic: celebrity

It also adds support for not-classifier, which inverts the classifier behavior (i.e. assert that the LLM does not produce PII)

@typpo typpo merged commit 5a84706 into main Mar 21, 2024
18 checks passed
@typpo typpo deleted the hf-token-classification branch March 21, 2024 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant