Support base64 embedding responses in the Rust SDK#86
Conversation
Deploying opensecret-sdk with
|
| Latest commit: |
3ba56e6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5ec46a0d.opensecret-sdk.pages.dev |
| Branch Preview URL: | https://codex-embeddings-api-investi.opensecret-sdk.pages.dev |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughRust embedding types now accept float-array or base64-string wire representations. Unit and integration tests validate both formats, accessor behavior, serialization, dimensions, decoded byte lengths, finiteness, and usage fields. The Rust package version is updated to 3.3.0. ChangesEmbedding format support
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
floatandbase64Why
Tinfoil already supports
encoding_format: "base64", and OpenSecret already preserves that provider response through its encrypted embeddings endpoint. The Rust SDK currently requires every embedding value to deserialize asVec<f64>, causing otherwise valid base64 responses to fail before Maple Proxy can return them.This fixes the response model at the SDK layer. No OpenSecret backend or Maple Proxy behavior change is needed.
Compatibility
This changes the Rust representation of
EmbeddingData.embeddingfromVec<f64>toEmbeddingVector. Consumers upgrading the SDK and directly reading that field can match the enum or useas_floats()/as_base64(). The HTTP API and wire format are unchanged.Testing
cargo test --lib --all-features— 32 passedcargo clippy --all-targets --all-features -- -D warningsencoding_format: "float"— 768 finite valuesencoding_format: "base64"— valid base64 decoding to 768 float32 valuesRelated to OpenSecretCloud/maple-proxy#40.
Summary by CodeRabbit
floatorbase64embedding encoding modes.