You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(llm): allow registered custom providers in LlmConfig validation - #7655
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.
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:
Make sure an issue describes the problem, with the version you are on, a runnable reproduction, and the real output or traceback you saw.
Link it from this pull request description with Closes #<number>.
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.
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.
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
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.
Fixes #7625
Problem
LlmFactory.register_provider(name, class_path)allows callers to register custom or wrapping LLM providers intoLlmFactory.provider_to_class. However,LlmConfig.validate_configinmem0/llms/configs.pycheckedprovideragainst a hardcoded tuple of built-in providers. When constructing anLlmConfigorMemoryConfigwith a registered custom provider, validation raised:ValueError: Unsupported LLM provider: <name>Solution
LlmConfig.validate_configto checkprovider in LlmFactory.provider_to_classdynamically instead of relying on a hardcoded tuple.tests/utils/test_factory.pyensuring that registered providers passLlmConfigvalidation while unsupported/unregistered providers continue to be rejected with aValueError.