candle-semantic-router

Crates.iocandle-semantic-router
lib.rscandle-semantic-router
version0.4.0
created_at2025-08-22 02:10:48.870581+00
updated_at2025-08-22 02:10:48.870581+00
descriptionGo bindings for Candle BERT semantic similarity model for LLM routing
homepage
repository
max_upload_size
id1805801
size208,412
Huamin Chen (rootfs)

documentation

README

candle-binding

This directory contains Go bindings and tests for the candle_semantic_router native library.

Prerequisites

  • Go (>= 1.18)
  • Rust (for building the native library)
  • cargo (Rust's build tool)

Build the Native Library

Before running the Go tests, you must build the native library using Rust:

cd candle-binding
cargo build --release

This will produce the library file (e.g., libcandle_semantic_router.dylib on macOS) in candle-binding/target/release/.

Run the Go Tests

After building the native library, run the Go tests:

cd candle-binding
# If needed, set the library path (macOS):
export DYLD_LIBRARY_PATH=$(pwd)/target/release:$DYLD_LIBRARY_PATH

go test -v
  • The -v flag enables verbose output.
  • If you want to run a specific test, use:
    go test -v -run TestName
    
    Replace TestName with the name of the test function.

Troubleshooting

  • If you see an error like library 'candle_semantic_router' not found, make sure you have built the native library and that the library file exists in target/release/.
  • Ensure your DYLD_LIBRARY_PATH (macOS) or LD_LIBRARY_PATH (Linux) includes the path to the built library.

Notes

  • The Go tests depend on the native library being present and correctly built.
  • Some tests may download data from the internet (e.g., from norvig.com).
Commit count: 0

cargo fmt