First of all, don't use ChatGPT for that. Use full GPT-3, specifically the code models (ie. code-davinci-002). ChatGPT is a subset & tweak of the full GPT-3 model to make a good chatbot, and it's actually less capable than the full model. It's strange to me that people are going crazy over ChatGPT when GPT-3 has been out for months now. More info on the difference between ChatGPT and GPT-3: https://dev.to/ben/the-dif…
Well, ChatGPT is free for now.
Ask HN: Can ChatGPT generate fully functional code?
21–30 of 69 posts
Re: Ask HN: Can ChatGPT generate fully functional code?
#22Try a simple calculator. It will give you the complete code for that. I think there's a set limit on output text so that's why your tic-tac-toe was incomplete. I've asked for the calc in Rust and Python and I got a working app for both. It was simple but the fact that it gave me what I asked for is amazing. I bet that you could break-up your app into functions and have ChatGPT write each function to get to a bigger p…
Re: Ask HN: Can ChatGPT generate fully functional code?
#23You can't tell it to "create a CRUD app", but you can ask it to create a nodejs function that gets all the records from a mongodb database.
Re: Ask HN: Can ChatGPT generate fully functional code?
#24Take a look at this: https://www.dropbox.com/s/gq2hkp7w37c5y6q/ai.png?dl=0
Re: Ask HN: Can ChatGPT generate fully functional code?
#25I've been using it for small blocks of code or specific functions - stuff I'd have to look up documentation or Stackoverflow for. I see it as a productivity booster, not a replacement. You can't tell it to "create a CRUD app", but you can ask it to create a nodejs function that gets all the records from a mongodb database.
const express = require('express')
const app = express()
// define the model for a user
const User = {
name: '',
email: ''
}// create a new user
app.post('/users', (req, res) => {
const user = Object.assign({}, User, req.body)
// save the user to a database, etc.
res.send(user)
})// read a list of users
app.get('/users', (req, res) => {
// retrieve a list of users from the database, etc.
res.send([
{ name: 'Alice', email: 'alice@example.com' },
{ name: 'Bob', email: 'bob@example.com' }
])
})// read a single user
app.get('/users/:id', (req, res) => {
// retrieve a user with the specified id from the database, etc.
res.send({ name: 'Alice', email: 'alice@example.com' })
})// update a user
app.put('/users/:id', (req, res) => {
// retrieve the user with the specified id from the
database, etc.
const user = Object.assign({}, User, req.body) // save the updated user to the database, etc.
res.send(user)
})// delete a user
app.delete('/users/:id', (req, res) => {
// delete the user with the specified id from the
database, etc. res.send({ message: 'User deleted' })
})app.listen(3000, () => {
console.log('Listening on port 3000')
})Re: Ask HN: Can ChatGPT generate fully functional code?
#26Re: Ask HN: Can ChatGPT generate fully functional code?
#27Someone on /r/rust is currently marveling that it spit out a working bitmap allocator: https://reddit.com/r/rust/comments/zgkuq6/ ChatGPT is sensitive to how you prompt it, and it's designed to work as a dialogue where you ask further questions and it can refine its answer. It can already write reasonable working code, although you shouldn't expect it to spit out entire working programs when the prompt is Gimme Teh C…
Not just that: for an average programmer the compiler will optimize the code much better than if it was done by hand. Something similar can happen down the lane.
Re: Ask HN: Can ChatGPT generate fully functional code?
#28Re: Ask HN: Can ChatGPT generate fully functional code?
#29Re: Ask HN: Can ChatGPT generate fully functional code?
#30It's kinda crazy how fast my opinion went from "haha neat, the robot can write poems" to "this is an invaluable tool and I am begging you to let me pay for stable access". I use it multiple times per day, it's easily saved me hours already.