#Anyone have experience formating

1 messages · Page 1 of 1 (latest)

dense mural
#

You haven't given us any context so I'll assume you're trying to do this in AmigaBASIC. Assuming your input string is MessageContentText(text=Text(annotations=[], value='I need to solve the equation 3x + 11 = 14. Can you help me?'), type='text') then GPT suggests that you could use the following code:

[snip - a long joke answer with amigabasic code]

#

big enough to be in its own thread perhaps

median crane
#

lol thanks!

#

Python, not AmigaBasic 👍

dense mural
#

Although AmigaBASIC is a joke, my point is:

  1. To get good answers you need to ask good questions
  2. You can ask GPT to write programs for you
median crane
#

Yeah ive been through the wringer on GPT.. my code is broken. Faaaaakkk, sorry, stressed out.

dense mural
#

Sorry I don't use python myself, best I could make is educated guesses, or general rhetorical advice about using gpt to troubleshoot

median crane
#

roger that

dense mural
#

So your code being broken, I assume you get some sort of error message that you can use to figure out how it's broken? You haven't described a very complex program - is it so broken that you need to scrap it and start again?

median crane
#

nah, the code works fine it just outputs the content all messy, I then have to 'manually' paste it into ChatGPT 3.5 (free) to clean it up. I'm not in the business of doing things manually. HAHA. I tried using the python markdown module, add a function to convert markdown to html, and it 'tries' but still outputs a mess.

#

I fully understand that asking a programatic question without details is near impossible to answer... just grasping at straws at this point.

#

I'm also talking about 30+ outputs per run. Thus why manually is inneficient.

dense mural
#

So your two options

  1. Automatically make another call to gpt3.5 api to extract the text from the response of the assistant (ugh)
  2. Function that extracts the text, assuming that it is always in the same format

#2 will of course be what almost everyone does. So is your problem with actually extracting the text from the outputted object, or converting that extracted text to markdown?

median crane
#

problem is converting it to non-messy. It outputs to CSV in the correct column, and everything else is fine. The column (content) in question has markdown html h1, h2, h3, lists, tables etc. (for blog posts) .. if I strip all of it down to raw plaintext doesn't help me either because its unformatted. You see the predicement?

#

One thing may be an option is a Google Sheet script that converts the cell???? I dont know how to do that though.. F...

dense mural
#

markdown and html are different things

#

How do you actually want the content to be formatted? You should ask GPT to output in that format, minimal postprocessing for you that way

median crane
#

tried that, still trash output. Content is all there, just formating is absolutely POOCHED. I'll keep picking away at it. Thanks for your help.

#

if I discover anything I'll follow up here.

dense mural
#

I'd be interested to see a sanitized example of the pooched output

median crane
#

sure, let create a psuedo topic, ill attach a txt file

#

3min to gen, gimme a sec.

#

this is how I need it to output (in html formating, without opening <html> </html> tags (for a blog post)

dense mural
#

I see that it is outputting a combination of html and markdown

median crane
#

its a mess LOL

dense mural
#

earlier you used the phrase "html markdown", which is meaningless, but I wonder if your prompt to gpt actually does contain the words "html markdown" which might result in this frankenstein's monster

median crane
#

i'll double check. sec

#

there was a couple instances of the term 'html' I have removed, and re-running. 2 min. i'll provide a new txt

dense mural
#

If you want it in html, unless your program is doing the markdown->html conversion, you should remove the word markdown from everything, and make it clear that you only want pure HTML

dense mural
median crane
#

i WANT html. But markdown is easier for gpt to understand in my experience. Thus gen in markdown, format markdown-2-html afterwords.

#

markdown only, no reference to HTML in any of the instructions.

#

desired output from the second txt i sent.

dense mural
#

actual output if you replace /n with actual newlines

#

actually I did that wrong, one sec

median crane
#

this is using Assistants API too, not sure if I mentioned that. It's not completions api

dense mural
#

looks alright

median crane
#

yeah that looks great.. WTF

dense mural
#

The HTML that was in there, shouldn't have had any effect because it was just an anchor

median crane
#

ok... maybe it was the rogue HTML terms in my instructions. I will play with it and get back to you.

dense mural
#

so whatever problem you're having might actually be in your markdown2html process

median crane
#

sincerely appreciate your feedback. Sometimes just have to bounce ideas of people to troubleshoot. Appreciated !!!

dense mural
#

I suggest replacing the \n with newlines before markdown2html

#

because markdown cares about lines and html does not

median crane
#

the \n is default output... thats what the API is throwing back at me.

dense mural
#

that's fine and sensible for storage

median crane
#

ok i'll fiddle around some more, i'll keep you posted. Cheers for the help bud.

dense mural
median crane
#

thats the output from the site you provided.

#

same with the other site I use.

#

so.. yeah.

dense mural
#

you have to do some massaging.. only give it the content of "value", and I did a find/replace to replace the \n with actual new lines

median crane
#

yeah, ok ... so this is the question then. HOW TO remove the \n automaticaly with python. and make it a carriage return.

#

lol

#

sorry, ive been banging my head on the wall with this for days.... no sleep till bedtime!

dense mural
#

I'm sure you can figure that part out

median crane
#

ill dig in and keep you posted. thanks again

#

you see what i'm trying to do though right? .. need to cleanse the output, then use markdown2html or whatever. all in one clean run. Trying to avoid the manual interaction.

#

but yeah, thanks!! much appreciated.

dense mural
#

there are only two more things you need it to do:

  1. extract just the "value" part of the output
  2. replace \n with newlines before running markdown2html
median crane
dense mural
#

I've told you what you need to figure out, I have my own job to be doing

median crane
#

got it. Thanks

#

im on it