feat: Allow custom model and params with huggingface_base_url#3574
Merged
parshvadaftari merged 1 commit intomem0ai:mainfrom Oct 14, 2025
Merged
Conversation
parshvadaftari
approved these changes
Oct 14, 2025
Contributor
parshvadaftari
left a comment
There was a problem hiding this comment.
Looks good to me!
Contributor
|
Thank you @vedant381 for contributing to mem0! |
ron-42
pushed a commit
to ron-42/mem0
that referenced
this pull request
Oct 19, 2025
…gpt-4o-mini - Fixed hardcoded model issue in openmemory categorization - Categorization now reads LLM config from database - Supports custom base_url for OpenAI-compatible providers (SiliconFlow, etc.) - Added SiliconFlowConfig class for proper configuration - Updated factory to use SiliconFlowConfig - Added SiliconFlow documentation with usage examples Fixes issue where SiliconFlow users got 'Model does not exist' error because categorization was hardcoded to use gpt-4o-mini instead of the configured model like deepseek-ai/DeepSeek-R1. Resolves: mem0ai#3574
ron-42
pushed a commit
to ron-42/mem0
that referenced
this pull request
Oct 19, 2025
…gpt-4o-mini - Fixed hardcoded model issue in openmemory categorization - Categorization now reads LLM config from database - Supports custom base_url for OpenAI-compatible providers (SiliconFlow, etc.) - Added SiliconFlowConfig class for proper configuration - Updated factory to use SiliconFlowConfig - Added SiliconFlow documentation with usage examples Fixes issue where SiliconFlow users got 'Model does not exist' error because categorization was hardcoded to use gpt-4o-mini instead of the configured model like deepseek-ai/DeepSeek-R1. Resolves: mem0ai#3574
5 tasks
garciaba79
pushed a commit
to garciaba79/mem0
that referenced
this pull request
Feb 12, 2026
jamebobob
pushed a commit
to jamebobob/mem0-vigil-recall
that referenced
this pull request
Mar 29, 2026
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.
Description
This change addresses an issue where using huggingface_base_url would incorrectly restrict the embedding model to a hardcoded "tei" value and prevent the use of custom model parameters.
With this fix, users can now specify any model name and pass additional parameters (e.g., truncate=True) when connecting to a custom Hugging Face Text Embeddings Inference (TEI) endpoint or any other OpenAI-compatible API. This provides greater flexibility for users hosting their own embedding models.
Fixes #3553
Type of change
Please delete options that are not relevant.
HuggingFace embedding configuration and usage
"tei"if not specified, and otherwise uses the provided model name. (mem0/embeddings/huggingface.py)model_kwargs, allowing for greater customization. (mem0/embeddings/huggingface.py)Testing improvements
test_embed_with_huggingface_base_url, to verify that custom HuggingFace endpoints, models, and model parameters are correctly handled and passed to the embedding client. (tests/embeddings/test_huggingface_embeddings.py)] Bug fix (non-breaking change which fixes an issue)How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Please delete options that are not relevant.
Checklist:
Maintainer Checklist
This pull request improves the flexibility and configurability of the HuggingFace embedding integration by allowing custom model names and model keyword arguments to be passed through when using a custom HuggingFace endpoint. It also adds a new test to ensure this functionality works as expected.
Enhancements to HuggingFace embedding configuration:
HuggingFaceEmbeddingclass now sets the model name to"tei"by default only if a custom HuggingFace base URL is provided and no model is explicitly specified, allowing users to override the model name as needed.embedmethod now uses the model name and additional keyword arguments from the config when calling the HuggingFace endpoint, making it possible to customize embedding requests (e.g., to set truncation or other model-specific options).Testing improvements:
test_embed_with_huggingface_base_url, to verify that the embedding logic correctly passes the custom model name and keyword arguments to the HuggingFace endpoint when a base URL is provided.