Repository navigation
fix(model): detect English requests with URLs in userLanguage (#111) - #167
Draft
santinofuentesAI wants to merge 2 commits into
Draft
santinofuentesAI wants to merge 2 commits into
santinofuentesAI wants to merge 2 commits into
Conversation
…dingLabs#111) Signed-off-by: Santino Fuentes <santinofuentesAI@users.noreply.github.com>
…dingLabs#111) Signed-off-by: Santino Fuentes <santinofuentesAI@users.noreply.github.com>
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.
What and why
Closes #111
Fixes
userLanguage()inpackages/model/src/prompt.tsso requests containing URLs are detected from the user's prose outside links rather than falling back to the phone's locale or letting URL segments skew detection:https?://\S+andwww.\S+) before scoring language signals, returningundefinedwhen only links or neutral text remain (so phone locale still decides).[¿¡ñáéíóú]) instead of short-circuiting on Spanish before checking English, and adds everyday Spanish and English verbs/connectors (read,and,summarize,for,it,open,check,explain,translate,lee,resúmeme,página/pagina,esta, etc.).a,me,resume,no) out of cross-language competition (ais checked only when neither language has stronger matches, with a comment explaining why), preserving Spanish detection on phrases like"resume esta página: https://recetas.example/sopa"and"resume esta pagina: https://recetas.example/sopa".packages/model/test/prompt-language.test.tsbefore updatingpackages/model/src/prompt.ts.Vision fit
Serves
VISION.mdprinciple 5 ("Spanish and English, first-class"): a request phrased in English (including short URL prompts likerefusal-recetario-6) now gets English detection and English code refusals regardless of whether the phone locale ises-419, without regressing Spanish requests that share ambiguous words likeresume.Non-negotiables
Checklist
acceptedproposal.pnpm check:privacy,pnpm typecheck,pnpm lint,pnpm testandnode scripts/guard/check.mjs --patterns scripts/guard/patterns.txt. (Checked againstorigin/main.)packages/copy, in es-419 and en, with matching keys and placeholders, and no em or en dashes.Model path
packages/model,agent,skillsoreval, the prompt, the router, tool descriptions, normalizers, examples or the model file.packages/model/test/prompt-language.test.tsand the full@hermit/modelsuite (20 files, 629 tests) plus all repo gates pass locally. No held-out case or eval fixture was read or edited.Marked Draft because I don't have
llama-serverand the GGUF model locally to run the before/after model evals (mac-eval.tsfirst-win,va,holdout, andbot-eval.ts) requested in #111.Screenshots
New dependencies and network calls
n/a
AI agents
userLanguage, running the test suite and all five repo gates, and drafting this PR description.