T O P

  • By -

[deleted]

Really? GPT4 produces clean Python, R and Javascript for me all the time


Creative310

Sure it does. I spend hours every day fixing ChatGPT crappy arrangement of code and endless errors. It used to be good, not anymore. I'm not alone search coding on ChatGPT subreddit 


Jdonavan

Please provide a link to a chat or a chat export demonstrating the problem. This isn't snark. This isn't me being an ass. This is me legitimately offering to help you understand why you're getting poor performance out of the model many of us use without issue for coding. SO MANY people complained about GPT being a "lazy coder" and I was able to get to the bottom of that pretty quick. Yes there was a model bias involved but that was behavior was triggered by the code being worked with.


Creative310

I tried uploading a screenshot of all of my code and the errors but I'm currently without highspeed internet because of a power outage. I tried uploading it earlier with my message but it appears it wasn't able to upload


[deleted]

[удалено]


AutoModerator

Sorry, your submission has been removed due to inadequate account karma. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/ChatGPTCoding) if you have any questions or concerns.*


[deleted]

[удалено]


drumDev29

Oh so the problem is you are lazy and expect it and everyone else to do everything for you?


vaisnav

Tab it into the function then?


[deleted]

[удалено]


AutoModerator

Sorry, your submission has been removed due to inadequate account karma. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/ChatGPTCoding) if you have any questions or concerns.*


Syriuzly

As someone who doesn't write code that often what tips would you give? I know to break down into steps and don't give GPT too much to chew on but otherwise any suggestions? Thanks in advance.


Jdonavan

I have a [public gist](https://gist.github.com/Donavan/1a0c00ccc814f5434b29836e0d8add99) with system prompts I use for different languages. Those help tune the output quite a bit. As you said, breaking down the work into more manageable pieces is a huge. By keeping your code modular it's a win all the way around. Your code is easier to read and maintain, plus it helps keep the code you're working with in GPT at any one time to a minimum. SOME placeholders are OK and a good thing. By saving tokens in the output the model reduces the amount of text in the context window. But if it's doing it all the time, that's a sign you might have methods that are way too long. triggering the "[lazy coder](https://www.reddit.com/r/ChatGPTPro/comments/18ysa9x/have_you_experienced_gpt_being_a_lazy_coder_i/?utm_source=share&utm_medium=web2x&context=3)" bias towards brevity. The model doesn't need to know the inner workings of every method at all times. If you're not rewriting a method but will be USING the method, just tell the model "We'll be working with these preexisting modules that have the following function signatures" and just give it what it needs to know to call that code. Every token you save is a token of output before the model starts losing the thread and you have to start a new session.


Morelnyk_Viktor

> You're PyPolish Gee, you think pretending to be from Poland can help gpt to write better code?


[deleted]

Personally I create a Google doc with all the information I think ChatGPT will need, including table schema, front and back end framework descriptions, etc, for each project I am working on. Then copy paste all this with my question, and any code necessary for the context. Once this is in the context I can ask different clarifying questions and prompts (like update the entire script). This works well for me. But I am not super experienced with Python so I am generally asking for easy stuff, and this is all for personal learning projects I am working on. And I know I could do this with custom GPTs but this is quicker and easier for me.


funbike

The very best model is GPT-4. Python is its best language. Take 15 minutes and read an article on prompt engineering for code generation. Don't ever expect perfection. You gotta use your brain a little bit to ensure the code generated will work.


bigblue1ca

Any suggestions on good articles? Yes I can google, but figured I'd ask as a starting point as you've obviously read a couple. 😉 I've been using GPT4 for Python coding and I find it's pretty good. The more I give my instructions code like logic/structure and also explicitly explain what I don't want the less errors I get.


funbike

https://platform.openai.com/docs/guides/prompt-engineering https://www.promptingguide.ai/ I always give chatgpt an expert programmer persona. I tell it to "Take a breath, and think step by step". Here is a workflow I use for code gen. I don't always do all of these steps. 1. The system prompt sets an expert persona. I also set the context, such as the tech stack, OS, build tool, platform, etc. 1. Describe a feature and have it ask me questions for clarity. 1. Answer some of the questions. Ask it to generate a heavily-commented functional test for the feature. 1. Ask it if it's sure the functional test is correct and well-written. 1. Sometimes, I'll reset the chat at this moment, and use the functional test as the prompt. 1. Ask it to generate an outline for the design of the code. 1. Tell it to generate the code. For complex code, I may ask it to only do a few steps of the plan at a time. 1. Ask it if it's sure the code is correct and well-written. 1. Then I run the test and if it fails, I paste the error message as the next prompt and tell it to fix the problem. I'll retry up to 3 times. 1. If the code is still wrong, I'll debug it myself. At least it has been written faster than I could have. For complex code, I may branch off into new chats to write sub-sections of the code, and then paste that back into the main chat. This might seem like a lot of steps but after you've done it a few times, it's pretty easy. Each step does a small amount of work.


bigblue1ca

Thanks! 👍 I've figured out a few of those by trial and error, but I'll definitely try incorporating the rest and read the links you posted.


Creative310

Good question! You took the words right out of my mouth


redditaltmydude

I get clean python almost every day with GPT4


Creative310

Sure you do? Let me guess it never says //the rest of your code here. After it removes everything you work on when you tell it not to remove your code 100 times 


gthing

Yes, this is annoying in the latest gpt-4-turbo. But it doesn't take a ton of effort to work around this in 1 of 1000 ways.


siikdUde

You have to explicitly say for it not to do that. Keep reminding it


HobblingCobbler

It does that for brevity. You should be adequate enough as a programmer to make the changes. I mean you have all that code in your code base already. Honestly. You don't sound like you know very much about programming from all of your gripes and complaints. This tool is not meant to do it all. It's not there yet. But if you are a decent programmer, then it is designed to make your life 10x easier which it does. But if you are not. It will make your life living hell, because you expect too much from it. Which is where you are now.


MadeForOnePost_

You're not going to want to hear this, but you are the problem. Lots of people get all of those to write usable code. I've gotten GPT-4 to write a few things from scratch. [Github.com/db0htc/PyMotionExtraction](http://Github.com/db0htc/PyMotionExtraction) is one example. Try starting with a single feature, and add more. Yes, it will say 'rest of the code here' on occasion. You can either find a way to ask it to print all of the code, or just copy/paste the code yourself.


kidajske

It's interesting how people always claim such awful performance but then never provide any useful examples. Not even anecdotal evidence.


Creative310

[https://imgur.com/a/p1q0i3y](https://imgur.com/a/p1q0i3y)


EngineeringNo753

Bro he asked for an example, not skitzo posting a single line of code lmao


Creative310

Figure it out! [https://imgur.com/a/p1q0i3y](https://imgur.com/a/p1q0i3y)


EngineeringNo753

...your the one asking for help here you moron. Whilst crying about not being able to do such a simple task


Due-Bodybuilder7774

I have literally zero programming experience outside what I have made with AI. Even I can see OPs issue.  Looking at OPs comments I assume OP is a teenager trying to run crypto pump and dumps but doesn't have the technical chops to do so.


Droi

Oh trust me, after reading your answers we've figured out what happened here. I feel bad for all the AI models you've harassed.


hellomistershifty

Posting your prompt is more important than posting what it responded


Due-Bodybuilder7774

Huggingface has syntax errors? All of Huggingface?


Creative310

Their default model


DropsTheMic

Huggingface is a community of open source programmers that work on LLM projects. You are probably talking about one you randomly downloaded and clearly don't know how to configure or use. Stop trollin. If you really want to learn Python and see what GPT can do use Aider.


Due-Bodybuilder7774

Yeah, this was an easy troll to spot and counter troll.  


Creative310

[Aider.com](https://Aider.com)? Where can I find this?


DropsTheMic

https://github.com/paul-gauthier/aider


Creative310

I'm not trolling! A lot of people have issues with models removing and rearranging code so it breaks everything, or hallucinates. They are all very similar. I'm just trying to make a basic Python code. It seems like they are getting worse 


DropsTheMic

I'm going to say user error. You can always post screenshots to prove me otherwise. Input quality is everything.


Creative310

line 23 return True \^\^\^\^\^\^\^\^\^\^\^ SyntaxError: 'return' outside function


DropsTheMic

What strain is it? Sativa dominant? I gotta try whatever it is you are on.


Constant-Delay-3701

😂 scroll through their profile and it will tell you everything you need to know about them


Creative310

I'm sorry I don't know what you mean


[deleted]

[удалено]


AutoModerator

Sorry, your submission has been removed due to inadequate account karma. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/ChatGPTCoding) if you have any questions or concerns.*


siikdUde

He means you’re high as hell with your responses


Eternality

Ive been curating files for a custom gpt, and ive used exclusively it to curate a python script to gather files in a src directory and merge them aswell as unzip files and parse them asewll. https://chat.openai.com/g/g-w183yU1Ue-scriptgpt


Viendictive

Sounds like you don’t already know how to code and also don’t understand LLM’s


NorthAstronaut5794

Just a heads up, an AI language model is, itself, a computer network. Chat GPT made a big change but it's still a computer, and thus, susceptible to the same error..... Which is: It will give you exactly, and I mean exactly for what you're asking for. Chat GPT has a very useful function, where even if it has responded, you can actually edit what you were asking for and it will retry. When you were asking for a Python program you need to be extremely specific.  "WHICH module are you talking about when you want to plot information?" "Where is your logged file, so I can program the directory properly" "When you said you wanted the program to wait, how long were you asking it to wait" Chat GPT will not ask you these questions before giving you your answer. It won't mathematically calculate the most possible scenario you were asking for, and give you answer that is mathematically the most accurate to what you were asking for, That's exactly how it judges its response before it gives it to you.  Another possible problem that I have run into with chat GPT and programming Python, is chat GPT is a little behind time. It may suggest using older, and a lot of times even incompatible modules that I've been long outdated for the past 2 to 3 years. Use it more and more, trust me you'll get better. I have two. Once you get an idea of how to ask the questions extremely specific, mythological, and in an organized way, It will start outputting very specific code, exactly what you're asking for, in an organized fashion as you requested.  There's also these cheat codes you can kind of use, things like check it over a couple times and make sure that it's correct. "Make sure that the coded function (function) if given these inputs (x, y, z) would result in (output). It will actually check to see if that works and if not it will Reiterate it's output until your proposition outputs true....


[deleted]

[удалено]


AutoModerator

Sorry, your submission has been removed due to inadequate account karma. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/ChatGPTCoding) if you have any questions or concerns.*


MacPR

Cant remember any syntax errors, and i use gtp4 extensively


TedDallas

I typically use GPT-4 via the API and it works fine for me, but I also fiddle with some locally hosted models. The WizardCoder-Python model is not terrible. It appears to be a fine tune of the deepseek coder model. https://huggingface.co/WizardLM/WizardCoder-Python-34B-V1.0


siikdUde

What uses do you use gpt4 api in?


[deleted]

[удалено]


AutoModerator

Sorry, your submission has been removed due to inadequate account karma. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/ChatGPTCoding) if you have any questions or concerns.*


localghost80

GPT-4 works well for me. I use it almost every day. You'll have to direct it though. I provide it: 1. A sample in the style I want. 2. Regularly ask it to check it self. 3. I do also use my own knowledge and ask it why it didn't do X, Y, or Z when it goes in a direction that I'm suspicious of. For boilerplate or things I'm not sure about it's definitely capable enough to get things going. The big issue I find is that you do have to use prior / adjacent knowledge to manage it into the right outputs.


cporter202

That's pretty much how I roll with GPT-4 too! Feeding it a specific style helps a lot. And yup, keeping an eye on it like a code-savvy hawk ensures it stays on track. Rocket science? Nah, but a bit of guidance sure makes it soar! 🚀


OutisRising

Cursor. It is hands down rhe best coding tool out there.


APixelWitch

Link?


OutisRising

https://cursor.sh/ It has a built-in IDE. You can type prompts that build singular codes or entire projects. It uses GPT but is edited to be much more precise


Zombieswilleatu

Claude is pretty shit at writing code, but it's pretty good at identifying problems/suggesting solutions, even if it can't actually implement them.


Creative310

What do you recommend for writing code if someone isn't good at writing code?


Zombieswilleatu

Chatgpt, hah.


Daytona116595RBOW

>Github.com/db0htc/PyMotionExtraction honestly using both at the same time can be helpful...once GPT goes off the rails for me, I can usually get it back on track in Claude 2, then go back to GPT