Skip to content

Parser fails when using step-3.7-flash via Chat Completions API #62

Description

@li-xiu-qi

Problem

When using cloud reasoning models (e.g. step-3.7-flash) via Chat Completions API, the parser fails on the first step:

ValueError: ui_action must contain 'action' or 'action_type'. Got keys: ['cot']

Root Cause

ask_llm_v2.py detects reasoning_content in the API response and wraps it as a <think> block, prepending it to the model's content:

result = "<think>" + reasoning + "</think>" + "\n" + llm_content

But the model's content already contains <THINK> tags (required by the parser prompt), so the final output has two layers:

<think>reasoning_content from API</think>       ← prepended by ask_llm_v2.py
<THINK>model's own thinking</THINK>             ← from model content
explain:...  action:CLICK  point:500,300  ...   ← parser needs this

The parser's str2action() uses split("</THINK>")[1] to extract key-value pairs, which grabs content after the first </THINK> — i.e., the second THINK block text, not the action parameters.

Three API Comparison

API Reasoning Location Two-layer THINK?
Chat Completions reasoning_content field → prepended by ask_llm_v2.py Yes
Messages (Anthropic) thinking type block (separate) No
Responses reasoning type output item (separate) No

The model's content always has exactly one <THINK> layer. The problem is purely in ask_llm_v2.py's handling.

Reproduction

  1. Configure model_config.yaml with StepFun API:
stepfun:
    api_base: "https://api.stepfun.com/v1"
    api_key: "YOUR_API_KEY"
  1. Set model_provider to stepfun and model_name to step-3.7-flash.

  2. Run any task. First step fails with ValueError.

Fix

PR #64 — stop prepending reasoning_content in ask_llm_v2.py, return model's content as-is. Verified with real Android device.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions