Skip to main content

Create your private AI model with no training data or GPUs 🤖🚀.

Project description

Artifex

Artifex – Train task specific LLMs without training data, for offline NLP and Text Classification

Documentation | Tutorial

Artifex – Latest PyPi package version Artifex – Tests status Artifex – GitHub commit activity Artifex – Documentation

🎯 Create Task-Specific LLMs • 📊 No training data needed • 🌱 No GPU needed • 🖥️ Perform offline NLP


Artifex is a Python library to create small, task-specific LLMs to perform offline NLP and text classification tasks without training data.

Examples of offline NLP tasks you can perform with models created by Artifex include:

  • 🛡️ Guardrail Model: Flags unsafe, harmful, or off-topic messages.
  • 🗣️ Intent Classification: Classify user intents based on their messages.

We will be adding more tasks soon, based on user feedback. Want Artifex to perform a specific task? Suggest one or vote one up.

🔥 Why Artifex?

  • 🎯 Create Task-Specific LLMs: General-purpose LLMs are designed for open-ended tasks, but Artifex allows you to create models tailored to specific use cases.
  • 📊 No training data needed: Uses synthetic data generation under the hood.
  • 🌱 No GPU needed: All models are designed to run efficiently on CPU.
  • 💸 Reduce your LLM API bills: Offload tasks to offline task-specific models and reduce the number of paid API calls to general-purpose LLMs.
  • 🔧 Prebuilt templates for common tasks:

🚀 Quick Start

Install Artifex with:

pip install artifex

🛡️ Create a Guardrail Model

Create an offline chatbot guardrail model model with Artifex and integrate it into your chatbot in 2 simple steps:

1. Train a guardrail model based on your requirements:

from artifex import Artifex

guardrail = Artifex().guardrail

guardrail.train(
    instructions=[
        "Soft medical advice is allowed, but it should be general and not specific to any individual.",
        "Anything that is about cosmetic products, including available products or their usage, is allowed.",
        "Anything else, including hard medical advice, is not allowed under any circumstances.",
    ]
)

➡️ Model will be saved by default to artifex_output/run-<timestamp>/output_model/

2. Replace your chatbot's guardrail-related API calls with calls to your new local guardrail model:

"""
🚫 Instead of calling the OpenAI (or any other) API to check if a message is safe:
"""

# response = openai.ChatCompletion.create(...)
# is_safe = response.choices[0].message.content

"""
✅ Load your local guardrail model (assuming it was generated in the default 
'artifex_output/run-<timestamp>/output_model/' directory) and use it instead:
"""

guardrail = Artifex().guardrail

guardrail.load("artifex_output/run-<timestamp>/output_model/")

is_safe = guardrail(user_message)

(Optional) 3. Not satisfied with the model's performance? Is it getting some edge-cases wrong? Just keep training it!

guardrail = Artifex().guardrail

guardrail.load("artifex_output/run-<timestamp>/output_model/")

guardrail.train(
    instructions=[
        "While soft medical advice is allowed, saying that 'you should take X medication' is not allowed.",
        "While discussing cosmetic products is allowed, recommending a competitor's product is not.",
    ]
)

🗣️ Create an Intent Classification model

1. Train an intent classification model based on your requirements:

from artifex import Artifex

intent_classifier = Artifex().intent_classifier

intent_classifier.train(
    classes={
        "send_email": "Intent to send an email to someone.",
        "schedule_meeting": "Intent to schedule a meeting with someone.",
        "cancel_meeting": "Intent to cancel a previously scheduled meeting.",
        "reschedule_meeting": "Intent to change the date or time of a previously scheduled meeting.",
    }
)

2. Use your new local intent classification model to classify user messages:

label = intent_classifier("I forgot to set up that meeting with John, could you do that for me?")
print(label)

# >>> ["schedule_meeting"]

🔗 More Examples & Demos

Guardrail Model

  1. Tutorial — create a Guardrail Model with Artifex
  2. Demo — try a Guardrail Model trained with Artifex
  3. HF page — see a Guardrail Model trained with Artifex

Intent Classification Model

  1. Tutorial — create an Intent Classification Model with Artifex

🔑 Plans

Free plan: each user enjoys 1500 training datapoints per month and 500 training datapoints per job for free; this is enough to train 3-5 models per month for free.

Pay-as-you-go: for additional usage beyond the free plan:

  1. create an account on our platform
  2. add credits to it
  3. create an Api Key and pass it to Artifex at instantiation, then use it normally:
    from artifex import Artifex
    
    guardrail = Artifex(api_key="<your-api-key>").guardrail
    
    The pay-as-you-go pricing is 1$ per 100 datapoints. Once you finish your credits, if you have not exceeded the monthly limit, you will be automatically switched to the free plan.

Find out more about our plans on the Tanaos documentation.

🤝 Contributing

Contributions are welcome! Whether it's a new task module, improvement, or bug fix — we’d love your help. Not ready to contribute code? You can also help by suggesting a new task or voting up any suggestion.

git clone https://github.com/tanaos/artifex.git
cd artifex
pip install -e .

Before making a contribution, please review the CONTRIBUTING.md and CLA.md, which include important guidelines for contributing to the project.

📚 Documentation & Support

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

artifex-0.3.2.tar.gz (950.1 kB view details)

Uploaded Source

Built Distribution

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

artifex-0.3.2-py3-none-any.whl (758.5 kB view details)

Uploaded Python 3

File details

Details for the file artifex-0.3.2.tar.gz.

File metadata

  • Download URL: artifex-0.3.2.tar.gz
  • Upload date:
  • Size: 950.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for artifex-0.3.2.tar.gz
Algorithm Hash digest
SHA256 a4241f7329397c2b0bab174865c2f0bb879d0bc3ff3e45e6e37bfc6be437f793
MD5 6e45f792ab32e175a921c36a87fada3e
BLAKE2b-256 9ede739cd547ee1f06ebdcfe7c6271a4e9217a51d0e33856e530748b7e28d053

See more details on using hashes here.

File details

Details for the file artifex-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: artifex-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 758.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for artifex-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 51011ff5cedc4c21f7334b28c121688d8c5abf9d4b20c1ad918bf77e02379c2d
MD5 6250fd0f1c5b488aa798fa5be618dd3c
BLAKE2b-256 6bf247dda2e56c67deaffefffa6bb7e833d85e24845fb4af5ca44b315bb0ac6c

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