Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using codebase as tools #3

Open
anilaltuner opened this issue Sep 26, 2024 · 0 comments
Open

Using codebase as tools #3

anilaltuner opened this issue Sep 26, 2024 · 0 comments

Comments

@anilaltuner
Copy link
Member

Add capability to define and integrate custom tools using Python classes

Implement a feature that allows users to create custom tools as Python classes and seamlessly integrate them into the workflow system. This will enhance flexibility and use cases on Dria Workflows

Example:

class CustomMathTool(Tool):
    name = "CustomMathTool"
    description = "Performs custom mathematical operations"

    def process(self, x: float, y: float, operation: str) -> float:
        if operation == "add":
            return x + y
        elif operation == "multiply":
            return x * y
        else:
            raise ValueError("Unsupported operation")

# Register the custom tool
register_tool(CustomMathTool)

# Use in workflow
builder.step(
    id="math_operation",
    tool="CustomMathTool",
    inputs={"x": 5, "y": 3, "operation": "multiply"}
)
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

No branches or pull requests

1 participant