feat: Add image and file template support to PromptTemplate #340
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.
Hi!
Disclaimer: I used Claude Code to help implement this.
I was working on a project using AshAi and tried to send images to the AI provider. There is a snippet in AshAi:
Since the intention of Ash is to be declarative, this is the desired way of declaring a prompt inside of an action. However, it doesn't actually work. The template in ContentPart.image! is taken as a string.
This PR adds support for
PromptTemplate.image_template!
and PromptTemplate.file_template!` so that it is possible to specify content parts with different types.Please let me know if I should bring this up in an issue first.
Best,
Marco