Live data from Hacker News

Ask HN: Can ChatGPT generate fully functional code?

news.ycombinator.com

21–30 of 69 posts

Re: Ask HN: Can ChatGPT generate fully functional code?

#21
post #18
post #16

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.

Yup, free will always help your popularity.

Re: Ask HN: Can ChatGPT generate fully functional code?

#22

Try 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…

Yes! The calculator worked and I agree with you that in most of my prompts when I have requested to give elaborated answers, it doesn't give appropriate results.

Re: Ask HN: Can ChatGPT generate fully functional code?

#23
I'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.

Re: Ask HN: Can ChatGPT generate fully functional code?

#25

I'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.

You can ask for a simple example of a CRUD app, here's my code output:

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?

#27
post #5

Someone 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…

> You give up a little more control, but you save time.

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?

#30
If you know roughly what you want and just don't want to dig through documentation to find the exact correct incantation, it's very good at that.

It'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.

Post reply on HN