Skip to content

[Platform][Anthropic] Allow beta feature flags to be passed into platform invocations #274

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

Merged
merged 1 commit into from
Aug 14, 2025

Conversation

TomLisankie
Copy link
Contributor

Q A
Bug fix? No
New feature? Yes
Docs? Yes
Issues See below
License MIT

Anthropic supports passing flags for beta features via beta headers in requests to its API. This PR allows for passing in the desired beta features via the $options parameter in the invoke function like so:

$platform->invoke($model, $messageBag, [
            'temperature' => 1.0,
            'max_tokens' => 20000,
            // can now include beta features like this:
            'beta_features' => [
                'code-execution-2025-05-22',
                'mcp-client-2025-04-04'
            ]
        ]);

If the beta features option is set and contains at least one element, the beta header is constructed inside the model client and then the option is removed from $options before the request is built and sent to Anthropic.

If we want to support beta feature flags for other providers in the future, we should perhaps add another parameter to the invoke function for platforms and the request function for model clients in order to not pollute $options (after all, $options is meant to hold model options not platform options).

@TomLisankie TomLisankie marked this pull request as ready for review August 6, 2025 18:05
@carsonbot carsonbot added Feature New feature Platform Issues & PRs about the AI Platform component Status: Needs Review labels Aug 6, 2025
@OskarStark
Copy link
Contributor

I am fine using the $options array here.

Can you please add a test case? Thanks

@OskarStark OskarStark changed the title [Platform] Allow beta feature flags to be passed into Anthropic platform invocations [Platform][Anthropic] Allow beta feature flags to be passed into platform invocations Aug 7, 2025
@TomLisankie
Copy link
Contributor Author

Can you please add a test case? Thanks

Sure thing.

@TomLisankie
Copy link
Contributor Author

@OskarStark Done.

Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

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

Good catch, those specific things slip easily through, thanks!

minor comments from my end

@carsonbot carsonbot changed the title [Platform][Anthropic] Allow beta feature flags to be passed into platform invocations [Platform] [Anthropic] Allow beta feature flags to be passed into platform invocations Aug 7, 2025
@TomLisankie
Copy link
Contributor Author

Will address these issues on Monday.

@carsonbot carsonbot changed the title [Platform] [Anthropic] Allow beta feature flags to be passed into platform invocations [Platform][Anthropic] Allow beta feature flags to be passed into platform invocations Aug 14, 2025
@TomLisankie
Copy link
Contributor Author

It's done now. My apologies for the delay, I had some higher priority work to attend to.

Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

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

It's done now. My apologies for the delay, I had some higher priority work to attend to.

No need to apologize - we all have a day job to make the living :D
Looks good to me know, thanks!

@chr-hertel
Copy link
Member

Thank you @TomLisankie.

@chr-hertel chr-hertel merged commit 9980c4e into symfony:main Aug 14, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature Platform Issues & PRs about the AI Platform component Status: Reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants