Skip to content

fix(config): resolve sparse_embedder provider from dict on MemoryConf…#917

Merged
Teingi merged 2 commits into
oceanbase:mainfrom
wayyoungboy:issue-904
May 7, 2026
Merged

fix(config): resolve sparse_embedder provider from dict on MemoryConf…#917
Teingi merged 2 commits into
oceanbase:mainfrom
wayyoungboy:issue-904

Conversation

@wayyoungboy
Copy link
Copy Markdown
Member

…ig deserialization

When Memory is initialized with a dict config (e.g. from auto_config()), MemoryConfig coerced sparse_embedder dicts into BaseSparseEmbedderConfig, leaving _provider_name=None and all fields empty. Add a field_validator that resolves the correct provider subclass before Pydantic coercion.

Fixes #904

…ig deserialization

When Memory is initialized with a dict config (e.g. from auto_config()),
MemoryConfig coerced sparse_embedder dicts into BaseSparseEmbedderConfig,
leaving _provider_name=None and all fields empty. Add a field_validator
that resolves the correct provider subclass before Pydantic coercion.

Fixes oceanbase#904
…ryConfig validation

Without an explicit import of sparse_providers, BaseSparseEmbedderConfig._registry
may be empty when MemoryConfig is first constructed (e.g. in isolated tests or
partial imports), causing the field_validator to silently fall back to the base
class instead of the correct provider subclass.

Add side-effect import to guarantee the registry is filled before any MemoryConfig
instance is created.
Copy link
Copy Markdown
Member

@Teingi Teingi left a comment

Choose a reason for hiding this comment

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

LGTM

@Teingi Teingi merged commit ca0fbca into oceanbase:main May 7, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: The sparse_embedder class did not load base_url as expected

2 participants