Skip to content

anthropic call no arguments function error #44

Open

Description

@xufanghui

Request: {"model":"anthropic/claude-3.7-sonnet:thinking","messages":[{"role":"system","content":"这是一个5x5的迷宫网格,起点位于坐标[1, 4],终点位于坐标[2, 2]。\n 迷宫中分布着若干墙壁,具体位置为: [(0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (3, 0), (3, 1), (3, 3), (3, 4), (4, 2), (4, 3)]。\n 迷宫的字符表示:\n # # # . #\n # # # # s\n . . e . .\n # # . # #\n . . # # .\n 请使用工具走迷宫,从起点(s)走到终点(e),#表示墙,不要走出5x5网格,坐标的最小值位于左上角[0,0],最大值位于右下角[4,4]。\n 详细的规则或步骤如下:\n 1. 首先记录开始点和结束点,调用 record_start_end 工具。\n 2. 依据实际情况,请使用 up 向上走 或者 down 向下走 或者 left 向左走 或者 right 向右走 工具走一步。\n 3. 调用 is_target 工具判断是否到达终点。\n 4. 如果调用 is_target 工具后返回【1】表示到达终点,否则,请重试第2和3步骤,直到重复执行20步后终止。\n "},{"role":"user","content":"让我们走出指令中的迷宫"},{"role":"assistant","content":"我将帮您走出这个迷宫。根据指令,我需要从起点[1, 4]走到终点[2, 2]。\n\n首先,我需要记录开始点和结束点:","tool_calls":[{"id":"toolu_vrtx_011kcCRHX9oVBJfmx8NAaTtR","type":"function","function":{"name":"record_start_end","arguments":"{"json_string": "{\"start_x\":1,\"start_y\":4,\"target_x\":2,\"target_y\":2}"}"}}]},{"role":"tool","content":"nil","name":"record_start_end","tool_call_id":"toolu_vrtx_011kcCRHX9oVBJfmx8NAaTtR"}],"tools":[{"type":"function","function":{"name":"left","description":"向左","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"up","description":"向上","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"record_start_end","description":"记录开始点和结束点, 输入参数为json字符串如:{"start_x":1,"start_y":4,"target_x":2,"target_y":2}","parameters":{"type":"object","properties":{"json_string":{"type":"string"}},"required":["json_string"]}}},{"type":"function","function":{"name":"right","description":"向右","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"down","description":"向下","parameters":{"type":"object","properties":{},"required":[]}}},{"type":"function","function":{"name":"is_target","description":"判断是否到达终点,返回 1 到达;0 未到达","parameters":{"type":"object","properties":{},"required":[]}}}],"parallel_tool_calls":true,"tool_choice":"auto"}
Response: {"role":"assistant","content":"我会继续帮您走出迷宫。现在已经记录了开始点和结束点,我需要开始移动。根据迷宫布局,我将规划一条从[1,4]到[2,2]的路径。\n\n首先,我向右移动一步:","tool_calls":[{"id":"toolu_vrtx_01HxhoZHdBBxtoqaL7PZA6Wd","type":"function","function":{"name":"right","arguments":""}}]}

error:

thread 'tokio-runtime-worker' panicked at aiscript-vm/src/ai/agent.rs:213:18:
called Result::unwrap() on an Err value: Error("EOF while parsing a value", line: 1, column: 0)
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

thread 'main' panicked at aiscript/src/main.rs:81:18:
called Result::unwrap() on an Err value: JoinError::Panic(Id(11), "called Result::unwrap() on an Err value: Error("EOF while parsing a value", line: 1, column: 0)", ...)

Activity

  1. Folyd commented on Mar 30, 2025

    @Folyd
    Member

    Can you share your agent code? Thanks.

  2. xufanghui commented on Mar 31, 2025

    @xufanghui
    Author
    use std.serde;
    let t_x = nil;
    let t_y = nil;
    let x = nil;
    let y = nil;
    
    agent Maze {
        instructions: "You're a master of mazes.Please use the tool to navigate the maze, moving from the starting point (s) to the ending point (e). The symbol '#' represents a wall. Do not go beyond the 5x5 grid. The minimum coordinate value is located at the top-left corner [0, 0], and the maximum coordinate value is located at the bottom-right corner [4, 4].
    Detailed rules or steps are as follows:
    1. First, record the starting and ending points by calling the record_start_end tool.
    2. Based on the actual situation, use the up, down, left, or right tool to move one step.
    3. Call the is_target tool to determine if the ending point has been reached.
    4. If the is_target tool returns [1], it means the ending point has been reached. Otherwise, repeat steps 2 and 3 until a maximum of 20 steps have been executed.
        ",
        fn record_start_end(json_string:str) {
            """Record the starting and ending points, the input parameter is a json string such as:{"start_x":1,"start_y":4,"target_x":2,"target_y":2} """
            print("start_x: ", json_string);
            let p = serde.from_str(json_string);
            x = p.start_x;
            y = p.start_y;
            t_x = p.target_x;
            t_y = p.target_y;
        }
    
        fn is_target() -> str {
            """Determine if the game is over; Return 1 to reach it; Return 0 if not."""
            print("x: ",x, "y: ", y, "target_x: ", t_x, "target_y: ", t_y);
            if x == t_x and y == t_y  {
                return "1";
            } else {
                return "0";
            }
        }
    
        fn up() -> str {
            """up x= x-1"""
            print("up: ");
            x = x-1;
        }
        fn down() -> str {
            """down x=x+1"""
            print("down: ");
            x = x+1;
        }
        fn left() -> str {
            """left y=y-1"""
            print("left: ");
            y = y-1;
        }
        fn right() -> str {
            """right y=y+1"""
            print("right: ");
            y = y+1;
        }
    }
    
    Maze.run(input="This is a 5x5 maze grid with the starting point at coordinates [1, 4] and the ending point at coordinates [2, 2].
    The maze contains several walls located at: [(0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (1, 3), (3, 0), (3, 1), (3, 3), (3, 4), (4, 2), (4, 3)].
    The character representation of the maze:
    . # # # .
    # # # # s
    . . e . .
    # # . # #
    . . # # .
    Let’s escape the maze within the instructions.", debug=true);
    
  3. xufanghui commented on Mar 31, 2025

    @xufanghui
    Author

    This is maze.ai agent, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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