App crashes on successful external API call

I’ve even redone the entire application a second time to make sure it wasn’’t something I have done. I use an HTTP sniffer and see that I have a successful API call. As soon as I receive it, the entire app crashes.


Could you please post a Screenshot of your API Response and the relative Model?


Here is an example response as taken from my HTTP sniffer:


That depends on what you’re referring to. Could you provide more information",“index”:0,“logprobs”:null,“finish_reason”:“length”}],“usage”:{“prompt_tokens”:4,“completion_tokens”:16,“total_tokens”:20}}

I apologize for the difficulty on my end, but relative model? I’m not sure of what you’re referring to.

The best way to handle the API Responses is by creating API Data Types. You can see more also here.

In your specific example you need to go to Models and create 2 models.

On for each Choice

where the properties will be the keys of the JSON in the choices path.

and another one that will nest Choice inside, called Davinci(or any other name)
With the id and the choices which is type List of Choices. List of Choices is a type of Array and you can see here how to create it.

After you have successfully created the 2 Models/Data-Types, and have created the properties of them, you can go to the API Response and create a new Response Parameter with the Type of Davinci. Kodika will map the keys automatically. As you are using the Davinci model that matched your response keys, you do not need to set anything in the Parameter Path.
If you do not want to use the Davinci model, you can create only the Choice and then in the Response Parameter you can use choices as Parameter Path and List of Choices for Parameter Type. The Parameter Name could be anything that you want.