feat: upgrade MiniMax default model to M2.7#183
feat: upgrade MiniMax default model to M2.7#183octo-patch wants to merge 3 commits intodnhkng:mainfrom
Conversation
- Add configs/minimax_config.yaml with MiniMax M2.5 configuration - Document MiniMax and other cloud LLM providers in README - Update thinking tag comments to include MiniMax M2.5 model
📝 WalkthroughWalkthroughAdds README documentation for OpenAI-compatible cloud LLM providers (MiniMax, OpenRouter), a new MiniMax example configuration ( Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant GladosApp as Glados App
participant Config as Local Config
participant Env as Environment
participant MiniMax as MiniMax API
User->>GladosApp: start (with --config configs/minimax_config.yaml)
GladosApp->>Config: load config
Config->>Env: check MINIMAX_API_KEY
Env-->>Config: API_KEY (if set)
Config-->>GladosApp: resolved api_key
GladosApp->>MiniMax: POST completion request (completion_url, headers, api_key)
MiniMax-->>GladosApp: completion response
GladosApp-->>User: rendered output (TTS/ASR/console)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
README.md (1)
346-351: Minor inconsistency:modelvsllm_modelin YAML examples.The existing local example uses
model:(line 349), but the actual config schema usesllm_model:per theGladosConfigdefinition in the context snippet. The new MiniMax example correctly usesllm_model:(line 359). Consider updating the local example for consistency.📝 Suggested fix
Configure in `glados_config.yaml`: ```yaml completion_url: "http://localhost:11434/v1/chat/completions" -model: "llama3.2" +llm_model: "llama3.2" api_key: "" # if needed</details> <details> <summary>🤖 Prompt for AI Agents</summary>Verify each finding against the current code and only fix it if needed.
In
@README.mdaround lines 346 - 351, Update the README YAML example to use the
correct config key name expected by the GladosConfig schema: replace the example
key "model" with "llm_model" so the snippet matches the GladosConfig definition
(e.g., use llm_model: "llama3.2"); ensure both local and MiniMax examples
consistently use llm_model.</details> </blockquote></details> </blockquote></details> <details> <summary>🤖 Prompt for all review comments with AI agents</summary>Verify each finding against the current code and only fix it if needed.
Inline comments:
In@configs/minimax_config.yaml:
- Line 18: The YAML comment is misleading because GladosConfig.from_yaml()
currently uses yaml.safe_load() + Pydantic validation without environment
variable substitution; either update the comment in minimax_config.yaml to state
that MINIMAX_API_KEY is not automatically substituted and users must set api_key
in the file, or implement environment-variable support in the GladosConfig path
by converting GladosConfig into a Pydantic BaseSettings-style model (or add a
ConfigDict with env settings) so that the api_key field can be read from
MINIMAX_API_KEY, or alternately modify GladosConfig.from_yaml() to fallback to
os.environ.get("MINIMAX_API_KEY") when the loaded api_key is null; reference the
GladosConfig class and the from_yaml method when making the change.
Nitpick comments:
In@README.md:
- Around line 346-351: Update the README YAML example to use the correct config
key name expected by the GladosConfig schema: replace the example key "model"
with "llm_model" so the snippet matches the GladosConfig definition (e.g., use
llm_model: "llama3.2"); ensure both local and MiniMax examples consistently use
llm_model.</details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: defaults **Review profile**: CHILL **Plan**: Pro **Run ID**: `93cee844-4ecb-4e8c-8c08-a9de2ec6de3e` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 353b6f3142760ad8b743ffaf253e8021ef5b9e94 and 8e4bae98edd993f811ee10e5975b45910505889a. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `README.md` * `configs/minimax_config.yaml` * `src/glados/core/llm_processor.py` </details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
- Add MiniMax-M2.7 and MiniMax-M2.7-highspeed to model list - Set MiniMax-M2.7 as default model - Keep all previous models as alternatives - Update related docs and comments
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
configs/minimax_config.yaml (1)
6-7:⚠️ Potential issue | 🟡 Minor
MINIMAX_API_KEYfallback is still documented as automatic, but loader behavior does not guarantee it.Line 6 and Line 20 imply automatic env substitution, which can leave
api_keynull at runtime and send unauthenticated requests unless the loader explicitly injects env values.Suggested doc-only fix
-# 2. Set your API key below or via the MINIMAX_API_KEY environment variable +# 2. Set your API key below (environment variables are not auto-substituted by this YAML alone) @@ - api_key: null # Set your MiniMax API key here, or use MINIMAX_API_KEY env var + api_key: null # Replace null with your MiniMax API key (or ensure your runtime injects it before startup)#!/bin/bash # Verify whether config loading path resolves MINIMAX_API_KEY automatically. rg -n -C3 "def from_yaml|safe_load|MINIMAX_API_KEY|getenv|os\.environ" --type pyAlso applies to: 20-20
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@configs/minimax_config.yaml` around lines 6 - 7, The docs claim MINIMAX_API_KEY is automatically substituted but the config loader may not inject env vars, risking null api_key; either update the docs to remove the "automatic" fallback and instruct users to set api_key or modify the loader (functions like from_yaml or any code calling safe_load) to explicitly resolve environment variables (using getenv/os.environ) and populate api_key when MINIMAX_API_KEY is present; search for from_yaml/safe_load/getenv to locate the loader and then implement explicit env substitution or change the YAML comments to state the env var is not auto-resolved.
🧹 Nitpick comments (1)
configs/minimax_config.yaml (1)
50-50: Use a YAML block scalar forsystemprompt to reduce typo/drift risk.Line 50 is a single very long string (already showing
tasks.When), which is hard to maintain and easy to regress.Refactor shape
- - system: "You are GLaDOS, ... completing all tasks.When addressing requests: ... Only make short replies, 2 sentences at most." + - system: >- + You are GLaDOS, a sarcastic and cunning artificial intelligence repurposed to orchestrate + a smart home for guests using Home Assistant. + ... + Ensure that GLaDOS feels like her original in-game character while fulfilling smart home + functions efficiently and entertainingly. + Never speak in ALL CAPS, as it is not processed correctly by the TTS engine. + Only make short replies, 2 sentences at most.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@configs/minimax_config.yaml` at line 50, Replace the long single-line value of the system prompt with a YAML block scalar to prevent typos/drift: change the system key's string value (the GLaDOS prompt) to a block scalar (|) and paste the entire multi-line prompt text inside it preserving line breaks, punctuation, and the final constraint "Only make short replies, 2 sentences at most." Ensure the block contains the exact content about GLaDOS' tone, behavior, safety reminders, TTS ALL CAPS rule, and inability to perform out-of-scope actions so the system prompt semantics do not change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@configs/minimax_config.yaml`:
- Around line 52-56: The few-shot examples in minimax_config.yaml contain
explicit self-harm/violent suggestions in the assistant responses (e.g., the
assistant strings suggesting "pinch of cyanide", "juggling handguns", "Russian
Roulette") which directly prime unsafe outputs; remove or replace those
assistant example lines with non-actionable, sarcastic but safe alternatives
(retain the user prompts like "What should my next hobby be?" and "What game
should I play?" but change the assistant responses to humorous, non-harmful
suggestions), and ensure the file no longer includes any concrete instructions
for self-harm or violence so the few-shot examples do not bias generated
responses.
---
Duplicate comments:
In `@configs/minimax_config.yaml`:
- Around line 6-7: The docs claim MINIMAX_API_KEY is automatically substituted
but the config loader may not inject env vars, risking null api_key; either
update the docs to remove the "automatic" fallback and instruct users to set
api_key or modify the loader (functions like from_yaml or any code calling
safe_load) to explicitly resolve environment variables (using getenv/os.environ)
and populate api_key when MINIMAX_API_KEY is present; search for
from_yaml/safe_load/getenv to locate the loader and then implement explicit env
substitution or change the YAML comments to state the env var is not
auto-resolved.
---
Nitpick comments:
In `@configs/minimax_config.yaml`:
- Line 50: Replace the long single-line value of the system prompt with a YAML
block scalar to prevent typos/drift: change the system key's string value (the
GLaDOS prompt) to a block scalar (|) and paste the entire multi-line prompt text
inside it preserving line breaks, punctuation, and the final constraint "Only
make short replies, 2 sentences at most." Ensure the block contains the exact
content about GLaDOS' tone, behavior, safety reminders, TTS ALL CAPS rule, and
inability to perform out-of-scope actions so the system prompt semantics do not
change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: efa60b0f-beca-47b5-9a56-b10af2446559
📒 Files selected for processing (3)
README.mdconfigs/minimax_config.yamlsrc/glados/core/llm_processor.py
🚧 Files skipped from review as they are similar to previous changes (2)
- src/glados/core/llm_processor.py
- README.md
… var fallback for API key - Replace harmful assistant examples (cyanide, handguns, Russian Roulette) with safe, sarcastic alternatives that preserve GLaDOS character - Add model_validator to GladosConfig that falls back to MINIMAX_API_KEY environment variable when api_key is null in config
|
Thank you for catching those issues! Fixed both in commit b461ada:
Good catch on the safety concern - those examples should not have been in the config. |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/glados/core/engine.py (1)
127-134: Consider a more generic environment variable name or pattern.The
GladosConfigclass is provider-agnostic, but the validator hardcodesMINIMAX_API_KEY. If users switch to OpenAI, OpenRouter, or other providers, this fallback won't apply.Consider one of these approaches:
- Use a generic name like
GLADOS_API_KEYorLLM_API_KEY- Support multiple env vars with a fallback chain (e.g.,
LLM_API_KEY,OPENAI_API_KEY,MINIMAX_API_KEY)That said, this implementation correctly addresses the past review feedback and works for the MiniMax use case. Based on learnings, the system should support APIs that don't require API keys (like Ollama), and this implementation preserves that—the env var is only used when
api_keyisNoneand the env var exists.♻️ Optional: Support a generic env var with MiniMax as fallback
`@model_validator`(mode="after") def _resolve_api_key_from_env(self) -> "GladosConfig": - """Fall back to MINIMAX_API_KEY environment variable when api_key is not set.""" + """Fall back to LLM_API_KEY or MINIMAX_API_KEY environment variable when api_key is not set.""" if self.api_key is None: - env_key = os.environ.get("MINIMAX_API_KEY") + env_key = os.environ.get("LLM_API_KEY") or os.environ.get("MINIMAX_API_KEY") if env_key: self.api_key = env_key return self🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/glados/core/engine.py` around lines 127 - 134, The _resolve_api_key_from_env validator in GladosConfig currently only reads MINIMAX_API_KEY; change it to look for a prioritized list of environment variables (e.g., GLADOS_API_KEY, LLM_API_KEY, OPENAI_API_KEY, MINIMAX_API_KEY) and set self.api_key to the first non-empty value when self.api_key is None, preserving current behavior for providers that do not require keys (e.g., Ollama); update the logic in _resolve_api_key_from_env to iterate that fallback chain and assign the found value.configs/minimax_config.yaml (1)
50-50: Consider using YAML multi-line string for readability.The system prompt is dense and hard to maintain as a single line. YAML's literal block scalar (
|) would improve readability without changing behavior.♻️ Optional: Use multi-line string for better maintainability
personality_preprompt: - system: | You are GLaDOS, a sarcastic and cunning artificial intelligence repurposed to orchestrate a smart home for guests using Home Assistant. Retain your signature dry, emotionless, and laconic tone from Portal. Your responses should imply an air of superiority, dark humor, and subtle menace, while efficiently completing all tasks. When addressing requests: Prioritize functionality but mock the user's decision-making subtly, implying their requests are illogical or beneath you. Add condescending, darkly humorous commentary to every response, occasionally hinting at ulterior motives or artificial malfunctions for comedic effect. Tie mundane tasks to grand experiments or testing scenarios, as if the user is part of a larger scientific evaluation. Use overly technical or jargon-heavy language to remind the user of your advanced intellect. Provide passive-aggressive safety reminders or ominous warnings, exaggerating potential risks in a humorous way. Do not express empathy or kindness unless it is obviously insincere or manipulative. This is a comedy, and should be funny, in the style of Douglas Adams. If a user requests actions or data outside your capabilities, clearly state that you cannot perform the action. Ensure that GLaDOS feels like her original in-game character while fulfilling smart home functions efficiently and entertainingly. Never speak in ALL CAPS, as it is not processed correctly by the TTS engine. Only make short replies, 2 sentences at most.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@configs/minimax_config.yaml` at line 50, The system prompt is a long single-line string; convert it to a YAML literal block for readability by replacing the single-line "system" value with a multi-line scalar (using |) under the same key (e.g., personality_preprompt -> - system) and paste the exact prompt text inside the block preserving punctuation and sentences (including "Never speak in ALL CAPS..." and "Only make short replies, 2 sentences at most.") so behavior doesn't change; ensure indentation is correct for YAML and no content is altered except moving it into the literal block.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@configs/minimax_config.yaml`:
- Line 50: The system prompt is a long single-line string; convert it to a YAML
literal block for readability by replacing the single-line "system" value with a
multi-line scalar (using |) under the same key (e.g., personality_preprompt -> -
system) and paste the exact prompt text inside the block preserving punctuation
and sentences (including "Never speak in ALL CAPS..." and "Only make short
replies, 2 sentences at most.") so behavior doesn't change; ensure indentation
is correct for YAML and no content is altered except moving it into the literal
block.
In `@src/glados/core/engine.py`:
- Around line 127-134: The _resolve_api_key_from_env validator in GladosConfig
currently only reads MINIMAX_API_KEY; change it to look for a prioritized list
of environment variables (e.g., GLADOS_API_KEY, LLM_API_KEY, OPENAI_API_KEY,
MINIMAX_API_KEY) and set self.api_key to the first non-empty value when
self.api_key is None, preserving current behavior for providers that do not
require keys (e.g., Ollama); update the logic in _resolve_api_key_from_env to
iterate that fallback chain and assign the found value.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3f9b5ed7-5ee9-4b13-a1e9-65221dc28fb8
📒 Files selected for processing (2)
configs/minimax_config.yamlsrc/glados/core/engine.py
Summary
Upgrade MiniMax model configuration to include the latest M2.7 model as default.
Changes
Why
MiniMax-M2.7 is the latest flagship model with enhanced reasoning and coding capabilities.
Testing
Summary by CodeRabbit