31
Views
2
Comments
Solved
OpenAI response 200 but no value retrieved
Application Type
Reactive
Service Studio Version
11.53.31 (Build 61742)

Hi,

I am getting a weird behaviour when consuming the OpenAI completion endpoint. As you can see in the response, the Text field is always empty. When trying this on postman or other service, I get "Text: Customer service". Anyone has a clue why this is happening in Outsystems?


This is my request:

{  "model": "text-davinci-003",  "prompt": "Tag the feedback as customer service or user interface\n\nFeedback: My phone is late. Why don't you tell me anything?\n\n",  "temperature": 1,  "max_tokens": 250,  "top_p": 1,  "frequency_penalty": 0,  "presence_penalty": 0,  "stop": ["\n"]}


the response:


{

  "id": "cmpl-6UCOwNOkBKu1TdMCz30O2sI12X16v",

  "object": "text_completion",

  "created": 1672655530,

  "model": "text-davinci-003",

  "choices": [

    {

      "text": "",

      "index": 0,

      "logprobs": null,

      "finish_reason": "stop"

    }

  ],

  "usage": {

    "prompt_tokens": 86,

    "total_tokens": 86

  }

}



UserImage.jpg
Carlos Pinho
Solution

Just found out that using \n as stopper might trigger inconsistent behavior of the end point.


I am using \n\n instead, and so seems to be working fine.

UserImage.jpg
Alexandre Yip

Hi Carlos,

Checking the documentation you need to send in the request the echo parameter as true

default is false


https://beta.openai.com/docs/api-reference/making-requests




Hope that it helps you

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.