hotfix embedding model api_base

frdel committed Jul 8, 2025 at 22:26 UTC f1a92552d249b54795da4e71b5c374304dd7c0fd
1 file changed +8 -1
python/helpers/memory.py
+8 -1
@@ -120,10 +120,17 @@ class Memory:
120 os.makedirs(em_dir, exist_ok=True)
121 store = LocalFileStore(em_dir)
122
123 + # HOTFIX TODO: unify with agent.py
124 + def _get_model_kwargs(model_config: ModelConfig):
125 + kwargs = model_config.kwargs.copy() or {}
126 + if model_config.api_base and "api_base" not in kwargs:
127 + kwargs["api_base"] = model_config.api_base
128 + return kwargs
129 +
130 embeddings_model = models.get_embedding_model(
131 model_config.provider,
132 model_config.name,
126 - **model_config.kwargs,
133 + **_get_model_kwargs(model_config),
134 )
135 embeddings_model_id = files.safe_file_name(
136 model_config.provider.name + "_" + model_config.name