Repository navigation
feat(insights): rank optional context when sources exceed the budget - #864
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Candidate relevance already calls Jev with a plain fetch, and ai@6 pins a gateway provider without evaluation models. Export that call as evaluateWithJev and reuse it for context ranking instead of adding @ai-sdk/gateway. Ranking usage now goes through recordUsage, since billUsage was removed on staging.
b145be6 to
de17aa8
Compare
|
The latest updates on your projects. Learn more about Unkey Deploy
|
|
When the final profile and recalled-context merge exceeds the native source budget, relevant page excerpts can be omitted before an investigation sees them. This change uses one Jev evaluation to rank competing optional pages for the current subject, then applies the existing native packing rules.
The profile, canonical replies, original homepage, source contents, provenance, and budget stay under native control. Contexts that fit skip evaluation. Oversized input, unavailable billing, provider errors, invalid answers, and the one-second provider deadline return the exact native fallback. Returned usage is recorded before answer validation. The implementation covers fresh investigations and analysis replies; shadow runs require explicit injection, and clarifications/deterministic verification keep their current behavior.
Validation: repository lint and all 33 type-check tasks pass; 699 Insights tests pass (6 existing live tests skipped); 20 shared context/usage tests pass (1 existing service-dependent test skipped); the new ranking tests also pass an explicit TypeScript check. A frozen 48-investigation synthetic baseline/candidate comparison is running; this draft will be updated with the full quality and latency results. No production data, deployment, or merge is included.
Based directly on current staging; no unmerged PR dependency. Known overlaps: #849 shares the Gateway dependency, Jev price mapping, and nearby generation wiring; #842 shares Gateway lock entries; #751 owns broader business-context changes. This slice only changes final-merge page prioritization and reuses native packing.
Summary by cubic
Ranks competing optional pages with a single Jev call so the final profile/recall merge no longer drops relevant excerpts when it exceeds the native source budget.
typesafe-ai/jevpricing to agent credits.Written for commit de17aa8. Summary will update on new commits.