Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ Create **.env** file under the repo root directory with your own API keys:
```
OPENAI_API_KEY=sk-proj-...
DEEPSEEK_API_KEY=sk-...
MINIMAX_API_KEY=your-minimax-api-key
```

## Record
Expand Down Expand Up @@ -141,6 +142,16 @@ python run_replay.py --model-provider openai --wap_replay_list data_processed/ex
```
For **smart-replay**, replace the path with a smart‑replay JSON to test this mode.

Supported `--model-provider` values: `azure`, `anthropic`, `openai`, `ollama`, `minimax`.

To use **MiniMax** (M2.7, 204K context):
```bash
# Set MINIMAX_API_KEY in your .env file, then run:
python run_replay.py --model-provider minimax --wap_replay_list data_processed/smart_replay/wap_smart_replay_list_<task_id>.json --max-concurrent 1
```

To use MiniMax in the **MCP client** (`mcp_client.py`), set `LLM_PROVIDER=minimax` and `MINIMAX_API_KEY` in your `.env` file.

## Convert to MCP Server

```bash
Expand Down
19 changes: 16 additions & 3 deletions mcp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ class LLMClient:

def __init__(self, api_key: str) -> None:
self.api_key: str = api_key
self.provider: str = os.getenv("LLM_PROVIDER", "openai").lower()
# Resolve MiniMax key at init so tests can patch the environment once
if self.provider == "minimax":
self._minimax_key: str = os.getenv("MINIMAX_API_KEY", api_key)
else:
self._minimax_key = ""

def get_response(self, messages: list[dict[str, str]]) -> str:
"""Get a response from the LLM.
Expand All @@ -238,15 +244,22 @@ def get_response(self, messages: list[dict[str, str]]) -> str:
Raises:
httpx.RequestError: If the request to the LLM fails.
"""
url = "https://api.openai.com/v1/chat/completions"
if self.provider == "minimax":
url = "https://api.minimax.io/v1/chat/completions"
api_key = self._minimax_key
model = "MiniMax-M2.7"
else:
url = "https://api.openai.com/v1/chat/completions"
api_key = self.api_key
model = "gpt-4o"

headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {self.api_key}",
"Authorization": f"Bearer {api_key}",
}
payload = {
"messages": messages,
"model": "gpt-4o"
"model": model
}

try:
Expand Down
9 changes: 9 additions & 0 deletions run_replay.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ def get_llm_model_generator(
elif model_provider == "ollama":
llm = ChatOllama(model="ota-preview-v16", num_ctx=20000,temperature=0)
yield llm
elif model_provider == "minimax":
llm = ChatOpenAI(
model="MiniMax-M2.7",
temperature=0.01,
openai_api_key=os.getenv("MINIMAX_API_KEY", ""),
openai_api_base="https://api.minimax.io/v1",
)
yield llm
else:
raise ValueError(f"Invalid model provider: {model_provider}")

Expand Down Expand Up @@ -258,6 +266,7 @@ async def process_with_semaphore(
"anthropic",
"openai",
"ollama",
"minimax",
],
)
parser.add_argument(
Expand Down
Empty file added tests/__init__.py
Empty file.
Loading