Skip to content

[AIBundle] Wire & configure services explicitly #163

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
Jul 20, 2025

Conversation

valtzu
Copy link
Contributor

@valtzu valtzu commented Jul 19, 2025

Q A
Bug fix? no
New feature? no
Docs? no
Issues Related to #90
License MIT

Don't autowire or autoconfigure anything in AI Bundle

@valtzu valtzu changed the title [AI Bundle] Wire & configure services explicitly [AIBundle] Wire & configure services explicitly Jul 19, 2025
@valtzu valtzu force-pushed the wire-explicitly branch from 54daa04 to d673f98 Compare July 19, 2025 21:39
Copy link
Contributor

@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.

Thanks for working on this! Will need to give it another read + test, but some things already caught my eye.

@valtzu valtzu force-pushed the wire-explicitly branch 2 times, most recently from 570a0a3 to bda9a1f Compare July 19, 2025 22:42
@chr-hertel chr-hertel added the AI Bundle Issues & PRs about the AI integration bundle label Jul 19, 2025
@valtzu valtzu force-pushed the wire-explicitly branch 5 times, most recently from cd4c881 to 1c19fa1 Compare July 20, 2025 17:23
@valtzu
Copy link
Contributor Author

valtzu commented Jul 20, 2025

Converted from name-based to index-based args to address #77 too

Included in the same PR not to need 2 rounds of testing

Copy link
Contributor

@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.

Thanks so much for this! Tested it with the demo - and that looks good 👍

@valtzu valtzu force-pushed the wire-explicitly branch from 1c19fa1 to 7a005cb Compare July 20, 2025 21:36
@chr-hertel
Copy link
Contributor

Wait, does the "Audio Bot" still work for you?

getting this right now:
image

->setArguments([
$platform['api_key'],
new Reference('http_client', ContainerInterface::NULL_ON_INVALID_REFERENCE),
new Reference('ai.platform.contract.default'),
Copy link
Contributor

Choose a reason for hiding this comment

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

That's causing the error with the audio bot - it needs the Whisper contract extension, that is not part of the default, see here:

$contract ?? Contract::create(new AudioNormalizer()),

Copy link
Contributor Author

@valtzu valtzu Jul 20, 2025

Choose a reason for hiding this comment

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

Feels a bit counter-intuitive: I thought OpenAI was meant to be the default contract and now it seems we need a custom contract for it 🤔

Anyway, done – the audio demo works now

Copy link
Contributor

Choose a reason for hiding this comment

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

The Contract is for the entire Platform - including the model Whisper, but the default is currently only for embeddings and LLM completion.

Whisper doesn't qualify to be in the default Platform contract for me, but still is part of the OpenAI Platform.

@valtzu valtzu force-pushed the wire-explicitly branch from 7a005cb to bbd2369 Compare July 20, 2025 21:54
@chr-hertel
Copy link
Contributor

Thank you @valtzu.

@chr-hertel chr-hertel merged commit f77e9a0 into symfony:main Jul 20, 2025
12 checks passed
valtzu added a commit to valtzu/symfony-ai that referenced this pull request Jul 20, 2025
@valtzu
Copy link
Contributor Author

valtzu commented Jul 20, 2025

Missed a rebase here, main is broken now. 🫣

Fix in #176

chr-hertel added a commit that referenced this pull request Jul 20, 2025
This PR was merged into the main branch.

Discussion
----------

[AIBundle] Fix dependency injection

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Docs?         | no
| License       | MIT

Fix DI config after #163 / #154. Should've rebased before merge – now we're getting a bunch of errors on `main`:

```
Symfony\AI\Agent\Toolbox\Toolbox::__construct(): Argument #1 ($tools) must be of type Traversable|array, Symfony\AI\Agent\Toolbox\ToolFactory\ReflectionToolFactory given
```

etc

Commits
-------

3c6290e [AIBundle] Fix dependency injection config after #163
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Bundle Issues & PRs about the AI integration bundle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants