Skip to content

Add text, image and file document support for Mistral model provider#15

Merged
SasinduDilshara merged 7 commits intoballerina-platform:mainfrom
SasinduDilshara:integrate-chat-changes
Jul 26, 2025
Merged

Add text, image and file document support for Mistral model provider#15
SasinduDilshara merged 7 commits intoballerina-platform:mainfrom
SasinduDilshara:integrate-chat-changes

Conversation

@SasinduDilshara
Copy link
Contributor

Add text, file, and image document support for Ballerina Mistral model provider

Related to ballerina-platform/ballerina-library#7868

@codecov
Copy link

codecov bot commented Jul 24, 2025

Codecov Report

❌ Patch coverage is 97.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.43%. Comparing base (3d77674) to head (3caa866).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
ballerina/provider_utils.bal 97.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #15      +/-   ##
==========================================
+ Coverage   42.22%   50.43%   +8.20%     
==========================================
  Files           3        3              
  Lines         296      347      +51     
  Branches       86      105      +19     
==========================================
+ Hits          125      175      +50     
- Misses        171      172       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@SasinduDilshara SasinduDilshara requested a review from Copilot July 26, 2025 04:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive document support for the Ballerina Mistral AI model provider, implementing text, image, and file document capabilities. The changes align with the requirement to support multimodal interactions through the Ballerina AI library.

  • Enhanced document processing to support text, image, and file documents with various content types (binary data, URLs, file IDs)
  • Implemented content part generation for different document types with appropriate validation and error handling
  • Added extensive test coverage for new document handling functionality including edge cases and error scenarios

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ballerina/provider_utils.bal Core implementation of document content generation, validation, and conversion to Mistral-specific content parts
ballerina/tests/tests.bal Comprehensive test cases for text, image, and file document support with various content types and error scenarios
ballerina/tests/test_values.bal Updated test data structures and expected values to support new multimodal content testing
ballerina/tests/test_utils.bal Modified utility functions to handle content parts instead of plain strings and added mock responses for document tests
ballerina/tests/test_services.bal Updated test service to validate content parts structure instead of plain string content
ballerina/Dependencies.toml Updated dependencies to include constraint validation and array utilities
Comments suppressed due to low confidence (2)

ballerina/tests/tests.bal:227

  • The test message is misleading since pdf5 contains an invalid URL, not pdf. The error message should match the actual test case being validated.
        test:assertFail("Expected an error for invalid URL in the file document.");

ballerina/tests/tests.bal:239

  • The test message mentions 'invalid URL' but this test case is actually validating pdf which contains a FileId, not an invalid URL. The error message should accurately reflect the test scenario.
        test:assertFail("Expected an error for invalid URL in the file document.");

@SasinduDilshara SasinduDilshara merged commit 9457daa into ballerina-platform:main Jul 26, 2025
4 checks passed
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