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

Register tools without #[AsTool] attribute #160

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Iyadhfaleh
Copy link
Contributor

@Iyadhfaleh Iyadhfaleh commented Dec 17, 2024

The idea is to add tools that haven't #[AsTool] attribute like this :

new ToolBox(new ToolAnalyzer(), ['clock' => $clock]);

Tools MUST implement __invoke method.

@Iyadhfaleh Iyadhfaleh force-pushed the feature/execute-tools-without-as-tool-attribute branch from 4abb4ee to 911dcb0 Compare December 17, 2024 10:51
@Iyadhfaleh Iyadhfaleh force-pushed the feature/execute-tools-without-as-tool-attribute branch from 1d88087 to 12816f9 Compare December 17, 2024 14:45

use Symfony\Component\Clock\ClockInterface;

final readonly class ClockWithoutAttribute
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a tool should be added to the tests/ folder, as we don't need to ship two clock tools, doing the exact same thing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this added example . I already added a fixture test without the attribute .
The idea was to provide an example of tool without "AsTool" .
I deleted this attribute from clock tool to show that case .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need an example for this, but rather a test, so please keep the clock with the attribute and the example and extend ToolboxTestCase with a fixture file, shown, that this tool will be registered. thanks

@OskarStark OskarStark changed the title Feature/execute tools without as tool attribute Register tools without #[AsTool] attribute Dec 20, 2024
@chr-hertel
Copy link
Member

chr-hertel commented Dec 21, 2024

Thank you @Iyadhfaleh for your idea to solve this - i'm currently not fully convinced since this is really limited - no description and only __invoke. with third party code this is not simply possible.
don't have a better idea myself atm as well.

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