Skip to content

feat: upgrade MiniMax default model to M2.7#183

Open
octo-patch wants to merge 3 commits intodnhkng:mainfrom
octo-patch:add-minimax-support
Open

feat: upgrade MiniMax default model to M2.7#183
octo-patch wants to merge 3 commits intodnhkng:mainfrom
octo-patch:add-minimax-support

Conversation

@octo-patch
Copy link
Copy Markdown

@octo-patch octo-patch commented Mar 12, 2026

Summary

Upgrade MiniMax model configuration to include the latest M2.7 model as default.

Changes

  • Add MiniMax-M2.7 and MiniMax-M2.7-highspeed to the model selection list
  • Set MiniMax-M2.7 as the new default model
  • Retain all previous models (M2.5, M2.5-highspeed) as available alternatives
  • Update config comments, README docs, and thinking-tag references

Why

MiniMax-M2.7 is the latest flagship model with enhanced reasoning and coding capabilities.

Testing

  • Config and documentation changes only — no functional code modified
  • Existing tests unaffected (no MiniMax-specific tests in this project)

Summary by CodeRabbit

  • Documentation
    • Added guidance for cloud LLM providers (MiniMax, OpenRouter) with example configs, provider-specific settings, and links to backend docs.
    • Explained how to switch between local and cloud backends and alternative startup/config usage.
  • New Configuration
    • Added a ready-to-use MiniMax config example covering model, endpoint, auth, persona, and runtime options.
    • Config supports reading the API key from an environment variable for easier setup.

- 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
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 12, 2026

📝 Walkthrough

Walkthrough

Adds README documentation for OpenAI-compatible cloud LLM providers (MiniMax, OpenRouter), a new MiniMax example configuration (configs/minimax_config.yaml) with model/runtime and persona settings, minor doc updates to LLM processor tags, and a GladosConfig validator to resolve the MiniMax API key from the environment.

Changes

Cohort / File(s) Summary
Documentation
README.md
Adds "Cloud LLM Providers" section with MiniMax and OpenRouter examples, provider-specific YAML snippets, and alternative startup instructions.
Configs
configs/minimax_config.yaml
New MiniMax config defining llm_model, completion_url, api_key (env fallback), headers, I/O/ASR/TTS flags, autonomy settings, MCP server entries, and a detailed GLaDOS system persona with sample dialogue.
Core LLM Processing
src/glados/core/llm_processor.py
Updates docstring and standard thinking tag list to include MiniMax M2.5 and M2.7 (alongside existing tags); no control-flow changes.
Engine / Config Validation
src/glados/core/engine.py
Adds a pydantic model validator to GladosConfig to populate api_key from MINIMAX_API_KEY environment variable if unset; imports model_validator and os.

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)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 I found new clouds to roam and play,
MiniMax hums in YAML day,
Docs unfurl paths and startup cues,
GLaDOS sips tea and cracks dry news,
Hop on — the config fields all say hooray!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately reflects the main change: upgrading MiniMax default model to M2.7. However, the changeset extends beyond just the model upgrade—it adds comprehensive MiniMax cloud provider support including README updates, a new config file, environment variable handling, and documentation improvements. The title captures only one aspect of this broader feature addition.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
README.md (1)

346-351: Minor inconsistency: model vs llm_model in YAML examples.

The existing local example uses model: (line 349), but the actual config schema uses llm_model: per the GladosConfig definition in the context snippet. The new MiniMax example correctly uses llm_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.md around 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
@octo-patch octo-patch changed the title Add MiniMax as a documented cloud LLM provider feat: upgrade MiniMax default model to M2.7 Mar 18, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
configs/minimax_config.yaml (1)

6-7: ⚠️ Potential issue | 🟡 Minor

MINIMAX_API_KEY fallback 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_key null 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 py

Also 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 for system prompt 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8e4bae9 and 1b1a265.

📒 Files selected for processing (3)
  • README.md
  • configs/minimax_config.yaml
  • src/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
@octo-patch
Copy link
Copy Markdown
Author

Thank you for catching those issues! Fixed both in commit b461ada:

  1. API key env var support: Added a model_validator to GladosConfig that falls back to the MINIMAX_API_KEY environment variable when api_key is null in the YAML config. This makes the env var comment in the config actually work correctly.
  2. Replaced all unsafe few-shot examples with safe, sarcastic alternatives that preserve the GLaDOS character:
    • Tea: removed cyanide reference, now mentions steeping properly
    • Hobby: removed handguns reference, now suggests chess boxing / robotics
    • Game: removed Russian Roulette, now suggests Portal 2 challenge maps

Good catch on the safety concern - those examples should not have been in the config.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/glados/core/engine.py (1)

127-134: Consider a more generic environment variable name or pattern.

The GladosConfig class is provider-agnostic, but the validator hardcodes MINIMAX_API_KEY. If users switch to OpenAI, OpenRouter, or other providers, this fallback won't apply.

Consider one of these approaches:

  1. Use a generic name like GLADOS_API_KEY or LLM_API_KEY
  2. 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_key is None and 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

📥 Commits

Reviewing files that changed from the base of the PR and between 1b1a265 and b461ada.

📒 Files selected for processing (2)
  • configs/minimax_config.yaml
  • src/glados/core/engine.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant