← All docs

    Cancel answer

    What it does

    cancel_answer stops a research turn you started with ask_lexomat before it finishes — the third leg of the handle flow, after starting the question and polling it with get_answer.

    Cancellation is cooperative: the pipeline checks for the request between its stages, so the underlying work may run on for a little while after the call returns. What changes immediately is the turn's recorded state — a get_answer issued straight afterwards already reads cancelled, which is terminal.

    It is keyed by session_id alone, not by the full handle, because a session has at most one turn running at a time. This is the same cancellation the Lexomat web app performs when you stop a running research question there.

    Covers Slovak law only; output is informational, not legal advice.

    Inputs

    NameTypeRequiredDescription
    session_idstringYesThe session ask_lexomat returned.

    Returns

    {
      "session_id": "…",
      "cancelled": true
    }
    

    cancelled is true when a running turn of yours was marked cancelled. It is false when nothing of yours was running in that session — because it had already finished, because the session is unknown, or because it is not yours. All three deliberately read the same, so session ids cannot be probed.

    Example

    The calling AI started a question, polled twice, and you change your mind. It calls cancel_answer("…"), gets cancelled: true, and reports that the research was stopped. A following get_answer on that handle returns status: "cancelled" with no answer.

    Notes

    • Consumes no quota — stopping work you already paid to start is not a second call. The question itself was debited when ask_lexomat started it, and cancelling does not refund it. See Usage limits.
    • Cancelling is final for that turn: the answer it would have produced never exists and cannot be recovered. Ask again to get one.
    • A second cancel on the same session is a harmless no-op and simply returns cancelled: false.
    • You can only cancel your own turns; the request never touches another user's session.