Skip to content

Conversation

@romainfrancois
Copy link
Contributor

@romainfrancois romainfrancois commented Feb 7, 2024

closes #63

There's probably a better way to handle this but the situation described in #63 is that openai_stream_ide_delta() receives a byte stream that is truncated in the middle of a multi byte string, which is common when you use emojis, etc ...

So what this does is store the raw bytes in ch_env$stream$bytes, parse the whole thing, and holistically try to nchar() the rawToChar()ed string until there is no error.

@romainfrancois
Copy link
Contributor Author

With this, I can get the golem poem:

> chattr::chattr("Can you write a poem about the R package called 'golem'. Please add a bunch of emojis.")
Sure! Here's a poem about the R package 'golem' with a bunch of emojis:

🌟 In the land of R, a package was born,
🔧 Its name was 'golem', a tool to adorn.
🏗️ With 🧱 and 🏗️, it built apps with ease,
🌈 Adding colors and interactivity, oh please!

📦 'Golem' wrapped up shiny, like a gift,
🎁 Making web apps with a magical lift.
🌐 It brought the power of the web to R,
🖥️ Creating interfaces that would take you far.

🔮 With 'golem', you could create something new,
🎨 Designing apps with a beautiful view.
📊 Visualize data with 📈 and 📉,
🔍 Explore insights with a few clicks and scrolls.

🔒 'Golem' kept your code safe and secure,
🔐 Protecting your app with a strong allure.
🔧 It handled dependencies with care,
📦 Ensuring your app would always be there.

🚀 So, let's embark on a 'golem' adventure,
🌠 Building apps with joy and rapture.
🎉 With emojis and code, we'll create something grand,
🌟 'Golem' in our hands, a magic wand.

Note: The poem is for entertainment purposes only and does not provide any code or technical information about the 'golem' package.

@romainfrancois
Copy link
Contributor Author

I would argue now this is a missed opportunity in httr2. I'll send a PR there.

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 this pull request may close these issues.

truncated openai_stream_parse(x=) : .p() must return a single TRUE or FALSE, not NA

1 participant