feat: reference contextual signal encoder with model descriptor#11
Open
esteininger wants to merge 2 commits intoIABTechLab:mainfrom
Open
feat: reference contextual signal encoder with model descriptor#11esteininger wants to merge 2 commits intoIABTechLab:mainfrom
esteininger wants to merge 2 commits intoIABTechLab:mainfrom
Conversation
added 2 commits
April 13, 2026 14:52
Adds a public-lane encoder that generates ORTB-compatible contextual embeddings with a model descriptor envelope (name, version, embedding space ID, metric) for cross-party interoperability. - POST /encode: text or URL → embedding segment with model metadata - Pluggable provider interface for public/private lane pattern - sentence-transformers default (shared embedding space) - 8 tests covering wire format, model descriptor, and space identification
…criptor Removed the custom ModelDescriptor type. Now uses the fields already defined in specs/v1.0/embedding_format.schema.json (version, embedding_space_id, metric) directly on the embedding ext object.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The scoring service consumes embeddings but the spec has no reference for producing them. This adds a contextual signal encoder — content in, ORTB-compatible embedding out — using the model metadata fields already defined in
embedding_format.schema.json(version,embedding_space_id,metric).No new schema — this is a reference implementation of what the spec already describes.
Public lane / private lane
Ships with sentence-transformers as the "public lane" — a standardized open-source model any party can use. The
EmbeddingProviderinterface supports private-lane providers. The spec metadata fields travel with every embedding regardless of which lane produced it.Output format
Uses fields from
specs/v1.0/embedding_format.schema.json:{ "ext": { "ver": "1.0", "vector": [0.042, -0.118, "..."], "model": "all-MiniLM-L6-v2", "dimension": 384, "type": "context", "version": "2.0.0", "embedding_space_id": "aa://spaces/contextual/sentence-transformers/minilm-l6-v2", "metric": "cosine" } }Output plugs directly into
POST /scoreas auser.data[]entry.Designed as a foundation for benchmarking and re-embedding
The pluggable provider interface and spec-defined metadata fields support two follow-on capabilities:
1. Benchmarking — run multiple providers against the same test corpus, compare results. The interface already supports swapping encoders; the spec metadata makes results reproducible.
2. Re-embedding / upgrade path — when a new model is adopted,
embedding_space_id+versionidentify which vectors need migration. A migration tool re-encodes through a new provider, outputs to a new space, and both run in parallel. The scoring service partitions by model name, so old and new coexist.The provider interface is minimal (2 methods) so any embedding backend can be dropped in without changing the encoder, wire format, or scoring integration.
Changes
POST /encodeendpoint (text or URL input)EmbeddingProviderinterface for pluggable public/private backendsTest plan
pytest tests/ -v— 9 passing