feat(llm): CustomLLM — canonical Custom LLM provider for any OpenAI-compatible endpoint#165
Merged
Conversation
…ompatible endpoint One generic provider under the name the voice-AI ecosystem uses for the pattern (cf. ElevenLabs/Retell/Vapi 'Custom LLM'): point Patter's pipeline at any /chat/completions endpoint — agent runtimes (Hermes, OpenClaw), keyless local gateways (Ollama/vLLM/LM Studio), or your own service. - Python: getpatter.llm.custom.LLM + top-level CustomLLM export. - TypeScript: CustomLLM named export + custom namespace + CustomLLMOptions. - session_key_from='caller_hash' / sessionKeyFrom hoisted from the Hermes preset into the generic OpenAICompatibleLLMProvider so any header-scoped runtime gets per-caller cross-call memory (patter-caller-<hash>, never the raw number); the Hermes preset now delegates to it (behaviour unchanged, regression-tested). - Docs: CustomLLM section in docs/python-sdk/llm.mdx + docs/typescript-sdk/llm.mdx. Additive only — no defaults changed, presets unchanged.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
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.
Summary
CustomLLM, the canonical name for the generic OpenAI-compatible engine — the industry-standard "Custom LLM" pattern (same concept ElevenLabs Agents / Retell / Vapi expose under that name). One provider works with Hermes, OpenClaw, Ollama/vLLM/LM Studio, or any service implementing/chat/completions(SSE streaming + tool calls).CustomLLMfor everything else.session_key_from="caller_hash"/sessionKeyFrom: "caller_hash"per-caller memory selector from the Hermes preset into the generic provider, so any header-scoped runtime gets cross-call per-caller memory (patter-caller-<hash>, never the raw number).Implementation
getpatter/llm/custom.py(custom.LLM,provider_key="custom") + top-levelCustomLLMexport;session_key_frommoved intoOpenAICompatibleLLMProvider.__init__(same semantics, same error),hermes.pynow delegates to it.src/llm/custom.ts(CustomLLM,CustomLLMOptions,providerKey='custom') +customnamespace export;sessionKeyFromadded toOpenAICompatibleLLMOptionswith the resolution logic in the generic constructor,hermes.tsdelegates.docs/python-sdk/llm.mdxanddocs/typescript-sdk/llm.mdx(provider list), cross-linking the Hermes/OpenClaw integration guides.patter_sdk_features.xlsx).Breaking change?
No. Additive only: new exports, new optional constructor field on the generic provider; presets behave byte-identically (regression-tested: Hermes
session_key_fromderivation and validation unchanged).Test plan
pytest tests/ -m 'not soak'— 2371 passed, 0 failed (incl. newtests/test_llm_custom.py, 11 tests: surface, exports, selector derivation, factory precedence, validation, Hermes delegation regression)npx vitest run— 1834 passed, 0 failed (incl. newtests/unit/llm-custom.test.ts, 11 mirrored tests) +npm run lint+npm run buildCustomLLM/custom.LLM↔CustomLLM/custom.LLM), identical defaults and error messagesDocs updates
docs/python-sdk/llm.mdx— new CustomLLM provider sectiondocs/typescript-sdk/llm.mdx— new CustomLLM provider section🤖 Generated with Claude Code