Skip to content

Feature Request: 给 ToolReturnValue 添加 ErrorCode || Feature Request: Add ErrorCode to ToolReturnValue #1895

@binc4t

Description

@binc4t

What feature would you like to see?

我们基于 Kosong 框架自定义了 Tool。Tool 出错时,仅通过 message 信息难以快速归因和分类告警。希望能加上可枚举的 ErrorCode,帮助业务层对错误原因分类。这是一个可前向兼容的改动。

下面是代码示例:

class ToolReturnValue(BaseModel):
    """The return type of a callable tool."""

    is_error: bool
    """Whether the tool call resulted in an error."""

    error_code: int = 0
    """Machine-readable error code."""
    ...

error_code 举例:

NVALID_ARGUMNT = 1;
PERMISSION_DENIED = 2;
IME_OUT = 3;

Additional information

No response


What feature would you like to see?

We customized the Tool based on the Kosong framework. When a Tool error occurs, it is difficult to quickly attribute and classify the alarm using only message information. It is hoped that enumerable ErrorCode can be added to help the business layer classify error causes. This is a forward-compatible change.

Here is the code example:

class ToolReturnValue(BaseModel):
    """The return type of a callable tool."""

    is_error: bool
    """Whether the tool call resulted in an error."""

    error_code: int = 0
    """Machine-readable error code."""
    ...

error_code example:

NVALID_ARGUMNT = 1;
PERMISSION_DENIED = 2;
IME_OUT = 3;

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions