Create Your Own Function
1. Create the function
Go to the Nyckel console and sign in. Click New function.
Input type — choose based on what your application will send:
- Text — written content: messages, documents, support tickets, product descriptions, reviews
- Image — photos, screenshots, scanned documents, product images
- Tabular — structured rows of numeric or categorical data (e.g. sensor readings, form submissions)
Function type — choose Classification. This guide covers classification: each input is assigned to one of the labels you define.
Name — use a short, descriptive name that reflects what the function classifies. Lowercase and hyphens work well for API use. A good name describes the input and the decision, for example:
support-ticket-typeproduct-image-categoryreview-sentiment
Click Create. Your function is live immediately.
2. Define your labels
Open the Labels tab. Labels are the possible predictions your function can return — they map directly to the decisions your application makes.
A few principles for naming labels well:
- Mutually exclusive. Each input should clearly belong to one label. If you find yourself unsure which label an example belongs to, the boundary between those labels is probably too fuzzy.
- Decision-shaped. Name labels after what your application does with them, not internal codes. “Refund request” is clearer than “Type 3” for humans reviewing predictions later.
- Start minimal. Begin with the labels you’re certain about. You can add more later — Nyckel retrains automatically when you do.
You need at least 2 labels to create a classifier. Nyckel needs at least 2 confirmed examples per label before it begins training a private model.
3. Add training samples
Open the Samples tab. This is where you give Nyckel examples to learn from.
Two ways to add samples:
Upload a file — if you have existing labeled data, click Import and upload a CSV or JSONL file. Each row should include the input and the correct label. This is the fastest way to bootstrap if you already have labeled examples.
Paste examples one by one — if you’re starting from scratch, add examples directly in the console. Paste or type an input, assign it a label, and repeat.
How many examples to start:
Aim for 5–10 per label to get an initial trained model with meaningful accuracy. The more varied and representative your examples, the better — a model trained on 10 diverse examples usually outperforms one trained on 50 very similar ones.
What makes a good example:
- Representative of inputs your function will actually see in production
- Varied in phrasing, length, or format — avoid near-duplicate examples
- Clearly belonging to one label with no ambiguity
4. Test and refine
Once you have examples, Nyckel trains automatically — no button to press. You’ll see a training indicator in the console while it builds your model.
Test with new inputs:
Open the Invoke tab and test with inputs you have not used as training examples. Fresh inputs give you a realistic signal of how the model performs on unseen data.
Review predictions:
In the Test or Review tab, confirm if the predicted label is correct, or change it if it’s wrong. Each annotation feeds back into the training pipeline — Nyckel retrains in the background and benchmarks the new model against the previous one. If it improves, the endpoint switches automatically.
If the model isn’t performing well:
- Check whether your labels are genuinely distinct — overlapping categories are the most common cause of low accuracy
- Add more examples, especially for labels where the model is most often wrong
- Make sure your training examples match what production inputs actually look like
5. Call it from the API
Open your function in the console and click the Integrate tab. It shows your exact endpoint URL, a ready-to-copy access token, and code snippets for your language — no manual configuration needed.
The request structure looks like this (exact URL and token are in the Integrate tab):
POST https://www.nyckel.com/v1/functions/{functionId}/invoke
Authorization: Bearer {your_access_token}
Content-Type: application/json
{
"data": "your input here"
}
And the response:
{
"labelName": "your-label",
"confidence": 0.91,
"sampleId": "smp_abc123"
}
Read labelName to route the input and confidence to decide whether to act automatically or hold it for human review. Every invoke that reaches the endpoint will appear in the Annotations tab — the more you review, the better your model becomes over time.
What you just did
| Step | What happened |
|---|---|
| Created a function | Chose input type, function type, and a descriptive name |
| Defined labels | Set up the decision categories your application needs |
| Added training samples | Gave Nyckel labeled examples to learn from |
| Tested and refined | Reviewed predictions and fed corrections back into training |
| Called the API | Connected the function to your application |
Next: Read Review and improve predictions to learn how to build a steady annotation workflow, or go to the Developer Platform to see how this fits into a production integration.