Problem/Motivation

Add kernel tests for the Chat operation
The module currently has no automated test coverage. Chat is the primary operation type and should be tested first.

Proposed resolution

Create kernel tests that mock the MistralClient to test chat functionality in isolation
Test coverage:
- testGetConfiguredModelsChat() - Verify model listing for chat operation
- testChat() - Basic chat completion with mocked response
- testChatWithSystemRole() - Chat with system prompt
- testChatStreamed() - Streaming chat response

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

petar_basic created an issue. See original summary.

marcus_johansson’s picture

Issue tags: +AI Initiative Sprint

petar_basic’s picture

Status: Active » Needs work
petar_basic’s picture

Status: Needs work » Needs review

Added tests for chat operation type, and tools/function calling - followed the structure in ai module tests.
Note that AI Assisted code was used for this MR

fago’s picture

Assigned: petar_basic » fago

Reviewing this already

fago’s picture

Status: Needs review » Needs work

thx,

I reviewed carefully while questioning whether the tests test the right thing. While mostly this seems right, in particular for chat, I'm not sure in some cases - please check my review comments.

fago’s picture

Assigned: fago » Unassigned
petar_basic’s picture

Status: Needs work » Needs review

Thanks, I've addressed the comments, see the last 2 commits and my answers.

  • fago committed 55b54c0b on 1.1.x authored by petar_basic
    test: #3567015 Add Chat operation kernel tests
    
    By: petar_basic
    By: fago
    
fago’s picture

Status: Needs review » Fixed

Thank you!

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.