Add text, image and file document support for Mistral model provider#15
Merged
SasinduDilshara merged 7 commits intoballerina-platform:mainfrom Jul 26, 2025
Merged
Conversation
…allerinax-ai.mistral into integrate-chat-changes
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
pdf5contains an invalid URL, notpdf. 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
pdfwhich 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.");
xlight05
approved these changes
Jul 26, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add text, file, and image document support for Ballerina Mistral model provider
Related to ballerina-platform/ballerina-library#7868