Extract code from Text gpt response

Hey :slight_smile:
When receiving a response back from Text GPT Api is there a way to know which parts are code and which parts are text?

In Chat-GPT when it writes back it will highlight code blocks, so I assume there is a way to do so.

Do you have any idea how to do so? Thank in advance!

in your prompt tell it to wrap any code examples in <code></code> blocks and it will do so:)

That’s a good idea, I tried it previously but sometimes it does not close the ending block, it seems to not be due to running of Tokens.

But I will try again, thanks for the reply!

i have been experimenting with two bots Marv and Fleur, both different characters. Fleur loves to beautify her responses for clarity with html and she prefers to use bulletpoints in her explanations and puts them on new lines for extra clarity and loves bold headings… while Marv doesn’t beautify his normal responses but does always wrap his script examples within the code blocks… i put the bot in telegram groups… marv was more popular with the nerds in a linux group… fleur was more populair in a more spiritual group… it was fun to experiment for 3 days with having a cranky sarcastic bot and a spiritual happy bot next to each other that both have different ways to present the requested information… it worked… too bad i ran out of credits so fast while people where asking questions and testing their capabilities… many people where amazed by the power of AI… heck testing was a lot of fun while it lasted… be careful… there’s no warning or indication how many tokens you are spending while testing…

1 Like

Does anyone have any idea how to solve this?