Skip to content

Implement EmbeddingGemma FFI bridge #7

Closed

Description

@ajianaz

Summary

Bridge Rust ↔ Python EmbeddingGemma ONNX via subprocess FFI. This is v2 approach — onnxruntime-rs migration deferred to v2.1.

Acceptance Criteria

  • embed(text) → Vec (768d) via Python subprocess call
  • embed_batch(texts) → Vec<Vec> for bulk operations
  • Configurable Python path and model path
  • Error handling: Python not found, model not found, timeout
  • Cold start caching: embed subprocess spawned once, reused
  • Fallback: if Python FFI fails, log warning and continue without embeddings
  • Integration test: embed known text, verify 768d output, cosine similarity >0.9 for near-duplicate texts

Technical Notes

  • Python script: call existing embeddinggemma.py (onnxruntime + tokenizers)
  • Input: text string via stdin/argv
  • Output: JSON array of floats via stdout
  • Model: /opt/data/models/embeddinggemma/onnx/model_q4.onnx (188MB)

Deliverable

Working embed() function that returns 768d vectors.
Estimated: 8h

Activity

  1. added this to the Phase 1: Core Engine milestone on May 29, 2026
  2. added
    scope:core
    type:feature
    on May 29, 2026
  3. ajianaz commented on May 29, 2026

    @ajianaz
    CollaboratorAuthor

    Implemented in develop branch

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope:coretype:feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions