Skip to main content

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

Project description

Artifex - Train small, private AI models without data

Artifex - Train small, private AI models without data

Documentation · Tutorial

Latest PyPi package version Tests status Sample Models on HuggingFace GitHub commit activity Artifex Documentation

💸 Cut chatbot costs by up to 40% • 📊 No training data needed • 🌱 No GPU needed

Artifex is a Python library that generates small, fast, task-specific AI models that you can run locallywithout any training data or GPU required.

It can be used to reduce chatbot costs by up to 40%, by offloading common tasks, especially guardrails, to small models that you can run locally on CPU, instead of relying on expensive API calls.

🔥 Why Artifex?

  • 💸 Cut chatbot costs by 40%: Offload chatbot tasks to local models and reduce the number of paid API calls.
  • 📊 No training data needed: Uses synthetic data generation under the hood.
  • 🌱 No GPU needed: All models are designed to run efficiently on CPU.
  • 🔒 Keep ownership of your models: Keep exclusive ownership of the models you generate.
  • 🔧 Prebuilt templates for common tasks:

🔬 Experiments

Comparison of chatbots relying solely to the OpenAI API vs chatbots that offload guardrail tasks to a local model generated with Artifex have shown that the latter:

  • Send up to 66% fewer messages to the OpenAI API
  • Are up to 40% cheaper overall
  • Have up to 8% lower latency

While maintaining the same level of safety and quality.

Artifex - Train small, private AI models without data

🚀 Quick Start

Create a local guardrail model with Artifex and integrate it into your chatbot in 3 simple steps:

1. Install Artifex:

pip install artifex

2. Train a guardrail 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/

3. Replace your chatbot's guardrail-related API calls with calls to your new local 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) 4. 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.",
    ]
)

🧰 Supported Tasks (more coming soon)suggest one or vote one up

We continue to add new models to Artifex, so stay tuned for updates! Currently, you can generate the following models:

  • 🛡️ Chatbot Guardrail: Flags unsafe, harmful, or off-topic messages.
  • 🗂️ Intent Classifier: Maps text to intents, such as "product_inquiry", "send_email"...
  • 📝 Interested in other models? If there is a specific task you'd like to perform with Artifex, write it in the discussion or vote up any suggestion.

🔗 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 Classifier Model

  1. Tutorial — create an Intent Classifier Model with Artifex

🔑 Plans

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

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.

🤝 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 .

📚 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.1.tar.gz (949.4 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.1-py3-none-any.whl (758.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: artifex-0.3.1.tar.gz
  • Upload date:
  • Size: 949.4 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.1.tar.gz
Algorithm Hash digest
SHA256 1faa4ecaf28b799ced686d6903e23a813579d1d9f8af58b87f0d5f2da45900bc
MD5 09e1f139aa9b5da33ad6909fad6ea3f9
BLAKE2b-256 a596e363cd3689f34fe677da2cf3df74b3bbce4a9085bd475c07421b2474e5b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: artifex-0.3.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 eb3a11f4c39ffc716fde66055ece53928f120a78b72a78b18f765d2865b77f79
MD5 6171ad55f19a6d55cb32a63482838d6a
BLAKE2b-256 60b299a263dc1389b020839965c7e3a6e5834c49021a4b7a603ae9aa76fee648

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