We can call external APIs in code-based projects.
But, is it possible to call them in the OpenAI playground such as chat or realtime?
If anyone had those experience, please help me.
You cannot call code. The Playground demonstrates usage only.
You can see a function being called, and then type in the return text message that a function would place. Or have AI-simulated data produced, that looks at the call and writes what such a function might return.
Your application must provide access to code-based functions and internet API-based services.
Hi @_j,
Thanks for your reply.
You mean, it is impossible to call external API or function in OpenAI playground using functions?
This selected quote is correct. There is no internet access and no code to be run anywhere by functions in the playground. API is not a consumer product.
It just shows what a model would output back to your code as response in the case that AI thought your function was useful for satisfying user input.
Thanks, I got it.
Do you have any solution to link the function’s response to my application?
I want to use the AI model’s output as the input of my application.
Here’s an example of using a function. The method offered helps the AI:
Code that returns random dice will allow the AI to answer better. Function code can be used to enhance knowledge or skill with its return text, or to take external action and have the AI report on the success.
The realtime API depicted in your screen shot typically is used with voice responses.
If you want to obtain text that is preformatted so that it can be accepted easily, as the final result of what the AI produces, you would use “structured outputs” - where the AI fills in each field of pre-determined keys of a JSON. That could be used in your otherwise non-AI application.
For example, you might have the AI produce book genre for your input book title and summary. Then you’d only want {“genre”: “comedy”} as the output that your application can understand.
Perhaps you need to investigate more how you expect the procedural flow to happen in an application, and where AI is useful, if not simply making a chatbot to talk with. In the most basic form, you tell the AI what response to generate, and it writes that with its IQ and existing knowledge.
YOU are the one providing the function response back to the AI model.