Skip to content

Replace Python embeddings with native Rust fastembed#325

Open
ijroth wants to merge 4 commits into
developfrom
refactor/rust-fastembed
Open

Replace Python embeddings with native Rust fastembed#325
ijroth wants to merge 4 commits into
developfrom
refactor/rust-fastembed

Conversation

@ijroth

@ijroth ijroth commented Feb 17, 2026

Copy link
Copy Markdown

Summary

  • Replaces Python-based embeddings (pyo3/fastembed) with a native Rust implementation using the fastembed crate
  • Removes all Python dependencies (requirements.txt, requirements-cpu.txt, pyo3 bindings, Python scripts)
  • Converts CI and release workflows to cross-platform matrix builds (linux-x86_64, macos-arm64, windows-x86_64)
  • Simplifies Dockerfiles by removing Python installation steps
  • Removes the Python-based MCP server implementation

Changes

  • src/embeddings/mod.rs — New native Rust embedding module replacing src/python/
  • src/python/ — Entire directory removed (embeddings, MCP, scripts)
  • .github/workflows/ — CI and release builds updated for cross-platform matrix strategy
  • docker/ — Dockerfiles simplified without Python
  • Cargo.toml — Swapped pyo3 for fastembed crate

Test plan

  • cargo build succeeds
  • cargo test --all passes
  • Embedding generation works with the native Rust implementation
  • Release workflow builds for all three platforms

🤖 Generated with Claude Code

ijroth and others added 4 commits February 16, 2026 12:54
Replace the Python-based embeddings layer (via PyO3) with a pure Rust
implementation using the fastembed crate. This eliminates the Python
dependency for embedding generation, reducing complexity (venv management,
script extraction, GIL overhead) while maintaining identical functionality.

- Create src/embeddings/mod.rs with EmbeddingsService using fastembed crate
- Move Model/Intent enums from python::embeddings to new embeddings module
- Update read/write context structs and all consumers
- Slim PythonService down to MCP-only (initialize_for_mcp)
- Remove PythonLoggingLevel from AI config
- Delete src/python/embeddings.rs and Python embedding scripts
- Update import paths across ~30 files

Python/PyO3 is retained solely for the MCP service.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove all Python/PyO3 dependencies (pyo3, serde-pyobject, include_dir),
the Python MCP module, and Python setup from CI, Docker, and the binary
entrypoint. The update_mcp_endpoint handler (which only uses WriteSide)
is preserved in admin.rs. Replace the single-platform release workflow
with a matrix strategy building for linux-x86_64, macos-arm64,
macos-x86_64, and windows-x86_64 (3 binary variants each). Simplify
Dockerfiles to two-stage Rust-only builds with debian:bookworm-slim
runtime. Fix flaky vector search test by adding similarity thresholds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Apple has discontinued Intel Macs and the macos-13 runner is deprecated.
Drop the x86_64-apple-darwin target from the release workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ci: remove macos-x86_64 from release build matrix
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


ijroth seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants