in the chat playground, there should be a view code option/button (left top) that will generate corresponding code block that you can call. The restful openai call should contain AI search index parameters that references document knowledge base. Worth giving it a try.