Skip to content

Conversation

@dmason30
Copy link
Contributor

Refactors the CustomTool to:

CustomTool::make(
    name: 'custom_tool',
    description: 'This is a custom tool',
)
    ->withStringParameter(name: 'name', description: 'The name of the user', required: true)
    ->withIntegerParameter(name: 'age', description: 'The age of the user')
    ->using(function (string $name, ?int $age = null) {
        return sprintf('Hello, %s! You are %d years old.', $name, $age ?? 'unknown');
    }),
);

@dmason30 dmason30 requested a review from luisdalmolin May 20, 2025 13:09
@luisdalmolin luisdalmolin merged commit 2658580 into main May 20, 2025
11 checks passed
@luisdalmolin luisdalmolin deleted the add-custom-tool-fluent-api branch May 20, 2025 14:15
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.

3 participants