Skip to content

eutiveumsonho/chiron

Repository files navigation

PRs Welcome

Eu tive um sonho - Chiron

Chiron - Human-in-the-loop back-office service

Make your AI system smarter.


What is this?

Chiron was designed to be a simple service that enables you to create a human-in-the-loop system for your AI models (but you can use it for any other task that requires human input).

It offers:

  • An API that allows you to send any JSON to Chiron, and receive the reviewed data back to a specified callback URL.
  • A visual interface to review data, correct or adjust it, and add more data to it (such as labels).

Chiron is currently being used on the human review pipeline of AI generated data from Eu tive um sonho.

How does it work?

sequenceDiagram
    Human->>+Chiron: Accesses the service based on the ALLOWED_EMAILS list
    Human->>+Chiron: Provides vendor information via API Management page (name, origin URL, callback URL)
    Chiron->>+Human: Outputs vendor-specific API keys
    Human->>+App: Configures App to hit Chiron with given API keys
    App->>+Chiron: Hits Chiron with any data generated by AI (or not) with a POST request to /api/data/completions
    Human->>+Chiron: Review generated data (Human-in-the-loop)
    Chiron->>+App: Hits App back with reviewed data with a POST request to the callback URL
Loading

How can I run this on my own machine?

Create a .env.local file based on the .env.example file. You will need access to a SMTP server credentials, a MongoDB instance and to set up an encryption key to spin this service. You can generate a key using the following command:

openssl rand -base64 32

After generating the key, paste it as the ENCRYPTION_KEY value from the .env.local file.

Include all emails that should be able to sign in to the application on the ALLOWED_EMAILS environment variable.

You're good to go now. Install the dependencies and run the development server:

bun
bun dev

Open http://localhost:3000 with your browser to see the result.

How can I deploy this on my own server?

Before deploying this service, make sure you have access to a:

  • SMTP server
  • MongoDB instance

Take a look at the .env.example file to see which environment variables you need to set up the application.

This project is deployed using Vercel. You can deploy your own instance using the button below (but feel free to deploy it anywhere else - this project doesn't rely on any Vercel-specific feature):

Deploy with Vercel

How can I use this service?

After deploying the service, you can access the API Management page by accessing the /api-management route. You will need to create a vendor to get your API keys. A vendor is a service that will be using Chiron to review data. You can create as many vendors as you want.

While creating a vendor, you will need to provide the following information:

Field Description
Name The name of your vendor.
Origin URL The URL of your application.
Callback URL The URL where Chiron will send the reviewed data back to.

Once you've created a vendor, copy and paste its API keys and vendor ID to your application. You can now start sending data to Chiron. You can send data to Chiron by hitting the /api/data/completions route with a POST request. The data you send should be in the following format:

fetch("https://yourdomain.com/api/data/completions", {
    method: "POST",
    headers: {
      vendorId, // The generated vendor ID here
      apiKey, // The generated API key here
      "Content-Type": "application/json",
    },
    body: JSON.stringify(data) // Your data here,
  })