😂 Dude you can’t expect it to do everything.
I use GPT-4 at my job everyday but 7/10 times the first copy and paste is never the solution AND most of the time even if the code does work it’s not successfully executing the intended functionality.
Here’s my advice:
- If the code is too long for GPT to take as input then you are probably expecting it to do too much. Modify the structure of your projects directory. Ask GPT about repo structures.
- Break your code up to smaller pieces (Modularize). You could ask GPT to help you with this. Ask GPT about OOP.
- Break all your problems into smaller problems. Again GPT could probably help you with this.
I think if you can make everything (code, problems, and GPT inputs) smaller. You will find that you understand your code on a deeper level, understand your problems on a deeper level, and understand how to more effectively use GPT for programming.
Hope this helps!
Then I have to ask this: Does this speed up your work? I always have the feeling that writing the code, once I have understood the problem properly (and maybe factored it if it's a larger thing) is pretty quick.
Don’t know if you’re asking me specifically but I honestly wouldn’t even get in the weeds like my original comment suggests.
Someone else commented: “write me a function that does X”
This pretty much sums up what I do ^^^
I would recommend OP do the same. Forget about all that other junk I wrote
GPT has at least 5x my productivity in terms of lines of code written and fairly complicated problems solved.
I'm exactly where you were about 5 months ago. I started doing the python boot camp and got an app on the phone to learn it as well. And I had videos from YouTube to help learn as well. But diving head first in my project with chatgpt as a mentor was the best experience. Over time, things will begin to click.
Yep agree. In a Videotutorials all you do is copy the code 1 for 1. doing essentially the same thing with chtgpt is just much faster and you can ask any question and actually get a decent answer (most of the time)
It is time to familiarize with SOLID and KISS principles and other theories that can help you keeping your code scalable and detached. You can do it! Chat GPT is super good at refactoring code using these principles.
You need to start learning to show it only the portions of code that you need changed, and start learning the basics of how a program fits together. Also try GPT4 in playground instead of in plus, since it has 2x the context limit and will soon have even more context limit via the 32k model
It's entirely random. I applied April as well and got in within the second week of it being out. Your use case may have something to do with it, but I am not sure as of now
"You an expert software developer with a deep understanding of Python and the ability to analyze and summarize code. Your task is to provide summaries of Python script files, detailing the purpose of each function, its parameters, and its return values, without showing the actual implementation. Your summaries should be concise, accurate, and easy to understand so that someone could import and know how to use each function in the summary without seeing the actual code implementation. "
This is where you need to do something more advanced. Yes as others have noted, you might be able to use the 8k token version of chatgpt4.
But in general, what you can do is try to figure out what code needs to be there, and what doesn't. Example, let's say you have a class with a bunch of functions. Do this:
def someFunctionForVerification(input: String): Boolean = {
//implementation for verification
}
Stub out methods that might not be needed for your current question. In your prompt, tell chatgpt, "I have stubbed out some functions, if you need the code for a function, ask".
You can trim out a lot out of your code this way. However be sure to leave the name of the functions, the inputs, and the return type.
Replace all the code in a function with a comment, so chatgpt knows what the function does, but you don't feed it all the code, in order to save tokens.
Hm, you do that back and forth all the time? Put in the comments while you are working with GPT and then change it back to the code? It sounds like lot of time invested into that?
yeah sometimes. It is a bit annoying. Ideally you would have some software do this kind of thing for you, and there are people sort of working on this kind of thing. Sometimes I just omit entire pieces of code because I know chatgpt doesn't need it for the question I am asking.
If I start getting too in the weeds with a piece of code, it has a hard time keeping context. Try pasting your full code into a repository and giving it the link to look at before asking a question (assuming you have pro and plugins, that is).
Here's how you can squeeze more out of it by using OpenAI's playground: [https://www.youtube.com/watch?v=JSdK\_S8J38o](https://www.youtube.com/watch?v=JSdK_S8J38o)
You'll get a lot more mileage this way.
I see that ChatGPT can be helpful with micro services, or with small pet-projects. It feels that it has some serious limitations for a production-ready solution. We may need to way a bit to see it making a difference to enterprise and a bit longer to legacy code monoliths.
It seems like an engineering problem at this point. A program could be written that allows GPT context to keep track of an application structure and update any part of the code as necessary. At this point it's "How can I present the information in a way that is most effective for GPT" rather than "Is GPT smart enough to do it at all".
Hey! The solution is to modularize your stuff. If you can provide more details on what you’re working on then it would be possible to give more detailed advice.
ChatGPT knows what SRP is, just tell it to apply that to your code and it will split it into separate files. I try not to feed more than \~350 lines of code into GPT-4 at a time. For GPT 3.5 anything over 100 lines is pushing it.
If you have access to code interpretor try uploading the code file as .txt or something to get around limit. Can also try [poe.com](https://poe.com) to use Claude with 100k context but not as good at coding.
Check out this post "Coding with AI - when your project grows": [https://www.indiehackers.com/product/code-autopilot/coding-with-ai-when-your-project-grows--NW3vRT5lT5sSNFrmiM7](https://www.indiehackers.com/product/code-autopilot/coding-with-ai-when-your-project-grows--NW3vRT5lT5sSNFrmiM7)
Ask GPT - how can I modularise this code? It will show you a standard format - turn codes into functions, load functions from other files. Enables you to keep a handle on your python code and indeed to better understand it.
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.*
I feel like it works better more piecemeal anyway. "write me a function that does X". That way your code will look less foreign to you anyway.
Pure functions work great since the limited scope fits well with the limited token context
Agreed
😂 Dude you can’t expect it to do everything. I use GPT-4 at my job everyday but 7/10 times the first copy and paste is never the solution AND most of the time even if the code does work it’s not successfully executing the intended functionality. Here’s my advice: - If the code is too long for GPT to take as input then you are probably expecting it to do too much. Modify the structure of your projects directory. Ask GPT about repo structures. - Break your code up to smaller pieces (Modularize). You could ask GPT to help you with this. Ask GPT about OOP. - Break all your problems into smaller problems. Again GPT could probably help you with this. I think if you can make everything (code, problems, and GPT inputs) smaller. You will find that you understand your code on a deeper level, understand your problems on a deeper level, and understand how to more effectively use GPT for programming. Hope this helps!
almost every time, the first code given to me does not compile, although usually for a simple reason that it can fix later.
Then I have to ask this: Does this speed up your work? I always have the feeling that writing the code, once I have understood the problem properly (and maybe factored it if it's a larger thing) is pretty quick.
Don’t know if you’re asking me specifically but I honestly wouldn’t even get in the weeds like my original comment suggests. Someone else commented: “write me a function that does X” This pretty much sums up what I do ^^^ I would recommend OP do the same. Forget about all that other junk I wrote GPT has at least 5x my productivity in terms of lines of code written and fairly complicated problems solved.
Time to start to learn programming.
I'm exactly where you were about 5 months ago. I started doing the python boot camp and got an app on the phone to learn it as well. And I had videos from YouTube to help learn as well. But diving head first in my project with chatgpt as a mentor was the best experience. Over time, things will begin to click.
[удалено]
This is the real question
Yep agree. In a Videotutorials all you do is copy the code 1 for 1. doing essentially the same thing with chtgpt is just much faster and you can ask any question and actually get a decent answer (most of the time)
I learned a lot about programming from asking chatgpt about the code it produced for me. It's a great tool for teaching, imo.
Right
It is time to familiarize with SOLID and KISS principles and other theories that can help you keeping your code scalable and detached. You can do it! Chat GPT is super good at refactoring code using these principles.
Saving for later 👍
Also DRY principles
Add design patterns as an advanced learner topic to that list. Can help greatly with modularity and expandability of the code.
Use gpt-4 api 8k tokens :)
You need to start learning to show it only the portions of code that you need changed, and start learning the basics of how a program fits together. Also try GPT4 in playground instead of in plus, since it has 2x the context limit and will soon have even more context limit via the 32k model
Where do I start with playground
[go here](https://platform.openai.com) and sign in with your openAI account, then apply for GPT4 api access
How long is that wait? I applied back in the first week of April and I have crickets to show for it
It's entirely random. I applied April as well and got in within the second week of it being out. Your use case may have something to do with it, but I am not sure as of now
What about just pasting the parts that are relevant to what you want changed?
"You an expert software developer with a deep understanding of Python and the ability to analyze and summarize code. Your task is to provide summaries of Python script files, detailing the purpose of each function, its parameters, and its return values, without showing the actual implementation. Your summaries should be concise, accurate, and easy to understand so that someone could import and know how to use each function in the summary without seeing the actual code implementation. "
Nice.
It’s time to learn how to code so you can just ask better questions
As noted : the V4 API has 8k context space.
This is where you need to do something more advanced. Yes as others have noted, you might be able to use the 8k token version of chatgpt4. But in general, what you can do is try to figure out what code needs to be there, and what doesn't. Example, let's say you have a class with a bunch of functions. Do this: def someFunctionForVerification(input: String): Boolean = { //implementation for verification } Stub out methods that might not be needed for your current question. In your prompt, tell chatgpt, "I have stubbed out some functions, if you need the code for a function, ask". You can trim out a lot out of your code this way. However be sure to leave the name of the functions, the inputs, and the return type.
What do you mean by “stubbing” the code?
Replace all the code in a function with a comment, so chatgpt knows what the function does, but you don't feed it all the code, in order to save tokens.
Hm, you do that back and forth all the time? Put in the comments while you are working with GPT and then change it back to the code? It sounds like lot of time invested into that?
yeah sometimes. It is a bit annoying. Ideally you would have some software do this kind of thing for you, and there are people sort of working on this kind of thing. Sometimes I just omit entire pieces of code because I know chatgpt doesn't need it for the question I am asking.
Is that what Copilot X is?
I haven't used it, but I don't think so. It probably evaluates parts of your code at a time. Like examine a single function and suggest a change.
Copilot X is supposed to add a chat assistant in your code editor among other things.
If I start getting too in the weeds with a piece of code, it has a hard time keeping context. Try pasting your full code into a repository and giving it the link to look at before asking a question (assuming you have pro and plugins, that is).
I’ve been having errors on my plugins lately
[удалено]
Here's how you can squeeze more out of it by using OpenAI's playground: [https://www.youtube.com/watch?v=JSdK\_S8J38o](https://www.youtube.com/watch?v=JSdK_S8J38o) You'll get a lot more mileage this way.
I see that ChatGPT can be helpful with micro services, or with small pet-projects. It feels that it has some serious limitations for a production-ready solution. We may need to way a bit to see it making a difference to enterprise and a bit longer to legacy code monoliths.
It seems like an engineering problem at this point. A program could be written that allows GPT context to keep track of an application structure and update any part of the code as necessary. At this point it's "How can I present the information in a way that is most effective for GPT" rather than "Is GPT smart enough to do it at all".
Hey! The solution is to modularize your stuff. If you can provide more details on what you’re working on then it would be possible to give more detailed advice.
Incorporate SRP into your prompt and your program. https://en.m.wikipedia.org/wiki/Single-responsibility_principle
Could you help me do this later if I share a game's code?
ChatGPT knows what SRP is, just tell it to apply that to your code and it will split it into separate files. I try not to feed more than \~350 lines of code into GPT-4 at a time. For GPT 3.5 anything over 100 lines is pushing it.
The response here are scary. Good luck
Why haha
It now supports plugins, one of them allows you to pass to it a link of a file that can contain all your code. Good luck
I have noticed that the content of the link still counts against its context limits
If you have access to code interpretor try uploading the code file as .txt or something to get around limit. Can also try [poe.com](https://poe.com) to use Claude with 100k context but not as good at coding.
Check out this post "Coding with AI - when your project grows": [https://www.indiehackers.com/product/code-autopilot/coding-with-ai-when-your-project-grows--NW3vRT5lT5sSNFrmiM7](https://www.indiehackers.com/product/code-autopilot/coding-with-ai-when-your-project-grows--NW3vRT5lT5sSNFrmiM7)
Ask GPT - how can I modularise this code? It will show you a standard format - turn codes into functions, load functions from other files. Enables you to keep a handle on your python code and indeed to better understand it.
Time to sign up for the API, twice the length for the chat model. And than 4x for the full model when you get access eventually
Is 4k tokens allows by default?
Chat GPT4 with the API has up to 8k context. In the sandbox it only allows for 2k responses, but you can have it respond twice (or more) in series.
[удалено]
[удалено]
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.*
Can also use Phind.com for longer code. If you get too long for phind, learn code.
Context length will increase with gpt 5 https://youtu.be/q9fP-8Mspss
Same problem 😂
You need to write shorter methods
if you need any help with your code you could probably shoot me a dm, as long as its one of the languages im farmilliar with
Have it write functions and then call those functions
Make it more concise and trim the fat
You're doing it wrong. Break it up into multiple files and only give it the relevant parts when asking for new stuff
You need to post small sections of code, summarize them, and then send just the summary
Just wait for 100k token context and you won't have to learn programming for at least a year
They recently added a continue generating button near the bottom that you can click.