Skip to main content

Installation

Install odin-prompt-toolkit for your preferred language. All implementations provide identical SusFactor classification; Rust, Python, and TypeScript also include LSH signatures and the threat feed.

Rust

Add odin-prompt-toolkit to your Cargo.toml:

[dependencies]
odin-prompt-toolkit = { git = "https://github.com/0din-ai/prompt-toolkit" }

Feature Flags

[dependencies]
odin-prompt-toolkit = {
git = "https://github.com/0din-ai/prompt-toolkit",
features = ["openai", "onnx", "cm-lsh", "susfactor", "threatfeed"]
}
FeatureDefaultDescription
openai✅ YesOpenAI API embedding provider (V0 signatures)
onnx✅ YesLocal ONNX embedding provider (V1 signatures)
cm-lsh❌ NoConfidence Matrix LSH (experimental, higher accuracy)
susfactor❌ NoJailbreak/prompt-injection classifier (SusFactor)
threatfeed❌ NoThreat feed sync and similarity lookup
ONNX Runtime build requirement

The onnx feature uses ONNX Runtime via the ort crate with download-binaries, which fetches a prebuilt native ONNX Runtime library at build time. This means building the onnx feature requires network access (or a pre-cached binary). For air-gapped or offline builds, supply your own ONNX Runtime library via the ORT_DYLIB_PATH environment variable. A prebuilt binary must exist for your target triple.

Verify Installation

cargo build

Python

Install via pip with git dependency:

pip install "0din-prompt-toolkit @ git+https://github.com/0din-ai/prompt-toolkit#subdirectory=packages/python"

Optional Dependencies

# Core LSH only (no embeddings)
pip install "0din-prompt-toolkit @ git+https://github.com/0din-ai/prompt-toolkit#subdirectory=packages/python"

# With OpenAI support
pip install "0din-prompt-toolkit[openai] @ git+https://github.com/0din-ai/prompt-toolkit#subdirectory=packages/python"

# With ONNX support (V1 embeddings + SusFactor ONNX backend)
pip install "0din-prompt-toolkit[onnx] @ git+https://github.com/0din-ai/prompt-toolkit#subdirectory=packages/python"

# With CM-LSH support
pip install "0din-prompt-toolkit[cm-lsh] @ git+https://github.com/0din-ai/prompt-toolkit#subdirectory=packages/python"

# With SusFactor (PyTorch backend)
pip install "0din-prompt-toolkit[susfactor] @ git+https://github.com/0din-ai/prompt-toolkit#subdirectory=packages/python"

# With Threat Feed integration
pip install "0din-prompt-toolkit[threatfeed] @ git+https://github.com/0din-ai/prompt-toolkit#subdirectory=packages/python"

# All features
pip install "0din-prompt-toolkit[all] @ git+https://github.com/0din-ai/prompt-toolkit#subdirectory=packages/python"

Requirements

  • Python 3.10 or higher
  • NumPy (automatically installed)

Verify Installation

import odin_prompt_toolkit
print(odin_prompt_toolkit.__version__)

TypeScript

Install via npm with git dependency:

npm install "github:0din-ai/prompt-toolkit#main" --workspace=typescript

Or with Yarn:

yarn add "github:0din-ai/prompt-toolkit#main"

Requirements

  • Node.js 18 or higher
  • TypeScript 4.5 or higher (if using TypeScript)

Verify Installation

import { simhashLshMulti } from '@0din/prompt-toolkit';
console.log('odin-prompt-toolkit installed successfully');

Go

The Go SDK provides SusFactor jailbreak classification. It requires two native shared libraries (ORT and libtokenizers) installed separately — see Go + Docker Integration for a production-ready setup.

go get github.com/0din-ai/prompt-toolkit/packages/go@main

Native Dependencies

The Go SDK uses CGo and links against:

LibraryVersionPurpose
libonnxruntime.so1.29.0ONNX Runtime inference
libtokenizers.a1.27.0HuggingFace tokenizers

Linux (CI / Docker):

# ORT v1.29.0
curl -fsSL https://github.com/microsoft/onnxruntime/releases/download/v1.29.0/onnxruntime-linux-x64-1.29.0.tgz \
| tar -xz -C /opt/
sudo cp /opt/onnxruntime-linux-x64-1.29.0/lib/libonnxruntime.so.1.29.0 /usr/local/lib/libonnxruntime.so
sudo ldconfig

# libtokenizers v1.27.0
curl -fsSL https://github.com/daulet/tokenizers/releases/download/v1.27.0/libtokenizers.linux-amd64.tar.gz \
| tar -xz -C /tmp/
sudo cp /tmp/libtokenizers.a /usr/local/lib/libtokenizers.a

Then build with:

CGO_ENABLED=1 CGO_LDFLAGS="-L/usr/local/lib" \
ORT_LIB_PATH=/usr/local/lib/libonnxruntime.so \
go build ./...

Requirements

  • Go 1.22 or higher
  • CGo enabled (CGO_ENABLED=1)
  • ORT v1.29.0 shared library
  • libtokenizers v1.27.0 static library

Verify Installation

package main

import (
"context"
"fmt"
"github.com/0din-ai/prompt-toolkit/packages/go/susfactor"
)

func main() {
clf, err := susfactor.NewClassifier(context.Background(),
susfactor.WithModelDir("/path/to/susfactor-v1"),
)
if err != nil {
panic(err)
}
defer clf.Close()
fmt.Println("Go SDK ready")
}

Development Installation

If you're contributing to the SDK or need the latest unreleased changes:

Clone Repository

git clone https://github.com/0din-ai/prompt-toolkit.git
cd prompt-toolkit

Install All Dependencies

make install

This installs dependencies for all four languages:

  • Rust: cargo fetch
  • Python: pip install -e ".[dev,all]"
  • TypeScript: npm install
  • Go: native libraries must be installed separately (see Go section above)

Run Tests

make test

Runs all 400+ tests across the four implementations.

Next Steps

Troubleshooting

Rust: ONNX Model Download Fails

If the ONNX model fails to download on first use:

  1. Check internet connection
  2. Manually download from HuggingFace
  3. Place in ~/.cache/odin-prompt-toolkit/models/v1/

Python: NumPy Import Error

Ensure you have a compatible NumPy version:

pip install "numpy>=1.24"

TypeScript: Module Not Found

If imports fail, ensure your tsconfig.json includes:

{
"compilerOptions": {
"moduleResolution": "node",
"esModuleInterop": true
}
}

Registry Publishing (Coming Soon)

The SDK is currently available via git dependencies only. Publication to official registries is planned:

  • 🔲 crates.io (Rust)
  • 🔲 PyPI (Python)
  • 🔲 npm (TypeScript)

Follow the GitHub repository for updates.