Skip to content
Closed
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
3 changes: 3 additions & 0 deletions Mobile-Agent-E/MobileAgentE/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ def track_usage(res_json, api_key):
elif "claude" in model:
prompt_token_price = (3 / 1000000) * prompt_tokens
completion_token_price = (15 / 1000000) * completion_tokens
elif "minimax-m3" in model.lower():
prompt_token_price = (0.6 / 1000000) * prompt_tokens
completion_token_price = (2.4 / 1000000) * completion_tokens
return {
# "api_key": api_key, # remove for better safety
"id": res_json['id'] if "id" in res_json else None,
Expand Down
8 changes: 7 additions & 1 deletion Mobile-Agent-E/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Please refer to the `# Edit your Setting #` section in `inference_agent_E.py` fo
```
export ADB_PATH="your/path/to/adb"
```
2. Backbone model and API keys: you can choose from OpenAI, Gemini, and Claude; Set the corresponding keys as follows:
2. Backbone model and API keys: you can choose from OpenAI, Gemini, Claude, and MiniMax; Set the corresponding keys as follows:
```
export BACKBONE_TYPE="OpenAI"
export OPENAI_API_KEY="your-openai-key"
Expand All @@ -99,6 +99,12 @@ Please refer to the `# Edit your Setting #` section in `inference_agent_E.py` fo
export BACKBONE_TYPE="Claude"
export CLAUDE_API_KEY="your-claude-key"
```
```
export BACKBONE_TYPE="MiniMax"
export MINIMAX_API_KEY="your-minimax-key"
# Optional: override the OpenAI-compatible endpoint
export MINIMAX_API_URL="https://api.minimax.io/v1/chat/completions"
```
3. Perceptor: By default, the icon captioning model (`CAPTION_MODEL`) in Perceptor uses "qwen-vl-plus" from Qwen API:
- Follow this to get an [Qwen API Key](https://help.aliyun.com/document_detail/2712195.html?spm=a2c4g.2712569.0.0.5d9e730aymB3jH)
- Set the Qwen API key:
Expand Down
8 changes: 7 additions & 1 deletion Mobile-Agent-E/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pip install -r requirements.txt
```
export ADB_PATH="your/path/to/adb"
```
2. 基模型和 API keys: 您可以从 OpenAI、Gemini 或 Claude 中选择,设置相应的键如下:
2. 基模型和 API keys: 您可以从 OpenAI、Gemini、ClaudeMiniMax 中选择,设置相应的键如下:
```
export BACKBONE_TYPE="OpenAI"
export OPENAI_API_KEY="your-openai-key"
Expand All @@ -99,6 +99,12 @@ pip install -r requirements.txt
export BACKBONE_TYPE="Claude"
export CLAUDE_API_KEY="your-claude-key"
```
```
export BACKBONE_TYPE="MiniMax"
export MINIMAX_API_KEY="your-minimax-key"
# 可选:覆盖 OpenAI-compatible endpoint
export MINIMAX_API_URL="https://api.minimax.io/v1/chat/completions"
```
3. 感知器: 默认情况下,Perceptor 中的图标字幕模型 (`CAPTION_MODEL`) 使用 Qwen API 中的“qwen-vl-plus”:
- 按照此步骤获取 [Qwen API Key](https://help.aliyun.com/document_detail/2712195.html?spm=a2c4g.2712569.0.0.5d9e730aymB3jH)
- 设置 Qwen API Key:
Expand Down
12 changes: 10 additions & 2 deletions Mobile-Agent-E/inference_agent_E.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
ADB_PATH = os.environ.get("ADB_PATH", default="adb")

## Reasoning model configs
BACKBONE_TYPE = os.environ.get("BACKBONE_TYPE", default="OpenAI") # "OpenAI" or "Gemini" or "Claude"
assert BACKBONE_TYPE in ["OpenAI", "Gemini", "Claude"], "Unknown BACKBONE_TYPE"
BACKBONE_TYPE = os.environ.get("BACKBONE_TYPE", default="OpenAI") # "OpenAI" or "Gemini" or "Claude" or "MiniMax"
assert BACKBONE_TYPE in ["OpenAI", "Gemini", "Claude", "MiniMax"], "Unknown BACKBONE_TYPE"
print("### Using BACKBONE_TYPE:", BACKBONE_TYPE)

OPENAI_API_URL = "https://api.openai.com/v1/chat/completions"
Expand All @@ -48,6 +48,9 @@
CLAUDE_API_URL = "https://api.anthropic.com/v1/messages"
CLAUDE_API_KEY = os.environ.get("CLAUDE_API_KEY", default=None)

MINIMAX_API_URL = os.environ.get("MINIMAX_API_URL", default="https://api.minimax.io/v1/chat/completions")
MINIMAX_API_KEY = os.environ.get("MINIMAX_API_KEY", default=None)

if BACKBONE_TYPE == "OpenAI":
REASONING_MODEL = "gpt-4o-2024-11-20"
KNOWLEDGE_REFLECTION_MODEL = "gpt-4o-2024-11-20"
Expand All @@ -57,6 +60,9 @@
elif BACKBONE_TYPE == "Claude":
REASONING_MODEL = "claude-3-5-sonnet-20241022"
KNOWLEDGE_REFLECTION_MODEL = "claude-3-5-sonnet-20241022"
elif BACKBONE_TYPE == "MiniMax":
REASONING_MODEL = "MiniMax-M3"
KNOWLEDGE_REFLECTION_MODEL = "MiniMax-M3"

## you can specify a jsonl file path for tracking API usage
USAGE_TRACKING_JSONL = None # e.g., usage_tracking.jsonl
Expand Down Expand Up @@ -385,6 +391,8 @@ def get_reasoning_model_api_response(chat, model_type=BACKBONE_TYPE, model=None,
return inference_chat(chat, model, GEMINI_API_URL, GEMINI_API_KEY, usage_tracking_jsonl=USAGE_TRACKING_JSONL, temperature=temperature)
elif model_type == "Claude":
return inference_chat(chat, model, CLAUDE_API_URL, CLAUDE_API_KEY, usage_tracking_jsonl=USAGE_TRACKING_JSONL, temperature=temperature)
elif model_type == "MiniMax":
return inference_chat(chat, model, MINIMAX_API_URL, MINIMAX_API_KEY, usage_tracking_jsonl=USAGE_TRACKING_JSONL, temperature=temperature)
else:
raise ValueError(f"Unknown model type: {model_type}")

Expand Down