Skip to content

question: trait functions as tool calls #140

Open
@ssddOnTop

Description

@ssddOnTop

Say if I've a trait:

trait Tool: Sized + Send + Sync + 'static {
    fn foo(&self, x: i32, y: i32);
    fn bar(&self, x: i32, y: i32);
}

Is there any way that I can treat functions foo and bar as tool calls?

I was checking the calculator example and on line 37 there is #[tool(tool_box)] implemented on a trait, but I can't directly do that on my Tool trait. So is there any way to directly treat a trait as a set of tool calls? Or is there any way to set the implementation of the trait as a tool call?

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