dotAI API completion

Hi,

I am able to run other APIs related to dotAI. But I keep failing to use this api
http://localhost:8082/api/v1/ai/**completions\*\*

When I tried to run inside dotCMS, it works fine and i can get the response. The response that I have got is

{
“error”: “null: Got invalid response for url: [``https://api.openai.com/v1/chat/completions\``] response: [400]”
}

For simplicity, I used the following payload

{

  "prompt": "How much is the price of Patagonia Boys' Baggies 5",

"indexName": "Product-Blog-Index",

"model": "gpt-4o",

"temperature": 0.7

}

Really appreciate for your help

Thanks

I would suggest a few things -

  1. make sure that gpt-4o is in your allowed models comma separate list in the dotAI app configuration screen
  2. make sure you have created an embedded content index and have content in the index you are trying to use. To do this, you can go to the dotAI screen > Manage Embeddings / Indexes and add some content to the default index using a content query like +contentType:* which will add all your content to the embedded index.
  3. Again, in the dotAI > Content Search and Chat tab, try running a few queries against the index you have created. Open your developer tools and look at the network tab and the api call payload for an example of what a working query should look like
  4. If none of this works, I would tail the application logs and see if there are any sepecific error messages. If so, feel free to share them here to help us help you.
1 Like

Thank you very much @wezell . It should work now :slight_smile: