Clay Icon

How to Clean GPT Output: Best Methods for Removing Unwanted Prefixes and Quoted Text

Β·
Β·

What's the best way to clean GPT output. I'm using the complete my sentence with prefix prompting technique with GPT-4, but sometimes the output doesn't have my prefix, or is quoted... Is there a standard method to clean these output?

  • Avatar of Clay Team
    Clay Team
    APP
    Β·
    Β·

    Hey hey! Can you drop the URL for your table here? (if applicable) 🫢 Don't worry, only admins will be able to open your table πŸ˜‰

  • Avatar of Rubi S.
    Rubi S.
    Β·
    Β·

    Add a bunch of examples to the GPT column without the quotation marks and with the full sentence you want at the start of the output, 3-5 should do it. If it's still giving you wrong outputs even after that just use a formula

  • Avatar of Elvis S.
    Elvis S.
    Β·
    Β·

    A bit hesistant on examples because I don't want it to overfit

  • Avatar of Clay Team
    Clay Team
    APP
    Β·
    Β·

    Hey, thanks for reaching out, and sorry for the delay! In such cases, you can add a separate formula column asking it to clean the response from chatGPT. If you're using chatGPT 4-turbo, then I'd approach it how Rubi S. suggested, adding many examples. That model's token limit goes up to 128k tokens... Of course, depending on how long your current prompt is, the other models should be able to handle it too.

  • Avatar of Clay Team
    Clay Team
    APP
    Β·
    Β·

    Let me know if you have additional questions!

  • Avatar of Nathan L.
    Nathan L.
    Β·
    Β·

    Adding on to what others have said, in a case like this tell it to strip all single and double quotes out of the output (sometimes 2 times in a prompt) and it seems to work well. Also, if you can avoid it, don't use quotes in the prompt itself.