Formatting of chat gpt response
P粉563446579
P粉563446579 2023-10-25 14:53:41
0
1
730

I'm using chat gpt api on my react app. The problem I'm facing is how to format the response from chat gpt. If I ask it to give me a response in a table format it gives a weird response, I'm using pre-tagged to display the text and the response is showing the attached image this way but I want the correct table like chat gpt does if I ask, in the same way it displays as paragraph form instead of any list of items on different lines, so how to format chat GPT response correctly.

I want the correct tables and lists as shown by the chat gpt but this is how I receive the data This is how the data appears when using pre-tagging, but I want the correct table

P粉563446579
P粉563446579

reply all(1)
P粉098417223

ChatGPT and the OpenAI API can return data in a format that works for you. Just add formatting instructions to the prompt.

Example:

Return the answer as a JSON object.

Do you know the 10 most popular books by Stephen King? Returns an array of books in a JSON object.

ChatGPT Answer:

{
  "books": [
    {
      "title": "The Shining",
      "year": 1977,
      "description": "A horror novel about a family that moves into an isolated hotel with a dark past."
    },
    {
      "title": "It",
      "year": 1986,
      "description": "A story about a group of friends who confront a shape-shifting evil entity in their small town."
    },
    ...
  ]
}

You can then fine-tune the results using ordered by {something}, group by {something}, etc.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template