Skip to content

fix(llm): allow registered custom providers in LlmConfig validation - #7655

Closed
littfed wants to merge 1 commit into
mem0ai:mainfrom
littfed:fix/issue-7625-llm-factory-registered-providers
Closed

littfed wants to merge 1 commit into
mem0ai:mainfrom
littfed:fix/issue-7625-llm-factory-registered-providers

Conversation

@littfed

@littfed littfed commented Oct 15, 2026

Copy link
Copy Markdown

Fixes #7625

Problem

LlmFactory.register_provider(name, class_path) allows callers to register custom or wrapping LLM providers into LlmFactory.provider_to_class. However, LlmConfig.validate_config in mem0/llms/configs.py checked provider against a hardcoded tuple of built-in providers. When constructing an LlmConfig or MemoryConfig with a registered custom provider, validation raised:
ValueError: Unsupported LLM provider: <name>

Solution

  • Updated LlmConfig.validate_config to check provider in LlmFactory.provider_to_class dynamically instead of relying on a hardcoded tuple.
  • Added unit tests in tests/utils/test_factory.py ensuring that registered providers pass LlmConfig validation while unsupported/unregistered providers continue to be rejected with a ValueError.

@CLAassistant

CLAassistant commented Oct 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown

Thanks for taking the time to open this.

We only review pull requests that fix an issue we have already agreed to take on, so this one is closed for now.
Closed does not mean rejected. It means it is not in the queue yet, and reopening takes about a minute.

To get it reviewed:

  1. Make sure an issue describes the problem, with the version you are on, a runnable reproduction, and the real output or traceback you saw.
  2. Link it from this pull request description with Closes #<number>.
  3. Ask a maintainer to label that issue accepted. This pull request reopens by itself when they do.

Issue already labeled accepted? Just add Closes #<number> to the description. That reopens this too.

Documentation-only changes skip this gate entirely.

See CONTRIBUTING.md for the full policy.

@github-actions github-actions Bot closed this Oct 15, 2026
@github-actions github-actions Bot added the sdk-python Python SDK specific label Oct 15, 2026
@github-actions

Copy link
Copy Markdown

Hi @littfed, thanks for opening this pull request.

This is just a soft check: you are not yet in this repo's vouched contributor list (.github/VOUCHED.td). Nothing is blocked and there is nothing you need to do.

A maintainer can vouch for you by commenting !vouch @littfed on any issue.

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

Labels

sdk-python Python SDK specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] LlmFactory.register_provider is unusable: LlmConfig allowlist rejects registered providers

2 participants