Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional generics to convert turns and turn contents into other text-based formats #167

Open
gadenbuie opened this issue Nov 20, 2024 · 0 comments · May be fixed by #170
Open

Additional generics to convert turns and turn contents into other text-based formats #167

gadenbuie opened this issue Nov 20, 2024 · 0 comments · May be fixed by #170

Comments

@gadenbuie
Copy link

Currently the Turn@text getter is used to convert a turn into text by calling contents_text() on the elements in the turn's @contents. The text representation, however, loses critical information, such as hiding the images attached to the contents.

I think it's reasonable for this to happen with Turn@text, but for more complicated uses it'd be helpful to have a way to also get an html or markdown representation of the Turns.

Rather than increasing the number of properties on Turn, I'd like to propose that contents_text() becomes an exported function and is joined by contents_markdown() and contents_html() (possibly also supported by a extending an underlying, possibly exported, abstraction of contents_transform()).

Ideally, these functions could be defined for the content classes ContentText, ContentInlineImage, etc. as well as for Turn, such that a user could call lapply(chat$get_turns(), contents_html) or equally contents_html(chat$get_turns()[[1]]).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant