Return 2 elements from 1 request

Hello,

I’m wondering if it’s possible to generate 2 elements from 1 API request. For instance, I’m building a math calculator. Users are supposed to enter a math expression, and I would like to reply him with 1) a number result and 2) a text to explain how the expression is evaluated to achieve the number result.

Does anyone know how to achieve this?

Thank you

Tie

Looks like you can use the brand new Structured Output, the first “chain of thought” example here https://platform.openai.com/docs/guides/structured-outputs/examples seems to be exactly what you want to achieve.

1 Like