-
Notifications
You must be signed in to change notification settings - Fork 940
feat: add provider selection and persistence #283
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
Open
tode-rl
wants to merge
6
commits into
langchain-ai:master
Choose a base branch
from
tode-rl:feature/model-selection-persistence
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: add provider selection and persistence #283
tode-rl
wants to merge
6
commits into
langchain-ai:master
from
tode-rl:feature/model-selection-persistence
Conversation
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
Add ability to switch between OpenAI and Anthropic models during a session with the /model slash command. Model choice is persisted in config.json and restored in future sessions. Changes: - config.py: Add SessionState.preferred_provider field, refactor create_model() with force_provider parameter, add helper functions (_create_openai_model, _create_anthropic_model, _show_api_key_error), add load_agent_config() and save_agent_config() for persistence - commands.py: Add /model command handler that returns dict signal for agent recreation, change return type to str | bool | dict - main.py: Update simple_cli() and main() to return dict | None for special actions, add model switching loop in cli_main() that recreates agent on provider change, load config at startup and save on model switch - README.md: Document /model command, add Model Switching section, update Agent Storage to mention config.json, update module documentation Model switching recreates the agent and clears conversation history while preserving memories and custom instructions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
eyurtsev
reviewed
Nov 4, 2025
| def create_model(): | ||
| def _create_openai_model(): | ||
| """Create an OpenAI model instance.""" | ||
| model_name = os.environ.get("OPENAI_MODEL", "gpt-5-mini") |
Collaborator
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.
I don't want a lot of different env variables for specifying model preferences
Would DEEPAGENTS_MODEL= work?
Add ability to switch between OpenAI and Anthropic models during a session with the /model slash command. Model choice is persisted in config.json and restored in future sessions. Changes: - config.py: Add SessionState.preferred_provider field, refactor create_model() with force_provider parameter, add helper functions (_create_openai_model, _create_anthropic_model, _show_api_key_error), add load_agent_config() and save_agent_config() for persistence - commands.py: Add /model command handler that returns dict signal for agent recreation, change return type to str | bool | dict - main.py: Update simple_cli() and main() to return dict | None for special actions, add model switching loop in cli_main() that recreates agent on provider change, load config at startup and save on model switch - README.md: Document /model command, add Model Switching section, update Agent Storage to mention config.json, update module documentation Model switching recreates the agent and clears conversation history while preserving memories and custom instructions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…com/tode-rl/deepagents into feature/model-selection-persistence
Add ability to switch between OpenAI and Anthropic providers during a session with the /provider slash command. Provider choice is persisted in config.json and restored in future sessions. Changes: - config.py: Add SessionState.preferred_provider field, refactor create_model() with force_provider parameter, add helper functions (_create_openai_model, _create_anthropic_model, _show_api_key_error), add load_agent_config() and save_agent_config() for persistence. Hard-code specific models: gpt-5-mini for OpenAI and claude-sonnet-4-5-20250929 for Anthropic (no environment variable overrides) - commands.py: Add /provider command handler that returns dict signal for agent recreation, change return type to str | bool | dict - main.py: Update simple_cli() and main() to return dict | None for special actions, add provider switching loop in cli_main() that recreates agent on provider change, load config at startup and save on provider switch - README.md: Document /provider command, add Provider Switching section, update Agent Storage to mention config.json, update module documentation Provider switching recreates the agent and clears conversation history while preserving memories and custom instructions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…com/tode-rl/deepagents into feature/model-selection-persistence
Author
|
I thought |
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.
Add ability to switch between OpenAI and Anthropic models during a session with the /model slash command. Model choice is persisted in config.json and restored in future sessions.
Changes:
Model switching recreates the agent and clears conversation history while preserving memories and custom instructions.