Skip to content

docs(models): config-selectable backends (backend: <module>)#556

Closed
heskew wants to merge 4 commits into
mainfrom
docs/models-config-backends
Closed

docs(models): config-selectable backends (backend: <module>)#556
heskew wants to merge 4 commits into
mainfrom
docs/models-config-backends

Conversation

@heskew

@heskew heskew commented Jun 29, 2026

Copy link
Copy Markdown
Member

Summary

Documents the config-selectable custom backends added in HarperFast/harper#1521 (#1471): an operator can point a models: backend field at a module — a bare package, an instance-root-relative path, or an absolute path — and Harper imports it and invokes its factory at startup.

Updates the Custom backends section in reference/models/backends.md: reframes the intro to "two ways" (programmatic registration vs config selection) and adds a Config-selectable backends subsection (resolution rules + the module factory contract + a YAML example).

Stacking

Version

<VersionBadge> is a v5.1.16 placeholder — harper#1521 isn't merged yet; set it to the actual release at merge time.


Generated by an LLM (Claude Opus 4.8).

🤖 Generated with Claude Code

heskew and others added 4 commits June 29, 2026 07:22
Covers the public custom-backend registration API added in
HarperFast/harper#1405: a Custom backends section in backends.md, a
registerBackend() entry in api.md, and an overview mention.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tream return shape

Addresses gemini-code-assist review on #554.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-only generate

#1405 (registerBackend/defineBackend) merged and ships in v5.1.15.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Companion to HarperFast/harper#1521 (#1471). Stacked on #554.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@heskew heskew added the content 📝 Content specific issues and requests - text, examples, missing info, or clarity label Jun 29, 2026
@heskew heskew requested a review from dawsontoth June 29, 2026 23:27

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the documentation in reference/models/backends.md to introduce "Config-selectable backends," explaining how custom backends can be loaded via configuration module specifiers. The feedback suggests minor grammatical improvements to the introductory text and recommends clarifying how the factory registers the backend using the parameters provided in its signature.

Beyond the four built-ins, a component or application can register its own backend — including an in-process one that runs inference locally instead of calling an HTTP service. A registered backend is selected by its logical name through the same `model` option as a configured backend.

Custom backends are registered programmatically; the `backend` field in the [`models` configuration](./overview#configuration) selects only the built-ins above.
Custom backends can be added two ways: **registered programmatically** (below), or **selected in config** by pointing the `backend` field at a module — see [Config-selectable backends](#config-selectable-backends).

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.

medium

For better grammatical flow and professionalism, consider changing 'added two ways' to 'added in two ways'.

Suggested change
Custom backends can be added two ways: **registered programmatically** (below), or **selected in config** by pointing the `backend` field at a module — see [Config-selectable backends](#config-selectable-backends).
Custom backends can be added in two ways: **registered programmatically** (below), or **selected in config** by pointing the `backend` field at a module — see [Config-selectable backends](#config-selectable-backends).

- an **instance-root-relative path** (`./backends/local.js`) — resolved against the Harper instance root.
- an **absolute path**.

The factory has the signature `({ logicalName, kind, config }) => void | Promise<void>` and registers via [`registerBackend`](#registerbackend); it receives the config entry with `${VAR}` placeholders already resolved. A `backend` that is neither a built-in nor an importable module is logged and skipped at startup, leaving other entries unaffected.

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.

medium

To make the integration clearer for developers implementing custom backends, explicitly state that the factory should register the backend by calling registerBackend with the provided kind and logicalName parameters.

Suggested change
The factory has the signature `({ logicalName, kind, config }) => void | Promise<void>` and registers via [`registerBackend`](#registerbackend); it receives the config entry with `${VAR}` placeholders already resolved. A `backend` that is neither a built-in nor an importable module is logged and skipped at startup, leaving other entries unaffected.
The factory has the signature `({ logicalName, kind, config }) => void | Promise<void>` and registers the backend by calling [`registerBackend`](#registerbackend) with the provided `kind` and `logicalName`. It receives the config entry with `${VAR}` placeholders already resolved. A `backend` that is neither a built-in nor an importable module is logged and skipped at startup, leaving other entries unaffected.

@github-actions github-actions Bot temporarily deployed to pr-556 June 29, 2026 23:30 Inactive
@github-actions

Copy link
Copy Markdown

🚀 Preview Deployment

Your preview deployment is ready!

🔗 Preview URL: https://preview.harper-documentation.harperfabric.com/pr-556

This preview will update automatically when you push new commits.

Base automatically changed from docs/models-register-backend to main June 30, 2026 11:08
heskew added a commit that referenced this pull request Jul 1, 2026
Fold the config-selectable backend docs from #556 into this PR (superseding it):
a `backend` value that is not a built-in is resolved as a module specifier
(bare package / instance-root-relative / absolute) and imported at startup.
Shipped in v5.1.15 (registerFromModule), so it sits under the existing v5.1.15
Custom backends heading; corrected #556 stray v5.1.16 badge and namespaced the
registerBackend reference.

Refs harper #1471. Supersedes documentation #556.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@heskew

heskew commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

Superseded by #558. The config-selectable backends content (backend: <module> — bare package / instance-root-relative / absolute specifier + the factory signature) is folded into #558, under the existing v5.1.15 Custom backends section and using the namespaced models.registerBackend form. This PR also predates the registration-API namespacing (it re-added the free-global registerBackend/defineBackend docs, which #558 corrected) and had drifted into conflict with main — so closing in favor of the single, correct #558.


🤖 Posted by Claude (Opus 4.8) on Nathan's behalf

@heskew heskew closed this Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

🧹 Preview Cleanup

The preview deployment for this PR has been removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

content 📝 Content specific issues and requests - text, examples, missing info, or clarity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants