https://retellai.com/?utm_source=discord&utm_medium=seo logo
Chatbot formatting issue
# ❓・bug-report
s
Hello! I'm new to building chatbots, and I'm getting stuck and hoping someone might have experience to help me out. So my chatbot is meant to give a full travel itinerary, and it's having zero problems getting the information, it's formatting that is the issue. For example if it's a 4 day itinerary it will give all 4 days as one paragraph in the chat, which is difficult to read. I've tried a number of things in the prompt such as telling it the structured format I'd like in markdown format, or even trying to have it give just one day and wait for response before giving the second day and so forth, but still it combines it all into one paragraph. What's weird is that when I send off a post chat webhook to make.com and I check the data coming in, it's structured very nicely. Anyone have suggestions?
s
Which agent type are you using?
s
Hi! Yea, I'm using the chat agent, not voice. Sorry for the couple day delay in response. It's busy at work and I only get a day, maybe two a week to work on this. Gotta say, the company I work for loves ReTell, we're switching so many of our clients over to it. So I'm curious if maybe it's a rendering issue in the chat? Does the chat widget have a specific format that I could prompt the AI into returning so that it can be displayed the way that I'd like? I suspect that because of the previously mentioned fact that GPT 5 is returning the information formatted with newlines, bullet points and everything nicely, which I can see in make.com's webhook. But the test chat, as well as my local website where I integrated the chatbot still shows it as one long string. Full disclosure, I'm not a front end dev and so I'm kind of having to learn quickly on this project. Thanks for the help, by the way!
c
Prompting for Raw Data Request a Specific Format: Start by clearly instructing ChatGPT to provide the information in a raw format. JSON: To get structured data, ask, "Provide the following information in a well-formed JSON format". Plain Text: For simpler, unformatted text, ask, "Please output the following as plain text, without any markdown or special formatting". Custom Format: You can even define a custom structure by providing an example of the desired output format in your prompt. Extracting the Data 1. Using the API: If you are using the OpenAI API, you can use the with_raw_response method with the client.chat.completions object to get the raw API response, which can then be processed, according to the OpenAI Developer Community. 2. Using Code to Parse: The most efficient way to get raw data is to use code. In Python: Use the json library to parse a JSON-formatted response. For raw text, you can split the response by lines and remove extraneous characters. Frameworks: Libraries like LangChain can automate the process of breaking down inputs, generating sections, and stitching together the final raw data.
s
this is a rendering issue, not a prompt/LLM issue. The Retell chat widget renders plain text; the docs don’t advertise Markdown or rich-text formatting. So your nicely formatted bullets/newlines that you see in Make.com arrive as \n etc., but the UI collapses them into one paragraph