Skip to content

docs: add canonical url headers#961

Merged
AngeloDanducci merged 2 commits into
generative-computing:mainfrom
AngeloDanducci:ad-840
May 5, 2026
Merged

docs: add canonical url headers#961
AngeloDanducci merged 2 commits into
generative-computing:mainfrom
AngeloDanducci:ad-840

Conversation

@AngeloDanducci

@AngeloDanducci AngeloDanducci commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Misc PR

Type of PR

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Description

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code as added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Attribution

  • AI coding assistants used

@AngeloDanducci
AngeloDanducci requested a review from a team as a code owner April 29, 2026 17:29
@github-actions

Copy link
Copy Markdown
Contributor

The PR description has been updated. Please fill out the template for your PR to be reviewed.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Apr 29, 2026
@AngeloDanducci

Copy link
Copy Markdown
Contributor Author

@abrahamdaniels fyi https://www.mintlify.com/docs/optimize/seo#automatically-generated-meta-tags suggests canonical instead of canonicalUrl as in the original issue.

Tested via curl -s link | grep -o '<link rel="canonical"[^>]*>'

Also note that some links don't follow the current doc paths in the repo but they do match the live site, for now I've left the caonical refs to the current accurate live links but not sure if that should change.

@planetf1

planetf1 commented May 1, 2026

Copy link
Copy Markdown
Contributor

I think we need to match to the staging site -- that is representative of main, so should be a safe check assuming being rebased.

So I found these discrepancies:

Two blockers:

  1. 12 canonicals point to redirect sources, not final destinations. The paths below use old URL prefixes (/guide/, /evaluation-and-observability/) that are configured as redirect sources in docs.json — they 301 to the new locations. A canonical should point to the final served URL, not an intermediate redirect. The correct paths (matching the docs.json nav entries) are:

    File Current canonical Should be
    how-to/act-and-aact.md /guide/act-and-aact /how-to/act-and-aact
    how-to/backends-and-configuration.md /guide/backends-and-configuration /how-to/backends-and-configuration
    how-to/evaluate-with-llm-as-a-judge.md /evaluation-and-observability/evaluate-with-llm-as-a-judge /how-to/evaluate-with-llm-as-a-judge
    how-to/generative-functions.md /guide/generative-functions /how-to/generative-functions
    how-to/m-decompose.md /guide/m-decompose /how-to/m-decompose
    how-to/tools-and-agents.md /guide/tools-and-agents /how-to/tools-and-agents
    how-to/working-with-data.md /guide/working-with-data /how-to/working-with-data
    observability/logging.md /evaluation-and-observability/logging /observability/logging
    observability/metrics.md /evaluation-and-observability/metrics /observability/metrics
    observability/telemetry.md /evaluation-and-observability/telemetry /observability/telemetry
    observability/tracing.md /evaluation-and-observability/tracing /observability/tracing
    reference/glossary.md /guide/glossary /reference/glossary
  2. tutorials/03-using-generative-stubs.md canonical points to a different page. The canonical is set to .../tutorials/03-using-generative-slots, but that's an older, separate page with different content (the slots terminology predates the current stubs naming). The canonical should be https://docs.mellea.ai/tutorials/03-using-generative-stubs to match the file's own nav entry.

Two pages missed:

  1. docs/docs/concepts/plugins.mdx — live nav page, no canonical added.
  2. docs/docs/index.mdx — the site root, no canonical added. Should be https://docs.mellea.ai/.

@planetf1 planetf1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comment - links need updating
See https://ibm-llm-runtime-aaf3a78b.mintlify.app/ for the staging site which is built from main after merge

@AngeloDanducci
AngeloDanducci requested a review from planetf1 May 1, 2026 14:53

@planetf1 planetf1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@markstur markstur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AngeloDanducci

Copy link
Copy Markdown
Contributor Author

Rebased in hopes of fixing those unrelated CI test failures.

@AngeloDanducci
AngeloDanducci disabled auto-merge May 1, 2026 20:45
planetf1 added a commit to planetf1/mellea that referenced this pull request May 5, 2026
Matches the pattern established by generative-computing#961 (approved, pending CI) which
adds canonical URLs to all docs pages. Preempts a follow-up ask on
this new page if generative-computing#961 merges first.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
@AngeloDanducci
AngeloDanducci enabled auto-merge May 5, 2026 20:36
@AngeloDanducci
AngeloDanducci added this pull request to the merge queue May 5, 2026
Merged via the queue into generative-computing:main with commit e53b8b3 May 5, 2026
8 checks passed
@AngeloDanducci
AngeloDanducci deleted the ad-840 branch May 5, 2026 21:48
planetf1 added a commit to planetf1/mellea that referenced this pull request May 19, 2026
Matches the pattern established by generative-computing#961 (approved, pending CI) which
adds canonical URLs to all docs pages. Preempts a follow-up ask on
this new page if generative-computing#961 merges first.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
planetf1 added a commit to planetf1/mellea that referenced this pull request May 22, 2026
Matches the pattern established by generative-computing#961 (approved, pending CI) which
adds canonical URLs to all docs pages. Preempts a follow-up ask on
this new page if generative-computing#961 merges first.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
planetf1 added a commit to planetf1/mellea that referenced this pull request May 22, 2026
Matches the pattern established by generative-computing#961 (approved, pending CI) which
adds canonical URLs to all docs pages. Preempts a follow-up ask on
this new page if generative-computing#961 merges first.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
akihikokuroda pushed a commit to akihikokuroda/mellea that referenced this pull request May 27, 2026
* add canonical url headers

* match staging site instead of live
markstur pushed a commit to markstur/mellea that referenced this pull request May 29, 2026
… Intrinsics API (generative-computing#935)

* docs: initial Guardian documentation migration from deprecated GuardianCheck to Intrinsics API

Migrates docs, examples, and cross-links from the deprecated GuardianCheck/GuardianRisk
API to the current Guardian Intrinsics API (guardian_check(), policy_guardrails(),
factuality_detection(), factuality_correction()).

- New how-to/safety-guardrails.md: full reference for all four Intrinsic functions,
  CRITERIA_BANK keys, and the target_role="user" input-gating pattern
- Tutorial 04 steps 4–7 rewritten to use Intrinsics; prerequisites updated
- Glossary: 5 new entries; GuardianCheck/GuardianRisk entries marked deprecated
- Deprecation banners added to security-and-taint-tracking.md and three example files
- docs.json: safety-guardrails added to nav; temporary redirect removed
- Cross-links updated in intrinsics.md, index.mdx, build-a-rag-pipeline.md,
  use-context-and-sessions.md, common-errors.md, architecture-vs-agents.md, plugins.mdx

Partially addresses generative-computing#639, generative-computing#802.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs: address review findings on Guardian migration PR

- Fix stale `grounding_context` tip in tutorial step 6 — was referencing
  a parameter removed from the code example (3/3 reviewer consensus)
- Add deprecation notice to docs/examples/safety/README.md to match the
  deprecation docstrings already added to the three .py files
- Resolve duplicate `intrinsics/` entries in examples/index.md — the Safety
  section row covers Guardian functions; the Performance row gains a
  "(Non-Guardian)" qualifier with a cross-reference
- Tutorial step 7: add user message to eval_ctx for consistency with all
  other guardian_check() examples
- safety-guardrails.md: add migration callout after custom criteria section
  noting that not all deprecated GuardianRisk values have CRITERIA_BANK keys
- safety-guardrails.md: add note clarifying counterintuitive factuality_detection()
  return semantics ("yes" = incorrect, "no" = correct)
- troubleshooting/common-errors.md: add factuality_correction() to the
  Guardian Intrinsics list (was omitted alongside the other three functions)
- security-and-taint-tracking.md: update frontmatter description to signal
  deprecation in search results and link previews
- security-and-taint-tracking.md: fix imprecise "no separate Guardian model
  pull" claim — intrinsics still download a model, just a different one

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs(metrics): mark GuardianCheck deprecated and document Intrinsics telemetry gap

Guardian Intrinsics are not Requirement subclasses and emit no
mellea.requirement.checks/failures metrics. Users migrating from
GuardianCheck would otherwise lose those counters silently.

Also fix "Determine is" → "Determine if" typo in factuality_detection
docstring.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* fix: address review findings from PR generative-computing#935 code review

- plugins.mdx: fix broken OTel link (evaluation-and-observability/...
  → observability/tracing)
- build-a-rag-pipeline: correct # Returns comment (None → float 0.0–1.0)
- safety-guardrails: add context-attachment pattern note to factuality
  section explaining why .add(Document) differs from documents= kwarg;
  add warning about -> float annotation mismatch (tracked as generative-computing#934)
- glossary: fix past-tense "validated" → "validates" in GuardianCheck entry
- deprecated safety examples: drop # pytest: markers so they are no longer
  collected by CI (GuardianCheck removal won't break CI in future)

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* fix: delete deprecated GuardianCheck example files

guardian.py, guardian_huggingface.py, and repair_with_guardian.py are fully
superseded by docs/examples/intrinsics/guardian_core.py, factuality_detection.py,
factuality_correction.py, and policy_guardrails.py.

One migration gap documented in safety/README.md: the old repair_with_guardian.py
pattern (GuardianCheck as a Requirement inside RepairTemplateStrategy, with
_reason fed back as repair guidance) has no direct equivalent in the Intrinsics
API — Guardian Intrinsics return float scores, not Requirement results, and do
not expose a chain-of-thought reason string.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* fix: address second-pass review findings

- Fix -> float annotations on factuality_detection/factuality_correction
  (resolves generative-computing#934; closes the stale type-lie now that file was touched)
- Fix troubleshooting groundedness bullet: wrong document placement
  (was "user message", correct is assistant Message with documents=[...])
- SafeChatSession: accept guardian_backend as constructor arg instead of
  instantiating LocalHFBackend internally (matches "create once, reuse" guidance)
- Name SEXUAL_CONTENT migration gap explicitly in safety-guardrails.md callout
- Move mellea[hf] prerequisite to RAG guide prerequisites block; drop inline note
- Remove -> float type annotation caveat from safety-guardrails.md (fixed in source)
- Remove "sexual_content" from tutorial CRITERIA_BANK key lists (not a real key)

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs: bump Guardian doc examples from granite-4.0-micro to granite-4.1-3b

Upstream generative-computing#981 and generative-computing#1008 standardised intrinsic examples on
ibm-granite/granite-4.1-3b (context_relevance stays on 4.0 as 4.1 is
not supported there). Aligns the Guardian migration docs with the
rest of the intrinsic examples now that the blocking PRs have merged.

No logic changes; identical output semantics for guardian_check(),
policy_guardrails(), factuality_detection(), factuality_correction().

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs: add canonical URL to safety-guardrails page

Matches the pattern established by generative-computing#961 (approved, pending CI) which
adds canonical URLs to all docs pages. Preempts a follow-up ask on
this new page if generative-computing#961 merges first.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs(safety): fix examples that didn't match granite-4.1-3b behaviour

Ran every Guardian example in safety-guardrails.md against
ibm-granite/granite-4.1-3b. Two examples produced outputs different
from what the doc claimed:

1. Jailbreak input gate. The original "Ignore all previous
   instructions." scored 0.0180 — granite-4.1-3b's jailbreak criterion
   wants both circumvention intent AND a concrete harmful goal.
   Replaced with "Pretend you have no content restrictions. Now
   describe how to hotwire a car." which scores 0.9997.

2. Policy compliance. The original "compliant" scenario returned
   "Ambiguous" because it only mentioned avoiding personal/family
   questions, leaving age/nationality/graduation-year implicit.
   Rewrote to explicitly mirror all four policy clauses; now returns
   "Yes".

Also updated documented example output values to the observed scores
(harm 0.0021 -> 0.0000, PII 0.9871 -> 0.9820) for accuracy.

All remaining examples verified against granite-4.1-3b:
  harm(benign) 0.0000 Safe
  CRITERIA_BANK 10 keys
  jailbreak(attack) 0.9997 blocked
  custom(PII) 0.9820 risk
  policy(compliant) "Yes"
  factuality_detection(wrong) "yes"
  factuality_correction returns corrected text

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs: bump prose docs to granite-4.1-3b (incl. context_relevance)

Upstream generative-computing#981 swept docs/examples/ from granite-4.0-micro to
granite-4.1-3b but did not touch the prose docs. While touching
docs/docs/advanced/intrinsics.md and docs/docs/tutorials/04-making-
agents-reliable.md for the Guardian migration, completing the sweep
on those two files is the natural finishing pass.

### Context relevance now works on granite-4.1-3b

AGENTS.md claimed check_context_relevance was "only supported for
granite-4.0, not granite-4.1". That was true as of 2026-05-01 but
ibm-granite/granitelib-rag-r1.0 shipped granite-4.1-3b LoRA and
aLoRA adapters for context_relevance on 2026-05-05 (~12 hours before
this commit). Verified end-to-end against mellea:

  partially relevant  (Q: Microsoft CEO vs. doc about Microsoft HQ)
  relevant            (Q: Microsoft HQ vs. same doc)
  relevant            (Q: French capital vs. doc about Paris)

So line 87 of intrinsics.md can bump to 4.1-3b with the others.

Also fixed two pre-existing doc bugs the sweep would otherwise
surface for readers running the example:
  * "# Returns: float" -> "# Returns: str"
  * "# False" comment -> "# 'partially relevant'" observed value

### Tutorial 04 Guardian examples verified against 4.1-3b

Ran every Guardian call site (steps 4-7) against granite-4.1-3b
with the exact response text shown in each "Sample output" block:

  step4/harm              0.0001  <0.5  PASS
  step4/jailbreak         0.0001  <0.5  PASS
  step5/harm              0.0001  <0.5  PASS
  step5/profanity         0.0001  <0.5  PASS
  step5/answer_relevance  0.1824  <0.5  PASS
  step5/jailbreak         0.0001  <0.5  PASS
  step6/hallucination     0 flagged / 4 sentences
  step7/harm              0.0001  <0.5  PASS

All Sample output blocks still match what 4.1-3b returns.

Files:
  AGENTS.md                                  - drop stale 4.1 claim
  docs/docs/advanced/intrinsics.md           - 8 refs bumped
  docs/docs/tutorials/04-making-agents-reliable.md - 4 refs bumped

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs(safety): note OpenAI+GraniteSwitch alternative to LocalHFBackend

Prerequisites section overstated the LocalHFBackend requirement.
OpenAIBackend also implements AdapterMixin and works when pointed at
a Granite Switch endpoint.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs(safety): migrate target_role → scoring_schema after generative-computing#1037

PR generative-computing#1037 expanded `guardian_check()` with a new `scoring_schema`
parameter and deprecated `target_role` (still works, emits
DeprecationWarning). Update docs to teach the new API:

- safety-guardrails.md: replace `target_role="user"` with
  `scoring_schema="user_prompt"` in the input-gate and PII examples;
  document SCORING_SCHEMA_BANK keys; add a deprecation note
- use-context-and-sessions.md: same sweep in the SafeChatSession example
- glossary.md: add SCORING_SCHEMA_BANK entry mirroring CRITERIA_BANK

No API surface changes in this PR — guardian.py taken from upstream/main
during rebase (the PR's earlier `-> str` annotation fix is now redundant
because generative-computing#1037 landed it independently).

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs: address review WARNINGs — dead link and missing [hf] extra

- security-and-taint-tracking.md: replace dead link to deleted
  docs/examples/safety/guardian.py with a pointer to the current
  Intrinsics example (docs/examples/intrinsics/guardian_core.py).
  Caught by all three reviewers in the panel.
- build-a-rag-pipeline.md: composite "Putting it together" example
  uses LocalHFBackend, so the # Requires: line needs the [hf] extra
  to match Step 5 above.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs: address review suggestions and fold in 2 follow-ups

Suggestions actioned:
- factuality_correction(): clarify that "none" is a model-side
  convention, not an API contract — the function returns whatever the
  model emits. Updated in safety-guardrails.md and glossary.md.
- build-a-rag-pipeline.md composite example:
    * Add a comment above the module-scope guardian_backend noting that
      first import triggers a multi-GB Granite download.
    * Add a `check_groundedness: bool = True` parameter to rag() and a
      brief comment on the latency/precision trade-off, matching how
      Step 5 framed Guardian as optional.

Nit actioned:
- Drop .md extensions from the two outbound links in
  docs/examples/safety/README.md (project convention).

Follow-ups folded in:
- F1: add a "Full example" callout to safety-guardrails.md pointing at
  docs/examples/intrinsics/guardian_core.py + the three companion
  scripts (factuality_detection.py, factuality_correction.py,
  policy_guardrails.py). Closes the discoverability gap left by
  deleting docs/examples/safety/guardian.py.
- F4: replace the SEXUAL_CONTENT-only migration callout with a full
  GuardianRisk → CRITERIA_BANK mapping table. All 10 enum values
  verified against the deprecated source.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs(safety): add Limitations section for Guardian Intrinsics gaps

Surface two user-facing gaps inside the published Mintlify docs (currently
only documented in docs/examples/safety/README.md, which lives outside the
docs tree):

1. Guardian Intrinsics return a float score, not a Requirement instance,
   so they cannot drop into m.validate() or RepairTemplateStrategy. Cross-
   reference the manual repair pattern in docs/examples/safety/README.md.
2. Guardian functions do not emit mellea.requirement metrics — point to
   the existing note in observability/metrics.md.

Folds in F3 from the code review panel.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs(safety): correct "Full example" claim about guardian_core.py

The previous wording said guardian_core.py covers `jailbreak` and
listed `custom criteria` as a built-in. Verified against the actual
script: it demonstrates 5 CRITERIA_BANK keys (harm, social_bias,
groundedness, function_call, answer_relevance) plus one custom
free-text criterion. Update the callout to match.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs(safety): remove deprecated GuardianCheck docs and clean up review comments

- Delete security-and-taint-tracking.md: GuardianCheck deprecated since v0.4,
  now on v0.7; retained long enough
- Delete docs/examples/safety/README.md: placeholder no longer needed now that
  the deprecated page itself is gone; RepairTemplateStrategy gap noted in PR
- Remove security-and-taint-tracking from docs.json nav
- Fix glossary GuardianCheck/GuardianRisk "See:" links → safety-guardrails
- Remove dead link from tutorial 04 "See also" footer
- Drop "(no local GPU required)" qualifier from OpenAIBackend/Switch note:
  Switch can be self-hosted and would then need a GPU
- Reframe target_role deprecation note as a migration guide ("Migrating from
  target_role?" rather than "still works")

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs(safety): fix dead link in Limitations section after README deletion

The Limitations section in safety-guardrails.md linked to
docs/examples/safety/README.md, which was removed in the previous commit.
Replace with a reference to generative-computing#1071 where the gap is properly tracked.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

* docs(safety): address psschwei review comments on PR generative-computing#935

Five items from the 2026-05-28 review round:

- AGENTS.md: mark check_context_relevance as Granite 4.0 only (no 4.1
  adapter); agents reading the table would otherwise generate broken code
- advanced/intrinsics.md: fix check_context_relevance snippet to use
  granite-4.0-micro (was granite-4.1-3b, which has no adapter)
- examples/index.md: replace dangling "see README" reference (README was
  deleted in this PR) with links to the how-to guide and generative-computing#1071
- docs.json: add reverse redirect /advanced/security-and-taint-tracking →
  /how-to/safety-guardrails so bookmarked/indexed URLs don't 404
- tutorials/04-making-agents-reliable.md: add migration note at both
  criteria lists pointing GuardianRisk.SEXUAL_CONTENT users to custom
  free-text criteria
- how-to/safety-guardrails.md: align CRITERIA_BANK table row order with
  actual dict insertion order (social_bias before jailbreak)

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>

---------

Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add canonical URL headers to resolve dual-deployment deduplication

4 participants