Add Text and Image document support for ollama model provider#13
Merged
SasinduDilshara merged 6 commits intoballerina-platform:mainfrom Jul 26, 2025
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
+ Coverage 47.65% 50.60% +2.94%
==========================================
Files 4 4
Lines 235 249 +14
Branches 65 73 +8
==========================================
+ Hits 112 126 +14
Misses 123 123 ☔ 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 text and image document support for the ollama model provider, extending the existing text-only support to handle image documents as well. The changes enable processing of images either as binary data or URLs within prompts.
Key changes:
- Enhanced prompt generation to support both text and image documents
- Added URL validation for image document content
- Implemented comprehensive test coverage for image document functionality
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| ballerina/provider_utils.bal | Core implementation for handling image documents with URL validation and base64 encoding |
| ballerina/tests/tests.bal | New test function covering image document scenarios including invalid URLs |
| ballerina/tests/test_values.bal | Added sample binary data and expected schema constants for image tests |
| ballerina/tests/test_utils.bal | Mock utility functions to support image document testing |
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 and Image document support for ollama model provider
Related to ballerina-platform/ballerina-library#7868