Skip to content

fix: update MiniMax provider config and fix temperature=0 API error#33

Merged
warren618 merged 2 commits into
HKUDS:mainfrom
octo-patch:feature/add-minimax-provider
Apr 15, 2026
Merged

fix: update MiniMax provider config and fix temperature=0 API error#33
warren618 merged 2 commits into
HKUDS:mainfrom
octo-patch:feature/add-minimax-provider

Conversation

@octo-patch

Copy link
Copy Markdown
Contributor

Summary

  • Fix outdated model name: .env.example referenced MiniMax-Text-01 which has been superseded. Updated to MiniMax-M2.7 (current production model) and documented MiniMax-M2.7-highspeed as the faster alternative.
  • Fix temperature clamping: MiniMax API rejects temperature=0.0 (valid range is (0.0, 1.0]). When LANGCHAIN_PROVIDER=minimax and the default LANGCHAIN_TEMPERATURE=0.0 is in effect, build_llm() now automatically clamps the value to 1.0, preventing an otherwise-silent API validation error for all users who follow the example config.
  • Add unit tests: Cover MiniMax env-var → OPENAI_* mapping, base URL propagation, temperature clamping from 0.0, and preservation of explicitly-set positive temperatures.

Test plan

  • pytest agent/tests/test_llm.py — all 19 tests pass (11 pre-existing + 4 new MiniMax tests)
  • Integration verified: LANGCHAIN_PROVIDER=minimax, LANGCHAIN_MODEL_NAME=MiniMax-M2.7, LANGCHAIN_TEMPERATURE=0.0 → model responds correctly after auto-clamp

API reference

- Update .env.example: replace deprecated MiniMax-Text-01 with
  MiniMax-M2.7 and document MiniMax-M2.7-highspeed as the faster
  alternative; add note that temperature must be > 0
- Fix temperature clamping in build_llm(): MiniMax rejects
  temperature=0.0 (requires range (0.0, 1.0]); auto-clamp to 1.0
  when the default 0.0 is configured for the minimax provider
- Add unit tests: MiniMax env-var mapping, base URL propagation,
  temperature clamping from 0.0, and preservation of explicit values

@warren618 warren618 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the fix! One suggestion on the temperature clamping:

if os.getenv("LANGCHAIN_PROVIDER", "openai").lower() == "minimax" and temperature <= 0.0:
    temperature = 1.0

Clamping to 1.0 (max randomness) seems too aggressive — users who set temperature=0 typically want deterministic output. Since MiniMax's valid range is (0.0, 1.0], could we clamp to 0.01 instead? That stays closest to the user's intent while satisfying the API constraint.

temperature = 0.01

0.01 stays closest to the user's intent (deterministic output) while
satisfying the MiniMax API constraint of temperature > 0.
@warren618
warren618 merged commit 00f2708 into HKUDS:main Apr 15, 2026
@warren618

Copy link
Copy Markdown
Collaborator

Thanks for the fix @octo-patch! I tweaked the clamp value to 0.01 instead of 1.0 — keeps it closest to deterministic while satisfying the MiniMax API. Merged now 🎉

Welcome to the contributors list!

longmfe pushed a commit to longmfe/Vibe-Trading-Mars that referenced this pull request Jul 14, 2026
…KUDS#33)

* fix: update MiniMax provider config and fix temperature handling

- Update .env.example: replace deprecated MiniMax-Text-01 with
  MiniMax-M2.7 and document MiniMax-M2.7-highspeed as the faster
  alternative; add note that temperature must be > 0
- Fix temperature clamping in build_llm(): MiniMax rejects
  temperature=0.0 (requires range (0.0, 1.0]); auto-clamp to 1.0
  when the default 0.0 is configured for the minimax provider
- Add unit tests: MiniMax env-var mapping, base URL propagation,
  temperature clamping from 0.0, and preservation of explicit values

* fix: clamp MiniMax temperature to 0.01 instead of 1.0

0.01 stays closest to the user's intent (deterministic output) while
satisfying the MiniMax API constraint of temperature > 0.

---------

Co-authored-by: octo-patch <octo-patch@github.com>
Co-authored-by: warren618 <haozhe_wu@connect.hku.hk>
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.

2 participants