feat: make LLM and embedding model configurable via YAML config#112
Open
AaryanCode69 wants to merge 2 commits intoreactome:mainfrom
Open
feat: make LLM and embedding model configurable via YAML config#112AaryanCode69 wants to merge 2 commits intoreactome:mainfrom
AaryanCode69 wants to merge 2 commits intoreactome:mainfrom
Conversation
Previously, the model provider and model name were hard-coded in
AgentGraph.__init__() as get_llm("openai", "gpt-4o-mini") and
get_embedding("openai", "text-embedding-3-large"). This made it
impossible to switch models without modifying source code.
- Add llm and embedding configuration fields to the YAML config schema
- Update Pydantic config models to validate new model settings
- Update AgentGraph to read provider/model from YAML config instead
of hard-coded values
- Retain existing defaults for backward compatibility
Resolves reactome#108
Pydantic v2 BaseModel rejects unknown fields by default. Adding a `models` key to config.yml caused the entire Config to fail validation, returning None and silently disabling messages, rate limits, and feature flags. Setting extra="ignore" lets the parser skip unrecognized keys while still loading all known configuration correctly.
This was referenced Mar 10, 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.
Summary
Make LLM and embedding model/provider configurable via the existing YAML config system instead of being hard-coded in
AgentGraph.__init__().Problem
The model provider and model name were hard-coded in
AgentGraph.__init__():This made it impossible to switch models, providers, or base URLs without directly modifying source code — limiting experimentation, self-hosting with local models (e.g., Ollama), and deployment flexibility.
Solution
Introduce a
ModelsConfigPydantic model and wire it through the existing YAML config pipeline so users can control models declaratively:AgentGraphnow reads from config instead of hard-coded values:Changes
src/util/config_yml/models.pyLLMConfig,EmbeddingConfig, andModelsConfigPydantic models with sensible defaultssrc/util/config_yml/__init__.pymodels: ModelsConfigfield toConfigwith a default so existing configs without the key still worksrc/agent/graph.pyAgentGraph.__init__()accepts optionalModelsConfig; reads provider/model from config instead of hard-coded stringsbin/chat-chainlit.pyconfig.modelsthrough toAgentGraphat startupconfig_default.ymlmodelssection with current default values documentedBackward Compatibility
modelskey in YAML is optional —ModelsConfigdefaults toopenai/gpt-4o-miniandopenai/text-embedding-3-large, matching the previously hard-coded values.AgentGraphacceptsmodels_config=Noneand falls back to the same defaults.config.ymlfiles without amodelssection continue to work without modification.Example: Switching to Ollama
No code changes required — just update the YAML config and restart.
How This Enables Future MCP Integration
AgentGraphno longer owns provider/model decisions, making it easier for an MCP server to initialize its own LLM instances from the same shared config.ModelsConfigPydantic model provides a validated, extensible schema. Future MCP settings (server URL, transport, tool registrations) can follow the same pattern and live alongside it inconfig.yml.Related Issue
Resolves #108