Skip to content

docs: fix incorrect code example for permission rules - #52

Open
CBhannnnnnnnnnn wants to merge 2 commits into
agentscope-ai:mainfrom
CBhannnnnnnnnnn:CBhannnnnnnnnnn-patch-1
Open

docs: fix incorrect code example for permission rules#52
CBhannnnnnnnnnn wants to merge 2 commits into
agentscope-ai:mainfrom
CBhannnnnnnnnnn:CBhannnnnnnnnnn-patch-1

Conversation

@CBhannnnnnnnnnn

Copy link
Copy Markdown

Changes made:

  • Corrected the text to reference ConfirmResult.rules instead of incorrectly pointing to the non-existent UserConfirmResultEvent.rules attribute.
  • Fixed the Python code example in both the Chinese and English versions.
  • Added the required tool_call parameter to the ConfirmResult instantiation to match the actual SDK definition.

This ensures developers can copy the example code without encountering runtime errors.

For reference, here is the actual SDK definition:

class ConfirmResult(BaseModel):
    """Confirm result for a tool call."""

    confirmed: bool
    """Whether the user confirmed the tool call."""
    tool_call: ToolCallBlock
    """The tool call that was confirmed or rejected."""
    rules: list[PermissionRule] | None = None
    """The allowed permission rules for this tool call. This field is only applicable when ``confirmed`` is True. In case user modification is needed, complete permission rules are used here instead of references to the suggested rules in ``RequireUserConfirmEvent``."""

class UserConfirmResultEvent(EventBase):
    """User confirm result event."""

    type: Literal[
        EventType.USER_CONFIRM_RESULT
    ] = EventType.USER_CONFIRM_RESULT
    """Event type."""
    reply_id: str
    """ID of the reply message associated with this run."""
    confirm_results: list[ConfirmResult]
    """Confirmation results for each pending tool call."""

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