anriltine commited on
Commit
fdbe25e
Β·
verified Β·
1 Parent(s): c3cffa7

Deploy TinyModel1Space from GitHub Actions

Browse files
scripts/nl_controls.py CHANGED
@@ -2875,6 +2875,59 @@ def _embedded_postmortem_format(m: str) -> tuple[str, str] | None:
2875
  return instr, "postmortem"
2876
 
2877
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2878
  def _embedded_five_whys(m: str) -> tuple[str, str] | None:
2879
  """``five_whys`` β€” iterative Why chain for root-cause analysis (distinct from full postmortem)."""
2880
  if len(m) < 48:
@@ -3593,7 +3646,7 @@ def analyze_embedded_prompt_signals(message: str) -> tuple[dict[str, str], list[
3593
  ``topic_must``, ``glossary``, ``spelling_uk``, ``spelling_us``, ``risks_mitigations``,
3594
  ``timeline_chron``, ``timeline_reverse``, ``voice_second``, ``voice_third``, ``faq_qa``,
3595
  ``summary_last``, ``decision_matrix``, ``build_vs_buy``, ``one_pager``, ``action_plan``, ``raci``, ``stakeholder_map``, ``swot``, ``pestle``, ``cost_benefit``, ``open_questions``, ``scenario_cases``,
3596
- ``postmortem``, ``five_whys``, ``fishbone``,
3597
  ``recommendation_first``,
3598
  ``go_no_go``,
3599
  ``frame_star``, ``frame_prep``, ``frame_irac``). Session-style overrides
@@ -3780,6 +3833,11 @@ def analyze_embedded_prompt_signals(message: str) -> tuple[dict[str, str], list[
3780
  extras.append(pm[0])
3781
  trace_tags.append(pm[1])
3782
 
 
 
 
 
 
3783
  fw = _embedded_five_whys(m)
3784
  if fw:
3785
  extras.append(fw[0])
 
2875
  return instr, "postmortem"
2876
 
2877
 
2878
+ def _embedded_sprint_retro(m: str) -> tuple[str, str] | None:
2879
+ """``sprint_retro`` β€” agile sprint retrospective layout (distinct from incident ``postmortem``)."""
2880
+ if len(m) < 48:
2881
+ return None
2882
+ no_sr = bool(
2883
+ re.search(
2884
+ r"\b(no sprint retro|without (?:a\s+)?sprint retro|not a sprint retro|"
2885
+ r"skip (?:the\s+)?sprint retro|don'?t use sprint retro|"
2886
+ r"avoid sprint retro(?:spective)? (?:format|sections)|"
2887
+ r"no (?:sprint\s+)?retrospective format|"
2888
+ r"skip (?:the\s+)?(?:sprint\s+)?retrospective format)\b",
2889
+ m,
2890
+ )
2891
+ )
2892
+ if no_sr:
2893
+ return None
2894
+ postmortem_only = bool(
2895
+ re.search(
2896
+ r"\b(postmortem format|blameless postmortem|incident postmortem|"
2897
+ r"post[- ]mortem format|postmortem outline)\b",
2898
+ m,
2899
+ )
2900
+ )
2901
+ if postmortem_only:
2902
+ return None
2903
+ want = bool(
2904
+ re.search(
2905
+ r"\b(sprint retro(?:spective)?(?:\s+format)?|"
2906
+ r"sprint retrospective(?:\s+format)?|"
2907
+ r"agile retro(?:spective)?|scrum retro(?:spective)?|"
2908
+ r"retro format|retrospective format|"
2909
+ r"run (?:a\s+)?(?:sprint\s+)?retro(?:spective)?|"
2910
+ r"facilitate (?:a\s+)?(?:sprint\s+)?retro(?:spective)?)\b",
2911
+ m,
2912
+ )
2913
+ )
2914
+ if not want:
2915
+ return None
2916
+ if not re.search(
2917
+ r"\b(sprint|iteration|scrum|agile|team|delivery|release|"
2918
+ r"reflect|review|improve|outline|write|describe|facilitate|discuss)\b",
2919
+ m,
2920
+ ):
2921
+ return None
2922
+ instr = (
2923
+ "The user wants a **sprint retrospective** layout: use markdown headings "
2924
+ "**Sprint / period** (one line), **What went well**, **What didn't go well**, "
2925
+ "**Ideas / experiments**, and **Action items** (concrete next-sprint improvements)β€”"
2926
+ "stay blameless and team-focused; this is **not** an incident postmortem."
2927
+ )
2928
+ return instr, "sprint_retro"
2929
+
2930
+
2931
  def _embedded_five_whys(m: str) -> tuple[str, str] | None:
2932
  """``five_whys`` β€” iterative Why chain for root-cause analysis (distinct from full postmortem)."""
2933
  if len(m) < 48:
 
3646
  ``topic_must``, ``glossary``, ``spelling_uk``, ``spelling_us``, ``risks_mitigations``,
3647
  ``timeline_chron``, ``timeline_reverse``, ``voice_second``, ``voice_third``, ``faq_qa``,
3648
  ``summary_last``, ``decision_matrix``, ``build_vs_buy``, ``one_pager``, ``action_plan``, ``raci``, ``stakeholder_map``, ``swot``, ``pestle``, ``cost_benefit``, ``open_questions``, ``scenario_cases``,
3649
+ ``postmortem``, ``sprint_retro``, ``five_whys``, ``fishbone``,
3650
  ``recommendation_first``,
3651
  ``go_no_go``,
3652
  ``frame_star``, ``frame_prep``, ``frame_irac``). Session-style overrides
 
3833
  extras.append(pm[0])
3834
  trace_tags.append(pm[1])
3835
 
3836
+ srt = _embedded_sprint_retro(m)
3837
+ if srt:
3838
+ extras.append(srt[0])
3839
+ trace_tags.append(srt[1])
3840
+
3841
  fw = _embedded_five_whys(m)
3842
  if fw:
3843
  extras.append(fw[0])
scripts/universal_brain_chat.py CHANGED
@@ -112,7 +112,7 @@ from rag_faq_smoke import _pick_model, hybrid_retrieve, load_chunks # noqa: E40
112
  from tinymodel_runtime import TinyModelRuntime # noqa: E402
113
 
114
  HELP_TEXT = """**How to use**
115
- - **Normal language:** ask in plain English (or mixed); the app **infers** what you want (summarize, search FAQ, save a note, etc.). Longer prompts may also **imply** reply shape for that turn only (for example trade-off questions β†’ Pros/Cons layout or flowing prose comparison, β€œin a table” β†’ markdown table preference, **no tables / tabular format in prose** β†’ table style prefer or avoid, β€œanswer in Spanish” β†’ reply language, **code only** β†’ code-first output, **explain the code / not code only in prose** β†’ code with explanation, **pseudocode vs runnable code in prose** β†’ algorithm layout, **cite your sources / no source links in prose** β†’ citation style, **rank options in priority order in prose** β†’ ranked_options, **decision matrix / criteria-as-rows in prose** β†’ decision_matrix, **build vs buy / make vs buy in prose** β†’ build_vs_buy, **one-pager / single-page executive brief in prose** β†’ one_pager, **action plan with owners and due dates in prose** β†’ action_plan, **RACI matrix / role assignment in prose** β†’ raci, **stakeholder map / influence-interest in prose** β†’ stakeholder_map, **exactly N options/alternatives in prose** β†’ options_n=N, **Mermaid/flowchart vs no diagrams in prose** β†’ diagram layout, **risks/downside vs benefits-first section order in prose** β†’ risks_first / benefits_first, **risks and mitigations / risk register in prose** β†’ risks_mitigations, **rewrite/polish my draft in prose** β†’ revise_draft, **write/draft an email in prose** β†’ email_format, **meeting agenda / timeboxed run-of-show in prose** β†’ meeting_agenda, **before/after or track-changes on my draft in prose** β†’ revise_diff, **don’t mention X / avoid discussing Y in prose** β†’ topic_guard, **must cover / include a section on Z in prose** β†’ topic_must, **STAR / PREP / IRAC format in prose** β†’ frame_star / frame_prep / frame_irac, **SWOT analysis in prose** β†’ swot, **PESTLE macro-environment analysis in prose** β†’ pestle, **cost-benefit / CBA in prose** β†’ cost_benefit, **open questions / TBD section in prose** β†’ open_questions, **best/base/worst case scenario analysis in prose** β†’ scenario_cases, **blameless postmortem format in prose** β†’ postmortem, **five whys / 5 whys root cause in prose** β†’ five_whys, **fishbone / Ishikawa cause-and-effect in prose** β†’ fishbone, **checklist / tick-box format in prose** β†’ checklist layout, **in under N words** β†’ length cap, **be brief / more detail in prose** β†’ verbosity brief or detailed, **hints only / don’t give the full solution** β†’ guided discovery, **give me the full solution in prose** β†’ full_solution (not hints), **red team / sanity check my plan** β†’ challenge-style pushback, **be supportive / assume good intent on my plan** β†’ supportive coaching, **don’t remember this / off the record** β†’ ephemeral hint, **screen reader friendly / WCAG** β†’ accessibility layout hint, **ELI5 / lay audience in a long question** β†’ beginner audience, **assume I'm technical / expert depth in prose** β†’ technical audience, **board-ready / Slack-casual wording** β†’ formal or casual register, **valid JSON / return JSON in prose** β†’ JSON output mode, **plain text only / no JSON in prose** β†’ plain output format, **don’t guess / stick to facts in prose** β†’ strict speculation, **brainstorm freely / wild ideas in prose** β†’ creative speculation, **TLDR first / BLUF in prose** β†’ summary-first open, **lead with your recommendation in prose** β†’ recommendation_first, **go/no-go gate verdict in prose** β†’ go_no_go, **summary at the end / closing recap in prose** β†’ summary_last, **answer directly / skip the summary in prose** β†’ direct opening, **FAQ direct quotes vs paraphrase-only in prose** β†’ quote style for excerpts, **emoji ok vs no emoji in prose** β†’ emoji style, **FAQ-only vs FAQ-plus-general-knowledge in prose** β†’ FAQ grounding, **show work vs final-answer-only in prose** β†’ math detailing, **state assumptions / limitations / caveats** in prose β†’ transparent confidence tone, **be decisive / don’t hedge in prose** β†’ assertive confidence tone, **curl/bash/kubectl in prose** β†’ runnable commands, **conceptual only / no commands in prose** β†’ conceptual actionability, **bullet points vs plain paragraphs in prose** β†’ reply format, **step-by-step vs continuous procedure prose in long prompts** β†’ step style, **concrete / worked / toy example in prose** β†’ richer examples, **example-free / skip examples in prose** β†’ sparser examples, **define terms first / intuition or big-picture first in prose** β†’ explanation order, **no questions at the end / suggest next steps in prose** β†’ closing style, **ask questions before answering / answer without clarifiers in prose** β†’ clarify-first mode, **markdown section headings vs flat prose in long prompts** β†’ section layout, **analogy vs literal-only in long prompts** β†’ analogy style, **bold key terms vs minimal bold in long prompts** β†’ term emphasis, **spell out acronyms vs terse acronyms in long prompts** β†’ acronym style, **err on the side of safety vs ship-fast pragmatism in long prompts** β†’ risk posture, **fenced code blocks vs inline-only snippets in long prompts** β†’ code block style) β€” see *Brain trace* **`prompt_signals:`** when detected.
116
  - **Session controls (say it in chat, no slash command):**
117
  - *What is my current scope?*, *Show my session settings* -> prints scope + toggles (FAQ context, routing, trace)
118
  - *Start a new private session*, *Begin a fresh scope* -> generates a **new memory scope key** so notes are isolated from the shared default demo scope
@@ -205,7 +205,7 @@ These behaviors apply when your line is handled as **normal chat** (not a short
205
  **How to test (two sends):**
206
  1. Send **Show the brain trace** as its **own short line** (do **not** combine it with your question in one message).
207
  2. Send your **long** test prompt as a **separate** message.
208
- 3. Scroll to the bottom of the assistant reply and look for **`prompt_signals:`** in the *Brain trace* footer (e.g. **`prompt_signals:stakeholder_map`**).
209
 
210
  **If you only see** `classify:…` / `RAG:…` **without** `prompt_signals:…`, the live Space may be running an older build β€” redeploy via GitHub Actions **Deploy versioned space artifact to Hugging Face** after merging, then hard-refresh the Space.
211
 
@@ -274,6 +274,7 @@ These behaviors apply when your line is handled as **normal chat** (not a short
274
  | UK vs US spelling | In a **long** message, ask for **British English** / **UK spelling** (e.g. colour, organise) **or** **American English** / **US spelling** (e.g. color, organize). Avoid mixing both locales in one line. | **`spelling_uk`** or **`spelling_us`** in **`prompt_signals:`**; reply should use that spelling convention throughout |
275
  | Chronological timeline | In a **long** history or incident question, ask for **chronological order**, **timeline format**, **what happened when**, or **earliest β†’ latest** (oldest first). **Or** ask for **reverse chronological**, **newest first**, or **most recent event first** (avoid mixing both explicit orders in one line). | **`timeline_chron`** or **`timeline_reverse`** in **`prompt_signals:`**; reply should list dated/phased milestones in that time order |
276
  | Blameless postmortem | In a **long** incident or outage write-up, ask for **postmortem format**, a **blameless postmortem**, or a **postmortem outline** with summary, impact, timeline, root cause, lessons learned, and action items (avoid mixing with **no postmortem format** / **skip postmortem** in the same line). | **`postmortem`** in **`prompt_signals:`**; reply should use standard postmortem section headings |
 
277
  | 5 Whys root-cause analysis | In a **long** incident or defect question, ask for a **five whys**, **5 whys analysis**, **root cause using 5 whys**, or **ask why five times** (avoid mixing with **no five whys** / **skip the why chain** in the same line). | **`five_whys`** in **`prompt_signals:`**; reply should use **Problem statement**, **Why 1–5**, and **Root cause** |
278
  | Fishbone / Ishikawa diagram | In a **long** quality or incident question, ask for a **fishbone diagram**, **Ishikawa analysis**, **cause-and-effect diagram**, or **fishbone format** with categorized causes (avoid mixing with **no fishbone** / **skip fishbone** in the same line). | **`fishbone`** in **`prompt_signals:`**; reply should use **Problem / Effect** plus category headings (People, Process, Technology, etc.) with sub-causes |
279
  | Second vs third person voice | In a **long** how-to or doc draft, ask to **address the reader as you**, **use second person**, or **speak directly to me**. **Or** ask for **third person**, **impersonal tone**, or **avoid second person** / **don't use you throughout** (avoid mixing both in one line). | **`voice_second`** or **`voice_third`** in **`prompt_signals:`**; reply should use you/your or neutral third-person phrasing accordingly |
 
112
  from tinymodel_runtime import TinyModelRuntime # noqa: E402
113
 
114
  HELP_TEXT = """**How to use**
115
+ - **Normal language:** ask in plain English (or mixed); the app **infers** what you want (summarize, search FAQ, save a note, etc.). Longer prompts may also **imply** reply shape for that turn only (for example trade-off questions β†’ Pros/Cons layout or flowing prose comparison, β€œin a table” β†’ markdown table preference, **no tables / tabular format in prose** β†’ table style prefer or avoid, β€œanswer in Spanish” β†’ reply language, **code only** β†’ code-first output, **explain the code / not code only in prose** β†’ code with explanation, **pseudocode vs runnable code in prose** β†’ algorithm layout, **cite your sources / no source links in prose** β†’ citation style, **rank options in priority order in prose** β†’ ranked_options, **decision matrix / criteria-as-rows in prose** β†’ decision_matrix, **build vs buy / make vs buy in prose** β†’ build_vs_buy, **one-pager / single-page executive brief in prose** β†’ one_pager, **action plan with owners and due dates in prose** β†’ action_plan, **RACI matrix / role assignment in prose** β†’ raci, **stakeholder map / influence-interest in prose** β†’ stakeholder_map, **exactly N options/alternatives in prose** β†’ options_n=N, **Mermaid/flowchart vs no diagrams in prose** β†’ diagram layout, **risks/downside vs benefits-first section order in prose** β†’ risks_first / benefits_first, **risks and mitigations / risk register in prose** β†’ risks_mitigations, **rewrite/polish my draft in prose** β†’ revise_draft, **write/draft an email in prose** β†’ email_format, **meeting agenda / timeboxed run-of-show in prose** β†’ meeting_agenda, **before/after or track-changes on my draft in prose** β†’ revise_diff, **don’t mention X / avoid discussing Y in prose** β†’ topic_guard, **must cover / include a section on Z in prose** β†’ topic_must, **STAR / PREP / IRAC format in prose** β†’ frame_star / frame_prep / frame_irac, **SWOT analysis in prose** β†’ swot, **PESTLE macro-environment analysis in prose** β†’ pestle, **cost-benefit / CBA in prose** β†’ cost_benefit, **open questions / TBD section in prose** β†’ open_questions, **best/base/worst case scenario analysis in prose** β†’ scenario_cases, **blameless postmortem format in prose** β†’ postmortem, **sprint retrospective / retro format in prose** β†’ sprint_retro, **five whys / 5 whys root cause in prose** β†’ five_whys, **fishbone / Ishikawa cause-and-effect in prose** β†’ fishbone, **checklist / tick-box format in prose** β†’ checklist layout, **in under N words** β†’ length cap, **be brief / more detail in prose** β†’ verbosity brief or detailed, **hints only / don’t give the full solution** β†’ guided discovery, **give me the full solution in prose** β†’ full_solution (not hints), **red team / sanity check my plan** β†’ challenge-style pushback, **be supportive / assume good intent on my plan** β†’ supportive coaching, **don’t remember this / off the record** β†’ ephemeral hint, **screen reader friendly / WCAG** β†’ accessibility layout hint, **ELI5 / lay audience in a long question** β†’ beginner audience, **assume I'm technical / expert depth in prose** β†’ technical audience, **board-ready / Slack-casual wording** β†’ formal or casual register, **valid JSON / return JSON in prose** β†’ JSON output mode, **plain text only / no JSON in prose** β†’ plain output format, **don’t guess / stick to facts in prose** β†’ strict speculation, **brainstorm freely / wild ideas in prose** β†’ creative speculation, **TLDR first / BLUF in prose** β†’ summary-first open, **lead with your recommendation in prose** β†’ recommendation_first, **go/no-go gate verdict in prose** β†’ go_no_go, **summary at the end / closing recap in prose** β†’ summary_last, **answer directly / skip the summary in prose** β†’ direct opening, **FAQ direct quotes vs paraphrase-only in prose** β†’ quote style for excerpts, **emoji ok vs no emoji in prose** β†’ emoji style, **FAQ-only vs FAQ-plus-general-knowledge in prose** β†’ FAQ grounding, **show work vs final-answer-only in prose** β†’ math detailing, **state assumptions / limitations / caveats** in prose β†’ transparent confidence tone, **be decisive / don’t hedge in prose** β†’ assertive confidence tone, **curl/bash/kubectl in prose** β†’ runnable commands, **conceptual only / no commands in prose** β†’ conceptual actionability, **bullet points vs plain paragraphs in prose** β†’ reply format, **step-by-step vs continuous procedure prose in long prompts** β†’ step style, **concrete / worked / toy example in prose** β†’ richer examples, **example-free / skip examples in prose** β†’ sparser examples, **define terms first / intuition or big-picture first in prose** β†’ explanation order, **no questions at the end / suggest next steps in prose** β†’ closing style, **ask questions before answering / answer without clarifiers in prose** β†’ clarify-first mode, **markdown section headings vs flat prose in long prompts** β†’ section layout, **analogy vs literal-only in long prompts** β†’ analogy style, **bold key terms vs minimal bold in long prompts** β†’ term emphasis, **spell out acronyms vs terse acronyms in long prompts** β†’ acronym style, **err on the side of safety vs ship-fast pragmatism in long prompts** β†’ risk posture, **fenced code blocks vs inline-only snippets in long prompts** β†’ code block style) β€” see *Brain trace* **`prompt_signals:`** when detected.
116
  - **Session controls (say it in chat, no slash command):**
117
  - *What is my current scope?*, *Show my session settings* -> prints scope + toggles (FAQ context, routing, trace)
118
  - *Start a new private session*, *Begin a fresh scope* -> generates a **new memory scope key** so notes are isolated from the shared default demo scope
 
205
  **How to test (two sends):**
206
  1. Send **Show the brain trace** as its **own short line** (do **not** combine it with your question in one message).
207
  2. Send your **long** test prompt as a **separate** message.
208
+ 3. Scroll to the bottom of the assistant reply and look for **`prompt_signals:`** in the *Brain trace* footer (e.g. **`prompt_signals:sprint_retro`** or **`prompt_signals:stakeholder_map`**).
209
 
210
  **If you only see** `classify:…` / `RAG:…` **without** `prompt_signals:…`, the live Space may be running an older build β€” redeploy via GitHub Actions **Deploy versioned space artifact to Hugging Face** after merging, then hard-refresh the Space.
211
 
 
274
  | UK vs US spelling | In a **long** message, ask for **British English** / **UK spelling** (e.g. colour, organise) **or** **American English** / **US spelling** (e.g. color, organize). Avoid mixing both locales in one line. | **`spelling_uk`** or **`spelling_us`** in **`prompt_signals:`**; reply should use that spelling convention throughout |
275
  | Chronological timeline | In a **long** history or incident question, ask for **chronological order**, **timeline format**, **what happened when**, or **earliest β†’ latest** (oldest first). **Or** ask for **reverse chronological**, **newest first**, or **most recent event first** (avoid mixing both explicit orders in one line). | **`timeline_chron`** or **`timeline_reverse`** in **`prompt_signals:`**; reply should list dated/phased milestones in that time order |
276
  | Blameless postmortem | In a **long** incident or outage write-up, ask for **postmortem format**, a **blameless postmortem**, or a **postmortem outline** with summary, impact, timeline, root cause, lessons learned, and action items (avoid mixing with **no postmortem format** / **skip postmortem** in the same line). | **`postmortem`** in **`prompt_signals:`**; reply should use standard postmortem section headings |
277
+ | Sprint retrospective (retro) | In a **long** agile team reflection, ask for a **sprint retro**, **sprint retrospective format**, **retro format**, or **facilitate a retrospective** for an iteration (avoid mixing with **no sprint retro** / **skip retrospective format**; use **Postmortem** for incident/outage write-ups). | **`sprint_retro`** in **`prompt_signals:`**; reply should use **What went well**, **What didn't go well**, **Ideas / experiments**, **Action items** |
278
  | 5 Whys root-cause analysis | In a **long** incident or defect question, ask for a **five whys**, **5 whys analysis**, **root cause using 5 whys**, or **ask why five times** (avoid mixing with **no five whys** / **skip the why chain** in the same line). | **`five_whys`** in **`prompt_signals:`**; reply should use **Problem statement**, **Why 1–5**, and **Root cause** |
279
  | Fishbone / Ishikawa diagram | In a **long** quality or incident question, ask for a **fishbone diagram**, **Ishikawa analysis**, **cause-and-effect diagram**, or **fishbone format** with categorized causes (avoid mixing with **no fishbone** / **skip fishbone** in the same line). | **`fishbone`** in **`prompt_signals:`**; reply should use **Problem / Effect** plus category headings (People, Process, Technology, etc.) with sub-causes |
280
  | Second vs third person voice | In a **long** how-to or doc draft, ask to **address the reader as you**, **use second person**, or **speak directly to me**. **Or** ask for **third person**, **impersonal tone**, or **avoid second person** / **don't use you throughout** (avoid mixing both in one line). | **`voice_second`** or **`voice_third`** in **`prompt_signals:`**; reply should use you/your or neutral third-person phrasing accordingly |