-
Notifications
You must be signed in to change notification settings - Fork 0
Add provider-agnostic LLM client and update overrides #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| def with_overrides( | ||
| self, | ||
| *, | ||
| models: Optional[Dict[str, Optional[str]]] = None, | ||
| base_urls: Optional[Dict[str, Optional[str]]] = None, | ||
| api_key: Optional[str] = None, | ||
| ) -> "LLMClient": | ||
| """Create a new client that applies the provided overrides.""" | ||
|
|
||
| return LLMClient( | ||
| self.config.override( | ||
| models=models, base_urls=base_urls, api_key=api_key | ||
| ), | ||
| client_kwargs=self._default_kwargs, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with_overrides ignores new API keys and base URLs
When creating an override client the method reuses self._default_kwargs from the original client. Those kwargs already contain the previously resolved api_key and base_url, and the constructor uses setdefault so the values from the new LLMConfig are never applied. Calling client.with_overrides(api_key="new") or changing base_urls still produces a client authenticated against the original endpoint. This makes credential or endpoint overrides impossible and will surprise callers who rely on per-operation credentials.
Useful? React with 👍 / 👎.
| self.embedding_model = config.model_for("embedding", fallback=settings.EMBEDDING_MODEL) | ||
|
|
||
| self._graph_driver: Optional[GraphDriver] = graph_driver | ||
| self._graph_driver_factory = graph_driver_factory | ||
| if self._graph_driver is None and self._graph_driver_factory is None: | ||
| self._graph_driver_factory = make_graph_driver_factory() | ||
|
|
||
| self._memory_manager: Optional[MemoryManager] = ( | ||
| MemoryManager(self._graph_driver) if self._graph_driver else None | ||
| ) | ||
| self.entity_registry = EntityRegistry | ||
| self.predicate_registry = PredicateRegistry | ||
| bootstrap_entities([Memory]) | ||
| bootstrap_encoders() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Embedding-model overrides lack registered encoder
The CLI and MeshMind constructor allow overriding the embedding model via llm_config or --embedding-model, but MeshMind.__init__ still calls bootstrap_encoders() with no arguments, which registers only settings.EMBEDDING_MODEL. The overridden model name in self.embedding_model is never added to EncoderRegistry, so extract_memories later raises KeyError for the new model. Passing the active embedding model to bootstrap_encoders (or registering it explicitly) is required for the advertised override to work.
Useful? React with 👍 / 👎.
Summary
meshmind/llm_client.pywith configuration helpers so extraction, embeddings, and rerank flows share a single OpenAI-compatible wrapper--llm-*overridesLLM_*environment variables, update planning/backlog artifacts, and add targeted tests plus a cleanup plan for post-restriction shimsTesting
https://chatgpt.com/codex/tasks/task_b_68ee1c9ee92c83218cbbebce8b0667b8