Skip to content

feat: add MiniMax as configurable LLM provider for summarization and code interpreter#106

Open
octo-patch wants to merge 1 commit into
superagent-ai:mainfrom
octo-patch:feature/minimax-llm-provider
Open

feat: add MiniMax as configurable LLM provider for summarization and code interpreter#106
octo-patch wants to merge 1 commit into
superagent-ai:mainfrom
octo-patch:feature/minimax-llm-provider

Conversation

@octo-patch

Copy link
Copy Markdown

Summary

  • Makes the LLM provider configurable via LLM_PROVIDER env var (openai or minimax)
  • utils/summarise.py: when LLM_PROVIDER=minimax, uses AsyncOpenAI pointed at https://api.minimax.io/v1 with model MiniMax-M2.7 (204K context window)
  • service/code_interpreter.py: same provider routing; temperature is clamped to 0.01 for MiniMax because the API requires temperature > 0
  • .env.example: documents the two new env vars (LLM_PROVIDER, MINIMAX_API_KEY)
  • README.md: adds a "LLM providers" table listing OpenAI (default) and MiniMax
  • tests/: 17 unit tests (fully mocked) + 2 integration tests against the real MiniMax API

Test plan

  • Unit tests: ============================= test session starts ==============================
    platform linux -- Python 3.10.12, pytest-8.2.0, pluggy-1.6.0
    codspeed: 4.3.0 (disabled, mode: walltime, callgraph: not supported, timer_resolution: 1.0ns)
    benchmark: 5.2.3 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
    rootdir: /home/ximi/github_pr/automation/repos/super-rag
    configfile: pyproject.toml
    plugins: logfire-4.29.0, flaky-3.8.1, syrupy-5.1.0, recording-0.13.4, anyio-4.13.0, order-1.3.0, examples-0.0.18, mock-3.15.1, timeout-2.4.0, asyncio-0.23.6, respx-0.22.0, cov-4.1.0, hydra-core-1.3.2, benchmark-5.2.3, typeguard-4.5.1, codspeed-4.3.0, langsmith-0.7.22, dotenv-0.5.2, socket-0.7.0, requests-mock-1.12.1, Faker-37.12.0, httpx-0.36.0, xdist-3.8.0
    asyncio: mode=strict
    collected 19 items / 2 deselected / 17 selected

tests/test_minimax_provider.py ................. [100%]

=============================== warnings summary ===============================
tests/test_minimax_provider.py:270
/home/ximi/github_pr/automation/repos/super-rag/tests/test_minimax_provider.py:270: PytestUnknownMarkWarning: Unknown pytest.mark.integration - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.integration

tests/test_minimax_provider.py::TestGenerateContent::test_contains_document_content
/home/ximi/github_pr/automation/repos/super-rag/models/document.py:72: PydanticDeprecatedSince20: Pydantic V1 style @validator validators are deprecated. You should migrate to Pydantic V2 style @field_validator validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.12/migration/
@validator("id")

tests/test_minimax_provider.py::TestGenerateContent::test_contains_document_content
/home/ximi/github_pr/automation/repos/super-rag/models/document.py:80: PydanticDeprecatedSince20: Pydantic V1 style @validator validators are deprecated. You should migrate to Pydantic V2 style @field_validator validators, see the migration guide for more details. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.12/migration/
@validator("dense_embedding")

tests/test_minimax_provider.py::TestCompletion::test_completion_openai
/home/ximi/.local/lib/python3.10/site-packages/pytest_asyncio/plugin.py:759: DeprecationWarning: The event_loop fixture provided by pytest-asyncio has been redefined in
/home/ximi/github_pr/automation/repos/super-rag/tests/conftest.py:7
Replacing the event_loop fixture with a custom implementation is deprecated
and will lead to errors in the future.
If you want to request an asyncio event loop with a scope other than function
scope, use the "scope" argument to the asyncio mark when marking the tests.
If you want to return different types of event loops, use the event_loop_policy
fixture.

warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================ 17 passed, 2 deselected, 4 warnings in 50.00s ================= — 17 passed

  • Integration tests: — 2 passed
  • Existing behaviour unchanged when LLM_PROVIDER is unset (defaults to OpenAI)
  • Set LLM_PROVIDER=minimax + MINIMAX_API_KEY in .env, run the ingest → query pipeline and verify summaries are generated via MiniMax

…code interpreter

- utils/summarise.py: support LLM_PROVIDER=minimax via OpenAI-compat client
  pointing to https://api.minimax.io/v1, using MiniMax-M2.7 (204K context)
- service/code_interpreter.py: same provider selection; temperature clamped
  to 0.01 for MiniMax (API requires temperature > 0)
- .env.example: document LLM_PROVIDER and MINIMAX_API_KEY env vars
- README.md: add LLM providers table with MiniMax row
- tests/: 17 unit tests + 2 integration tests (pytest-asyncio)
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