Fast Decisions. Continuous Evolution.
Run Valen’s System One text decisions in a native C++ process.
English · 简体中文
Valen · Try Valen · Documentation · Models
Python SDK · JavaScript SDK · C++ integration
Valen is a multimodal System One decision model that returns structured decision probabilities for your tasks. This repository is the Valen family’s native C++ text integration example.
Run Valen text decisions inside a C++ process and turn natural language into categories, yes/no probabilities and scores. This repository provides a complete command-line integration example: read SystemOne JSON, compile text and call ONNX Runtime directly. Use the Model and text compiler in main.cpp as a starting point for a native application.
The current entry point supports SystemOne text, FP32 CPU and one request per process. For images, video, Decisions or HTTP, use the Python SDK or JavaScript SDK.
Complete workflows are maintained in the official Cookbook: ticket routing, when no option fits, product-image screening and video tagging. Code, samples and measured outputs share one source. This repository retains SDK interface and installation examples. In the Python/JavaScript SDKs, Valen.local loads ONNX and Valen.remote connects to GGUF HTTP services. C++ support remains scoped by this repository's reference.
Use a C++17 compiler, CMake 3.19+, Rust/Cargo, Git, curl and jq. Rust builds the tokenizer and template static library; inference runs directly in the C++ process.
Download the code and 0.8B CPU text model files:
git clone https://github.com/valen-team/valen-sdk-cpp.git
cd valen-sdk-cpp
bash examples/download-model.shThe download script selects only the graphs, weights and configuration required for text inference and saves them under models/Valen-0.8B-ONNX. It skips vision and other precisions. For larger models, see the 2B and 4B FP32 variants.
curl -L https://github.com/microsoft/onnxruntime/releases/download/v1.31.0/onnxruntime-osx-arm64-1.31.0.tgz -o onnxruntime.tgz
tar -xzf onnxruntime.tgz
cargo build --release --manifest-path native/Cargo.toml
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DORT_LIBRARY="$PWD/onnxruntime-osx-arm64-1.31.0/lib/libonnxruntime.1.31.0.dylib"
cmake --build build --config Releasecurl -L https://github.com/microsoft/onnxruntime/releases/download/v1.31.0/onnxruntime-linux-x64-1.31.0.tgz -o onnxruntime.tgz
tar -xzf onnxruntime.tgz
cargo build --release --manifest-path native/Cargo.toml
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DORT_LIBRARY="$PWD/onnxruntime-linux-x64-1.31.0/lib/libonnxruntime.so.1.31.0"
cmake --build build --config ReleaseThese commands use official ONNX Runtime binaries. Real-model validation covers 0.8B on macOS ARM; the Linux build has not been tested.
./build/valen-cpp models/Valen-0.8B-ONNX examples/request.jsonrequest.json asks a choice, yes/no and score question about one customer message. The program prints JSON with these fields:
| Field | Meaning |
|---|---|
answers.intent.choice |
address or cancel, for routing the request |
answers.change_address.noul |
Probability of an address-change request, from 0 to 1 |
answers.explicitness.score |
Request explicitness, from 0 to 2 |
Edit state, question instructions and candidates to use your own task. execution supports shared_state and question. Read a request from stdin:
cat examples/request.json | ./build/valen-cpp models/Valen-0.8B-ONNX -main.cpp contains text compilation, ORT inference and result handling. native/ uses Hugging Face tokenizers and MiniJinja for tokenization and template rendering. vendor/ contains the ORT headers and JSON parser.
Valen is Apache-2.0; see LICENSE. ORT and nlohmann/json are MIT; tokenizers and MiniJinja are Apache-2.0, with licenses distributed with their source or dependencies.
User guides are maintained only on the website: Documentation · Fine-tuning · Probabilities · Cookbook.
