OktoScript Examples
This folder contains official example scripts written in OktoScript (.okt).
These examples are used by:
- Developers learning OktoScript
- Students and researchers
- OktoSeek IDE
- VS Code Extension
- Automatic tests and validation
Available Examples
Basic Examples
| File | Description | Use Case |
|---|---|---|
basic.okt |
Minimal example | Getting started |
chatbot.okt |
Conversational AI | Customer service, assistants |
computer_vision.okt |
Image classification | Vision models, object detection |
recommender.okt |
Recommendation system | E-commerce, content suggestions |
Advanced Examples
| File | Description | Use Case |
|---|---|---|
finetuning-llm.okt |
Fine-tuning LLM with checkpoints | Advanced language models, resume training |
vision-pipeline.okt |
Complete vision pipeline | Production vision systems, ONNX export |
qa-embeddings.okt |
QA with embeddings | Semantic search, retrieval systems |
v1.1 Examples (New Features)
| File | Description | Use Case |
|---|---|---|
lora-finetuning.okt |
LoRA fine-tuning with dataset mixing | Efficient fine-tuning, memory-efficient training |
dataset-mixing.okt |
Training with multiple weighted datasets | Combining datasets, weighted sampling |
π§ͺ Test Scripts (Recommended for Testing)
These scripts are specifically designed for testing different features of OktoScript v1.2:
| File | Description | Features Tested |
|---|---|---|
test-t5-basic.okt |
Basic training | PROJECT, ENV, DATASET, MODEL, TRAIN, EXPORT |
test-t5-monitor.okt |
Training with MONITOR | Full metrics tracking, notifications |
test-t5-control.okt |
Training with CONTROL | Automatic decisions, IF/WHEN/EVERY |
test-flan-t5-complete.okt |
All advanced blocks | MONITOR, CONTROL, STABILITY together |
test-flan-t5-inference.okt |
Inference with governance | BEHAVIOR, GUARD, INFERENCE blocks |
test-t5-explorer.okt |
AutoML with EXPLORER | Hyperparameter search, best model selection |
π See TESTING_GUIDE.md for detailed testing instructions.
v1.2 Examples (Advanced Features)
| File | Description | Use Case |
|---|---|---|
control-nested.okt |
Nested CONTROL blocks with advanced decision-making | Dynamic training control, conditional logic |
behavior-chat.okt |
BEHAVIOR block with mode and prompt_style | Chatbot personality, response style |
guard-safety.okt |
GUARD block with multiple detection methods | Content safety, ethical AI |
deploy-api.okt |
DEPLOY block for API deployment | Production API deployment |
security-full.okt |
Complete SECURITY block configuration | Input/output validation, rate limiting |
model-adapter.okt |
MODEL block with ADAPTER (LoRA/PEFT) | Parameter-efficient fine-tuning |
inference-advanced.okt |
Advanced INFERENCE with nested CONTROL | Smart inference with retry logic |
monitor-full.okt |
Complete MONITOR block with all metrics | Full system and training telemetry |
explorer-automl.okt |
EXPLORER block for hyperparameter search | AutoML-style optimization |
stability-training.okt |
STABILITY block for safe training | Training stability and safety |
complete-v1.2.okt |
Complete example with all v1.2 features | Full feature demonstration |
Complete Projects
| File | Description | Use Case |
|---|---|---|
pizzabot/ |
Complete project example | Full workflow demonstration |
Quick Start
To run these examples with OktoEngine (when available):
# Validate syntax
okto validate examples/basic.okt
# Train a model
okto train examples/chatbot.okt
# Evaluate performance
okto eval examples/recommender.okt
# Export model
okto export examples/computer_vision.okt --format=okm
Export Formats
OktoScript supports multiple export formats for different use cases:
Standard Formats
- ONNX - Universal inference, production-ready
- GGUF - Local inference, Ollama, Llama.cpp
- SafeTensors - HuggingFace, research, standard training
OktoSeek Optimized Formats
- OktoModel (.okm) - Optimized for OktoSeek SDK & Flutter plugins
- OktoBundle (.okx) - Mobile + Edge package (iOS, Android, Edge AI)
π‘ Tip: While standard formats work everywhere,
.okmand.okxformats are optimized for the OktoSeek ecosystem, providing better integration with Flutter apps, mobile SDKs, and OktoSeek tools.
Example: Using OktoModel Format
EXPORT {
format: ["onnx", "okm"]
path: "export/"
}
Why use .okm?
- β Optimized for OktoSeek Flutter SDK
- β Better performance on mobile devices
- β Access to exclusive OktoSeek tools and plugins
- β Seamless integration with OktoSeek ecosystem
- β Support for iOS and Android apps
Note: .okm is optional. You can always export to standard formats (ONNX, GGUF, SafeTensors) for universal compatibility.
Training Workflow
During training, OktoScript uses standard formats (this is industry-standard):
runs/my-model/
βββ checkpoint-100/
β βββ model.safetensors
βββ checkpoint-200/
β βββ model.safetensors
βββ tokenizer.json
βββ training_logs.json
After training, you choose your export format based on your deployment needs.
Complete Project Example
See pizzabot/ for a complete project example with:
- Full project structure
- Multiple dataset files
- Training configuration
- Export settings
- Example outputs
Contributing
Want to add your own example?
- Create a new
.oktfile in this directory - Follow the OktoScript grammar specification
- Include clear comments and descriptions
- Submit a pull request!
Powered by OktoSeek AI
- Website: https://www.oktoseek.com
- GitHub: https://github.com/oktoseek/oktoscript
- Documentation: ../docs/grammar.md