Add support for prepending images to raw prompts and examples #392
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.
This PR is related to a PR opened against ollama server to address unexpected behavior when passing both
images
andraw=True
to a generate() call. The issue is described here - #319, and the open PR against ollama server is here - ollama/ollama#8209.These changes implement the necessary updates to the python client and generate() methods to allow passing an optional bool
prepend_images_to_raw_prompt
keyword argument to the generate() call. As optional, the change is intended to preserve (and not break) existing users. See associated PR against ollama server linked above for details about how this kwarg will work.This PR also includes a new example titled
multimodal-raw-generate.py
which shows both how to use the proposedprepend_images_to_raw_prompt
kwarg as well as how to manually place image tags within a raw prompt without the need forprepend_images_to_raw_prompt
.