Skip to content

Add MultimodalChatWithToolsProvider#400

Merged
lukasdotcom merged 11 commits into
mainfrom
multimodal-provider
Jul 23, 2026
Merged

Add MultimodalChatWithToolsProvider#400
lukasdotcom merged 11 commits into
mainfrom
multimodal-provider

Conversation

@lukasdotcom

@lukasdotcom lukasdotcom commented Jul 8, 2026

Copy link
Copy Markdown
Member

Adds multimodal chat and also switches to enable also settings to enable different kinds of attachments. The new multimodal settings are also used for audio2audio chat and analyze image.
image
Look at nextcloud/assistant#602 to see all relevant pr's for this

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
@lukasdotcom
lukasdotcom force-pushed the multimodal-provider branch from 852adf4 to 9254c32 Compare July 8, 2026 19:11
…on for older providers

Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
@lukasdotcom
lukasdotcom marked this pull request as ready for review July 14, 2026 16:56
…context agent

Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
@lukasdotcom
lukasdotcom force-pushed the multimodal-provider branch from bb8863b to 1808448 Compare July 15, 2026 20:11
Comment thread lib/Service/OpenAiAPIService.php
Comment thread lib/Service/OpenAiAPIService.php Outdated
$content = [];
foreach ($message['content'] as $item) {
if ($item['type'] === 'file') {
$content = array_merge($content, $this->openAiFileService->buildFileContentFromId($item['file_id'], $userId, $item['ocp_task_id'] ?? null));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

$userId may be null here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not sure how to handle it for the fileId only path, but if it is from a task the getUserTask accepts a null value for userId.

throw new ProcessingException('File is not readable');
}
// Maximum file size for openai is 50MB.
if ($this->isUsingOpenAi() && $file->getSize() > self::MAX_FILE_SIZE_BYTES) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we add a file size limit fro the general case as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I can do the exact same limit as for openai unless you think a different one is better.

$unset = '__unset__';
$newValue = $this->appConfig->getValueString(Application::APP_ID, 'multimodal_image_enabled', $unset);
if ($newValue !== $unset) {
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This shifts the default state from 0 to 1, I think. Ideally, if it has been unset previously, we should set it to what used to be the default.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Back when analyze image was created I don't think IONOS had a model with support for image input, but now that they do I think it might be worth it to change the default to on instead of off.

Comment thread lib/TaskProcessing/MultimodalChatWithToolsProvider.php Outdated
@lukasdotcom
lukasdotcom force-pushed the multimodal-provider branch from d6a95cb to 87ec6d9 Compare July 16, 2026 12:44
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
@lukasdotcom
lukasdotcom force-pushed the multimodal-provider branch from 87ec6d9 to 1902b7f Compare July 16, 2026 12:44

@julien-nc julien-nc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

My tests worked great with images using google/gemini-3.1-flash-lite-image (Nano Banana 2 Lite) on OpenRouter.

I tried using gpt-audio on OpenRouter as well and it could take audio as input but never generated any audio output. The model claimed it had generated some audio but in the task output: "output_attachments":[].

Could this be an issue in this implementation or you think the model is just not outputting any audio content?

@lukasdotcom

Copy link
Copy Markdown
Member Author

My tests worked great with images using google/gemini-3.1-flash-lite-image (Nano Banana 2 Lite) on OpenRouter.

I tried using gpt-image on OpenRouter as well and it could take images as input but never generated any audio output. The model claimed it had generated some audio but in the task output: "output_attachments":[].

Could this be an issue in this implementation or you think the model is just not outputting any audio content?

Are you sure gpt-image can generate audio. It sounds more like a model for image generation :). I'll test it's image generation though. It might pass the images it returns in a different format than gemini. Also I'm not sure that I tested audio as I copied the code from the audio chat's implementation.

@julien-nc

Copy link
Copy Markdown
Member

@lukasdotcom I meant gpt-audio and audio input/output, sorry, typo. I edited my comment.

Comment thread lib/TaskProcessing/AnalyzeImagesProvider.php
Comment thread lib/TaskProcessing/MultimodalChatWithToolsProvider.php
@lukasdotcom

Copy link
Copy Markdown
Member Author

@lukasdotcom I meant gpt-audio and audio input/output, sorry, typo. I edited my comment.

I think the issue is that you need to pass an extra parameter, not like with the image models that don't require anything else, but not sure if we should even duplicate the code form AudioChat for multimodal chat.

$extraParams = [
			'modalities' => ['text', 'audio'],
			'audio' => ['voice' => $outputVoice, 'format' => 'mp3'],
		];

…tent of unsupported files

Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
@julien-nc
julien-nc self-requested a review July 23, 2026 08:39
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
@lukasdotcom
lukasdotcom force-pushed the multimodal-provider branch from 9ac259e to 3bc687b Compare July 23, 2026 13:20
@lukasdotcom
lukasdotcom enabled auto-merge July 23, 2026 13:20
@lukasdotcom
lukasdotcom merged commit ce64e17 into main Jul 23, 2026
26 checks passed
@lukasdotcom
lukasdotcom deleted the multimodal-provider branch July 23, 2026 13:22
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