21 ms·
GitHub Copilot Labs
- qbasic_forever 5y agoNeat! The explain feature is exactly what I had hoped to see built: https://news.ycombinator.com/item?id=27813639 https://news.ycombinator.com/item?id=27813639
- napalmall 5y agoThis is impressive. Is it still beta and invite only?
- penjelly 5y agoedit: i am wrong, its still beta/waitlist for copilot. copilot? i believe its open to anyone now. this feature? its a nightly build according to the post.
- spullara 5y agoIs this the same backend that is powering https://denigma.app https://denigma.app ?
- mdaniel 5y agoAlmost certainly not --- That was also the first time I had heard of denigma.app and their tagline of We stress-tested it on the worst, most obscure code we could find. That's why we're confident it will work on your complex codebase. gave me a good chuckle since just trivially modifying their example ... sort of worked Given: RUN apt-get update && exit 1 && apt-get install -y libnss3 libgtk-3-0 libx11-xcb1 libxss1 libasound2 It produced: - Next, apt-get is used to update the system and exit 1 is used to stop any further commands from running. - Then libnss3, libgtk-3-0, libx11-xcb1, libxss1, and libasound2 are installed using apt-get. For good fun, I tried another small edit RUN exit 1 && apt-get update && apt-get install -y libnss3 libgtk-3-0 libx11-xcb1 libxss1 libasound2 With an even better explanation: - The code then runs an exit command and uses apt-get to update its package list before installing libnss3, libgtk-3-0, libx11-xcb1, libxss1, and asound2.
- CyberShadow 5y agoI think having it produce good output on nonsensical / obviously wrong code would be a very different target than explaining commonly found code, so your expectation is a little unreasonable at this point.
- mdaniel 5y agoWell, they're the ones that said "worst" and "most obscure," that wasn't me paraphrasing But my heartburn is the intersection of these two bullet points: "and exit 1 is used to stop any further commands from running", followed by _any other claim_ > obviously wrong code Based on my experience with code reviews, I'd bet $5 I could put (or leave) "&& exit 1 &&" in the middle of a sea of RUN commands and it'd go unnoticed. So I guess it depends on who the target audience is for both this and the absolutely laughable Labs output: people who don't want to read what an if statement does, or people looking for the _meaning_ of the code?
- Aeolun 5y agoI think the explanation is just as correct as the code. Garbage in -> garbage out
- codeenlightener 5y agoDenigma works very poorly on short code– especially single lines. It warns you. It is designed for explaining real-world code in context, and performs poorly on esoteric examples.
- mdaniel 5y agoIn case it wasn't clear, I modified your DevOps example, so it's not like that code came out of left-field or was hand-crafted to trip you up. If you want to say "it is not good at reasoning about shell, instead focusing on programming languages" that'd be a much more plausible concession Since you're hanging out here, what is the explanation for how it can say "exit 1 is used to stop any further commands from running." and then carry on? It's even more bizarre that it (seems to?) understands what "exit 1" does, but only when it is not the first command in the sequence?
- penjelly 5y agohaving used copilot for only a couple hours and found it annoying... this might be a but less obstructive. though contrary to the commenter the samples in that thread didnt seem all that great to me. ill try it out tho and since its in the sidebar itll hopefully be less distracting.
- penjelly 5y agoquick test is actually a bit impressive.
- minimaxir 5y agoI made the first comment on that issue: tbh it does work better than expected on intentionally bad code, but not perfect. It could be useful to speed up documentation though.
- lucasmullens 5y agoWhat's the use-case for this? Hopefully not for commenting code. This only seems to be able to explain syntax, which seems pretty useless for anyone who isn't new to the language they're using. Am I missing something?
- jorams 5y agoI'm wondering the same thing. There is one example in the discussion where explaining syntax seems useful, a regular expression. There's a bunch of existing solutions for that, and the explanation generated by Copilot is wrong.
- IanCal 5y agoIt's a pretty straightforward, understandable task - which then leads you towards making your own tweaks to it / writing something new. It may also just be an interesting attempt at something that could be great depending on how well it worked - it's an experiment. A general "explain to me what this code does" that was as good as a human explaining overall what is going on could be very useful in more complicated parts of a codebase. My final thought is that being new to a language and needing to dig around in a codebase is something I do quite a lot and so it could be useful even if it's quite basic.
- paxys 5y agoThe use case is exactly what is stated on the box. You select a bit of code in a language/syntax that may be unfamiliar to you, and it tries to explain it better in English.
- ffhhj 5y agoI should try it with decompiled APKs in Smali.
- yosito 5y agoThe point of code comments isn't to explain what the code does, unless you're writing a tutorial. The point is usually to explain the intention of the author. If a person knows the language, they don't need an explanation of what the code does.
- armchairhacker 5y agowhen i first used copilot i thought it wasn’t very useful. But as i’ve used it more i realize it helps a lot. A surprising amount of code is just boilerplate, e.g. a single if-statement is 3 lines but you’re not going to abstract all your if statements, so you write similar if statements over and over again. It especially helps when i’m programming in a language or library i’m not familiar with, because i don’t quite understand the syntax but copilot does.
- IanCal 5y agoI've found the same. Particularly coming in nicely when I add some kind of parsing in and out of a data structure and it auto fills in all the parameters.
- jimmaswell 5y agoI've been finding it amazingly useful from the outset. It's like it reads my mind generating whole correct functions just from a small comment or example, and it's great at extrapolating repetitive increments/transformations. Write a small comment telling it what you want and it's uncanny what it can spit out.
- unbanned 5y agoWhat exactly are you asking it to do?
- mrtranscendence 5y agoI've had the opposite experience so far, though I've admittedly not used it that much yet. I've got this Python fiscal date library at work, and I wanted to add a something like a `strtftime()` method which would replace $P with the period, $Q with the quarter, etc, but treat $$ as a literal $ (so that e.g. $$P would result in $P). Simple enough, but I thought it would be cute to see if I could get copilot to do it for me. I spent at least a half hour trying to figure out what kind of prompt would result in a correct implementation. No matter how explicit I was it kept giving answers that failed to handle the $$P -> $P conversion correctly. Finally I was able to get it to spit out an answer that at least had the right idea, but it had an unrelated bug in it. The package also has some functions to determine holidays, and I was impressed that Copilot could generate code for new holidays that mimicked my style, docstrings and all. But disappointingly it failed for any slightly obscure holiday (say, Eid al-Fitr), generating code that was just wrong, even when I hinted that it would have to use an alternative calendar library. It kept trying to use the Hebrew calendar for Islamic and Hindu holidays, I guess because I'd already imported it for Hanukkah. It also seems useless for Spark ETL, having to be handheld to a degree that it would be easier just to write the code myself. My first attempt to play around with Copilot was to see if it could do a salted join (no luck, unless by "salted join" I meant something like "a join on a column called salt"). I'll keep playing around with it, maybe it's just a "me" problem.
- er4hn 5y agoOh wonderful. Can I finally have something to explain non trivial Nix expressions to me? Love the ideas behind Nix, loathe the syntax.
- acapybara 5y agoMost (all?) of the commenters here seemed to miss the entire point of this feature: "Create custom prompts We provide a few preset prompts to get you started: three that explain what a particular block of code does, and another that generates example code for calling a function. You can customize the prompt and stop sequence of a query in order to come up with new applications that use Codex to interpret code. Creating these can feel like more of an art than a science! Small changes in the formulation of the prompt and stop sequence can produce very different results. The three different “explain” examples showcase strategies that tend to produce useful responses from the model, but this is uncharted territory! We’re excited to see what you use this for." This isn't for explaining code. That's just an example. This lets us create custom prompts for the OpenAI API using the codex model.
- codeenlightener 5y agoHello! I'm the founder of https://denigma.app https://denigma.app, an AI that explains code. It's available now, with a free demo and VS Code extension, with an Emacs extension coming soon. Denigma is a product that has been around for a while. Denigma goes beyond a literal line by line explanation, and explains of programming concepts and deduces the business logic and goal of code. I'm excited to see innovation in the field. Here's a sample explanation from Denigma: The code starts by initializing the trampoline. Then it checks to see if there is a passed_info structure in memory, and if so, copies the struct into the passed_info variable. Next, it sets up some variables for use later on: - info_struct - The smp_information struct that will be used throughout this function - longmode - Indicates whether or not we are running in 64 bit mode - lv5 - Indicates whether or not we are running with L1V5 support enabled (if you're unsure what this means google "Intel VT-x" and "L1D cache") - pagemap - The address of our page table entry array (this is where all of our virtual addresses go) - x2apic - Indicates whether or not we are using an Intel X2APIC controller The code is a function that is called when the kernel is booted. The function checks to see if the kernel was booted in long mode or not, and if it was, it sets up a trampoline to call the original kernel. We're small, privacy-focused, and bootstrapped, and don't have the marketing budget of GitHub, so we'd appreciate you talking about Denigma in your communities.
- veb 5y agoGood on you for editing your comment. I was about to say you probably shouldn't say that :-) I just checked out Denigma, and it's quite wonderful actually. I may give it a try - the pricing is pretty good, less than a cup of coffee where I'm at. Nice job.
- codeenlightener 5y agoI encourage everyone to try it on real-world (non-esoteric, non-homework) code from production. That's where it works best. :-)
- veb 5y agoI actually did! It worked a lot better than GitHub's Lab.
- aasasd 5y agoKinda offtopic, I wonder how's the life of code reviewers and freelancers' clients now with the existence of Copilot.
- amasad 5y agoWe've had Code Explanation (based on Codex)[1] in production for over a month and while it leaves a lot to be desired it was surprising that 75% of users thought the explanation were useful to them. [1]: https://blog.replit.com/codex https://blog.replit.com/codex
- andreisbc 5y agoI've been using Copilot for 3 weeks in a typical web project: typescript, react, css. Feedback: - when i declare a variable or function using a suggestive name, it correctly autocompletes what i want 50% of the time and it also takes into account the context; sometimes it just blows my mind how accurate it can be. - sometimes it doesn't autocomplete even if i delete the line to start over - i changed the way i code: i rely on Copilot more and more. i start typing my code and i know the prompt will correctly autocomplete my intention, but if it doesn't, it will a couple of lines later. If i stop to think, it goes ahead of me - it's now faster for me to get an answer from Copilot than searching on Stackoverlow. Copilot is a great companion, please make it even better! Welcome to the future my friends
- superasn 5y agoYes I love it too. It takes about 2-3 seconds to generate the suggestions so even when I know what I'm going to type next I just wait for it to do it for me since I know there is a high chance that it will get it correctly (I'm talking 5 to 6 lines of code). Plus it acts as a reinforcing feedback that what I want to write is indeed correct. It is definitely the future and it's here to stay and get better with time. I'm super excited!
- snypox 5y agoThe most insane is that it even autocompletes comments. It’s honestly scary sometimes.
- switch007 5y agoWhat kind of comment is the result? More “what” or more “why”?
- phamilton 5y agoStuff like "This is " becomes "This is only temporary until we get more data". Which sometimes is exactly what you wanted to say...
- muthuraj57 5y ago
- mellosouls 5y agoI'm a fan of CoPilot, but as given in their own example here (and gently mocked in the top response), the "explanations" generated seem to be no more useful than archetypal bad comments that are normally given as examples of how not to comment code in that they simply translate the statements "word-for-token" without explanation or insight. Nevertheless, given Copilot's success so far, hopefully the output will quickly improve.
- phamilton 5y agoMy favorite copilot moment recently is rails migrations. I write the up migrating n, copilot gets the down migration right 90% of the time. It's wild. And these aren't vanilla "change" commands. It's triggers and check constraints and changing column types and stuff.
- pqdbr 5y agoNot using Copilot yet, would appreciate if you could provide some real examples on what you typed and what copilot suggested.
- phamilton 5y agoWhen I type: def up execute <<-SQL alter table users add constraint active_users_must_have_email check active = false OR email is not null NOT VALID SQL i.e. I am adding a check constraint but making it NOT VALID so it won't lock the table while scanning If I continue and write execute <<-SQL a then it completes it with alter table users And then the next line I type v and it completes it with validate constraint active_users_must_have_email SQL I then type end and it suggests: def down execute <<-SQL ALTER TABLE users DROP CONSTRAINT IF EXISTS constraint active_users_must_have_email; SQL end Which is exactly what I needed. What impresses me is that a) it recognized that a NOT VALID index needs to be VALIDATEd and b) it figured out what the down migration was.
- baby 5y agoI’m currently working on a custom, state of the art zero-knowledge proof smart contract framework, and as I’m writing circuits using it Copilot correctly suggests an insane number of lines to me. It feels like I’m cheating.
- vermilingua 5y agoPerhaps your framework is not as state-of-the-art as you believe?
- robbedpeter 5y agoWhy is it so difficult to conceive that what these models produce is novel, and capable of high level technical and semantic correctness? Transformer models aren't auto-complete engines. They're semantic graphs describing the probabilities of token positions within a sequence of a few thousand tokens. They go deep, with a nuanced and hierarchical representation of concepts. The representation is functional, conditionally altering the behavior of tokens within its sequence context. Because of the hierarchical nature of the internal rules, when the model "learns" things, it extracts meta-patterns from the training data, and can chain a seemingly arbitrary number of such rules together to produce an output. Auto-complete systems generally fail at the first level of abstraction. If transformers have sufficient vocabulary size and high quality data, they're capable of learning any degree of abstractions represented within the training corpus. They're not magic, or intelligent like human brains, but they're allowing programmers to model very complex systems and produce novel material. This ranges from constructed languages to the rules of programming to storytelling and poetry to protein sequencing and more. You should be in awe of gpt-3, or at the very least, far less dismissive. It represents a quantum leap in the power of software, and we're barely scratching the surface of what's possible. Recurrence and episodal memory, along with Moore's law and/or a substantial decrease in the size of the models, could be the thing that achieves human level agi that lives on consumer grade devices.
- baby 5y agoI’ll take the bait. What makes you say that?
- visarga 5y agoTried Copilot and gave up on it, it was only helping out where it didn't matter, the rare trivial parts. After a few mistakes I concluded it was dragging me down. Maybe I'm a hard customer for it even though I work in ML and have been following closely ever since it started.
- ricwo 5y agoHello! I'm one of the founders of https://cogram.com https://cogram.com, a coding assistant for data scientists and ML practitioners. Cogram brings Copilot-like features to Jupyter Notebook. You can use Cogram by writing ordinary code (and Cogram will complete it), or by writing comments (in which case Cogram completes the code that matches the comment). We've also launched a web app that generates SQL statements from descriptions in simple language. We're just starting out and would love it if you could try it out, give feedback, and spread the word if you like. It doesn't cost anything -- we have a generous free tier (1000 completions / month).
- eltercero 5y agoI've been using Copilot these past days and it's kind of mindblowing. I was doing some Rails tests, and after writing the factories it suggested me the exact right expectations. Did not expect that, kind of scary. Same for suggesting while commenting code. Wtf. I'd love to keep using it, but I'm way too familiarized with Sublime Text to change now (and I tried to customize VsCode). I know it's a long shot, but it'd be great if they release an extension for Sublime.