Problem/Motivation

With Drupal 1.1.x tools calling and structured responses is added. This has been added for example in OpenAI, see https://git.drupalcode.org/project/ai_provider_openai/-/blob/1.1.x/src/P....

We need to add this possibility for every possible provider that allows for it.

Documentation exists here:

Proposed resolution

  1. Enable structured response in the Mistral provider.
  2. Enable tool calling in Mistral provider.
  3. Update composer.json to using AI 1.1.x
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

marcus_johansson created an issue. See original summary.

marcus_johansson’s picture

Assigned: Unassigned » marcus_johansson
marcus_johansson’s picture

Version: 1.0.x-dev » 1.1.x-dev
marcus_johansson’s picture

Because Mistral does not follow the OpenAI SDK exactly and does not give back a type, it will fail.

We will probably have to recreate our own OpenAIish SDK client as part of #3495572: Research new Mistral client to have this working.

Optionally see if this will be supported going forward: https://github.com/partITech/php-mistral

marcus_johansson’s picture

Assigned: marcus_johansson » Unassigned
marcus_johansson’s picture

Issue tags: +priority
marcus_johansson’s picture

Issue tags: +AI Initiative Sprint

marcus_johansson changed the visibility of the branch 3512530-add-structured-output to hidden.

marcus_johansson changed the visibility of the branch 1.0.x to hidden.

marcus_johansson’s picture

Status: Active » Needs review

I've added a MR for both tool calling and structured output. I have also renamed all camel case to underscore case. For me it doesn't matter which one we use, but we shouldn't mix :)

Note that AI Assisted code was used for this MR

petar_basic’s picture

Status: Needs review » Needs work

Added two rather minor suggestions in the MR.
Otherwise looks good.
I've tested both function calling and structured output (using instructions from #3566310 ;-) ) - all works well!

marcus_johansson’s picture

Status: Needs work » Needs review

Thanks for checking - I have applied both comments.

petar_basic’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

marcus_johansson’s picture

Status: Reviewed & tested by the community » Fixed

Thank you, getting merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

arianraeesi’s picture

Issue tags: +AI Product Development
arianraeesi’s picture

Issue tags: -AI Product Development

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.