[Python] Can I limit the response from chatGPT API call to just the parsed message?

Discussão em 'Python' iniciado por Stack, Março 18, 2025.

  1. Stack

    Stack Membro Participativo

    I call chatGPT from Python using openai_client.beta.chat.completions.parse(...,response_format=MyClass)

    It spits back a giant response comprising of 750 tokens, pasted here. I'm only interested in response.choices[0].message.parsed, which is a more modest 300 tokens. While having all the extra junk doesn't hurt the code, it does hurt my wallet.

    Is there a way to just get the parsed message?

    Continue reading...

Compartilhe esta Página