| Crates.io | objectiveai-wasm-js |
| lib.rs | objectiveai-wasm-js |
| version | 0.1.3 |
| created_at | 2026-01-12 20:39:48.521956+00 |
| updated_at | 2026-01-23 19:43:36.624631+00 |
| description | JavaScript WebAssembly bindings for ObjectiveAI |
| homepage | https://objective-ai.io |
| repository | https://github.com/ObjectiveAI/objectiveai |
| max_upload_size | |
| id | 2038822 |
| size | 39,994 |
WebAssembly bindings for ObjectiveAI, providing JavaScript/TypeScript access to client-side validation and compilation.
This crate compiles Rust code from objectiveai-rs to WebAssembly, enabling browser-based applications to:
| Function | Description |
|---|---|
validateEnsembleLlm(llm) |
Validates an Ensemble LLM configuration and computes its content-addressed ID |
validateEnsemble(ensemble) |
Validates an Ensemble configuration and computes its content-addressed ID |
compileFunctionTasks(function, input) |
Compiles a Function's task expressions for a given input |
compileFunctionOutput(function, input, taskOutputs) |
Computes the final output of a Function given input and task results |
promptId(prompt) |
Computes a content-addressed ID for chat messages |
toolsId(tools) |
Computes a content-addressed ID for a tools array |
vectorResponseId(response) |
Computes a content-addressed ID for a vector completion response option |
This crate is consumed via the objectiveai npm package. The TypeScript SDK wraps these functions with proper type definitions.
import { validateEnsembleLlm, validateEnsemble } from 'objectiveai';
// Validate and get ID for an Ensemble LLM
const validatedLlm = validateEnsembleLlm({
model: 'openai/gpt-4o',
temperature: 0.7,
});
// Validate and get ID for an Ensemble
const validatedEnsemble = validateEnsemble({
llms: [validatedLlm],
});
Requires wasm-pack:
# Install wasm-pack
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# Build for bundler (webpack, etc.)
wasm-pack build --target bundler
# Build for Node.js
wasm-pack build --target nodejs
# Build for web (no bundler)
wasm-pack build --target web
# Run tests
cargo test
# Build documentation
cargo doc --no-deps --open
See the LICENSE file in this directory.