Skip to content

Commit

Permalink
Legacy typing support
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Sep 18, 2024
1 parent 3524742 commit 60d78d0
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Union

from shiny.express import render, ui

# Set some Shiny page options
Expand All @@ -12,7 +14,7 @@

# TODO: test with append_message_stream() as well
@chat.transform_assistant_response
def transform(content: str) -> str | ui.HTML:
def transform(content: str) -> Union[str, ui.HTML]:
if content == "return HTML":
return ui.HTML(f"<b>Transformed response</b>: {content}")
else:
Expand Down

0 comments on commit 60d78d0

Please sign in to comment.