Repository navigation
contextual: expose named entities via ctxEntities() and the ctx_ent key-value - #386
Merged
Merged
Conversation
…ey-value
Read the entities the DCN serves on /v1beta1/contextual ({ name, kind,
score }) and emit their names under ctx_ent, highest score first,
sanitized like keywords and capped at 10. entityKey renames or disables
the key and maxEntities changes the cap. A response without the field
reads as no entities.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
willmacd
approved these changes
Nov 11, 2026
hashibit
reviewed
Nov 11, 2026
The DCN serves "product", never "brand_product". A NaN score sorted unpredictably and could drop a high-score entity past the cap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hashibit
approved these changes
Nov 11, 2026
mosherBT
approved these changes
Nov 11, 2026
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.
Why
/v1beta1/contextualnow returnsclassifications.entities, but the SDK doesn't surface it. Publishers have no way to read it or target on it.What Changed
contextual_segments: newContextualEntityKindandContextualEntitytypes (name,kind,score) and anentitiesfield onContextualClassifications.sdk: newctxEntities()accessor. It reads the cachedctxSegments()response and returns[]when the page has no entities, including when the DCN omits the field.ctxTargetingKeyValues: emits the multi-value keyctx_entwith the entity names, highest score first, sanitized like keywords and capped at 10. Kinds and scores aren't sent. The key is omitted when the page has no entities.options.entityKeyrenames the key and""opts out;options.maxEntitieschanges the cap.lib/addons/gpt.md.ctx_segmentspages show the entities.How to Test
.mdalongside the code (for examplelib/addons/<addon>.md) and the matching README section. New addons ship with a new.md.Notes
🤖 Generated with Claude Code