Skip to content

docs: clarify MelleaSession vs functional.act() layering; add start_session() pin example#1283

Merged
planetf1 merged 5 commits into
generative-computing:mainfrom
planetf1:fix/issue-1276
Jun 19, 2026
Merged

docs: clarify MelleaSession vs functional.act() layering; add start_session() pin example#1283
planetf1 merged 5 commits into
generative-computing:mainfrom
planetf1:fix/issue-1276

Conversation

@planetf1

Copy link
Copy Markdown
Contributor

Doc-only. Two gaps that required source-diving to resolve.

functional.py module docstring — the old one-liner gave no guidance on when to reach for functional.act() vs session.act(). The new docstring calls it a low-level primitive and points to MelleaSession / start_session() for the common case.

Quickstart pinning examplestart_session() with no args appears in several places but the explicit mellea.start_session("ollama", IBM_GRANITE_4_1_3B) form didn't appear anywhere users land first. Added one snippet to the quickstart showing the import path, the pinning pattern, and a note that the with form closes the session automatically.

Compatibility: no concerns. MelleaSession.__enter__/__exit__ are implemented (session.py:276, 305), so the context manager form in the snippet is already supported. The argument order (backend_name then model_id) matches the signature. IBM_GRANITE_4_1_3B is also the default model_id, so the pinned example produces the same result as the no-args call.

Fixes #1276.

planetf1 added 3 commits June 17, 2026 10:02
…ession() pin example

- Update functional.py module docstring to label it as low-level
  primitives and direct general users to MelleaSession / start_session()
- Add explicit start_session("ollama", IBM_GRANITE_4_1_3B) example to
  quickstart immediately after the no-args form, showing the import path
  and pinning pattern

Closes generative-computing#1276

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
The "Three lines: …" sentence described the original 3-line example; after
inserting the pinned snippet above it, the sentence incorrectly appeared to
describe the new 5-line block. Reorder so the "Three lines:" paragraph and
the Full example link come first, then the explicit/pinned form follows.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
- Align new quickstart snippet to page's existing import style (import
  mellea / mellea.start_session) rather than the from-import form
- Add sentence after the pinned example noting the with block closes
  the session automatically
- Simplify Sphinx :class:/:func: cross-refs in functional.py module
  docstring to plain backticks (site is Docusaurus, not Sphinx)

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jun 17, 2026
planetf1 added 2 commits June 17, 2026 10:19
- Replace "reproducible behaviour across environments" with "ensuring the
  same model runs across all environments" — model pinning does not make
  LLM output deterministic
- Use mellea.model_ids.IBM_GRANITE_4_1_3B (public re-export) instead of
  the deep mellea.backends.model_ids path; removes the second import line
- Replace "avoid resource leaks" with an accurate description: the with
  block flushes telemetry and deregisters scoped plugins (no HTTP sockets
  are involved)

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
cleanup() ends the OTel span but does not force-flush the exporter queue;
"flushing telemetry" overstated what happens on context manager exit.

Assisted-by: Claude Code
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
@planetf1 planetf1 marked this pull request as ready for review June 17, 2026 11:22
@planetf1 planetf1 requested a review from a team as a code owner June 17, 2026 11:22

@akihikokuroda akihikokuroda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@planetf1 planetf1 added this pull request to the merge queue Jun 19, 2026
Merged via the queue into generative-computing:main with commit 894a445 Jun 19, 2026
9 checks passed
@planetf1 planetf1 deleted the fix/issue-1276 branch June 19, 2026 10:40
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.

docs: clarify MelleaSession vs functional.act() layering, and add explicit start_session() model-pinning example

3 participants