Skip to content

How to branch text and image in conditional statement in handlebar template? #6480

Answered by matthewbolanos
takeo-iw asked this question in Q&A
Discussion options

You must be logged in to vote

You'll want to refer to the documentation from handlebars on how to set up conditional logic: https://handlebarsjs.com/guide/builtin-helpers.html#if For your particular scenario, you probably want to loop over the content collection within the chat message and then use a condition that checks the type of the sub-content. This seems challenging though.

We're currently investigating how we can provide simpler helper methods to print an entire chat history object in a template. When that lands later this summer, it should simplify this code greatly. In the meantime, you may want to simply use the chat completion service directly without using prompt templates.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@takeo-iw
Comment options

@takeo-iw
Comment options

@takeo-iw
Comment options

Answer selected by sophialagerkranspandey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
.NET Issue or Pull requests regarding .NET code
2 participants