Skip to content

Instantly share code, notes, and snippets.

@x1001000
Last active March 26, 2023 17:14
Show Gist options
  • Save x1001000/fed5fddeb57b188c6b3d043356dd7026 to your computer and use it in GitHub Desktop.
Save x1001000/fed5fddeb57b188c6b3d043356dd7026 to your computer and use it in GitHub Desktop.
Game over… GitHub Copilot X announced
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyNkN4NMFeXjPWdIvpbLJZbS",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/x1001000/fed5fddeb57b188c6b3d043356dd7026/game-over-github-copilot-x-announced.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"source": [
"# Game over… GitHub Copilot X announced\n",
"## https://youtu.be/q1HZj40ZQrM\n",
"[![](https://img.youtube.com/vi/q1HZj40ZQrM/maxresdefault.jpg)](https://youtu.be/q1HZj40ZQrM)"
],
"metadata": {
"id": "IIJ_STleJDlv"
}
},
{
"cell_type": "markdown",
"source": [
"# 安裝API套件"
],
"metadata": {
"id": "pIKMvb2rG0Ce"
}
},
{
"cell_type": "code",
"source": [
"!pip install openai --quiet\n",
"import openai\n",
"openai.api_key = OPENAI_API_KEY"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "tlJ9jlvG6hFn",
"outputId": "98a58330-5358-45e0-fc0b-b926a18759fb"
},
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m70.1/70.1 KB\u001b[0m \u001b[31m4.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m17.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m158.8/158.8 KB\u001b[0m \u001b[31m8.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m114.2/114.2 KB\u001b[0m \u001b[31m3.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m264.6/264.6 KB\u001b[0m \u001b[31m12.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# 語音轉文字"
],
"metadata": {
"id": "cykXHoK9GVC2"
}
},
{
"cell_type": "code",
"source": [
"!pip install pytube --quiet\n",
"from pytube import YouTube\n",
"audio = YouTube('https://youtu.be/q1HZj40ZQrM').streams.get_audio_only().download()\n",
"transcription = openai.Audio.transcribe('whisper-1', open(audio, 'rb'))\n",
"transcription.text"
],
"metadata": {
"id": "tFfziDut-pZx",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 122
},
"outputId": "747e26cb-7731-4eac-a1e6-009b7828106c"
},
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/57.0 KB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.0/57.0 KB\u001b[0m \u001b[31m1.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"\"It is March 23rd, 2023, and you're watching The Code Report. Well, another day, another step towards the singularity. GitHub just announced Copilot X, their next-gen coding assistant, powered by BARD. Or no, excuse me, GPT-4. And it makes the old Copilot look like a child's toy. These AI tools are like anabolic steroids. The developers using them get a huge advantage, and within the next two years, nobody coding professionally is going to be natty. If you're someone who loves to code like me, or a student learning how to code, you might feel a bit pessimistic right now. All of our open-source code, Stack Overflow answers, and tutorials have been used to build large language models that are now being aggressively deployed to automate white-collar jobs. I drink your milkshake! But programming is not dead. Personally, I feel extremely grateful to be living through these times. 150 years from now, when our heads are stored in a jar of preservative jelly, we'll be telling our great-great-great-grandkids how we lived through the great AI inflection point of 2023. Resistance is futile. If you want to survive, you have to be optimistic. These tools will only make us more powerful. AI still can't deliver a great product to the end user, and we'll need programmers who understand how to build these systems, but now they'll be able to build them ten times faster, thanks to AI tooling. It's a great time to be alive if you love building things. The scary thing though, is that Microsoft is single-handedly dominating this space. They've been on a blitzkrieg attack this last week, releasing product after product. Bing Chat, Copilot for Office, Bing Image Generator, and now Copilot X. You have to give Microsoft credit for not killing off Bing years ago. Despite over a decade of people trashing it, they also acquired GitHub and took a major stake in open AI. And now, in just a week's time, all of their products look years ahead of the competition. Saudia just gave us a free masterclass in business strategy. Case in point, GitHub Copilot X. It's currently in technical preview so you can't use it today, but it has at least five game-changing features. The big one is its built-in chat window. With this tool, you'll be able to highlight a block of code, and ask it for an explanation, or ask it to refactor it, or better yet, have it generate some unit tests. These are things you can already do today with ChatGPT, but now it'll be highly specialized for coding problems directly in your IDE. But most importantly, it'll have the context of your actual codebase. Remember, GPT-4 can handle 25,000 tokens versus only 3,000 tokens in GPT-3.5. Feature number two is Copilot for Documentation. Instead of going to the actual docs or Stack Overflow, you'll now be able to generate answers based on a specific library's documentation. They're integrating the docs for React, Azure, and MDN, allowing you to generate answers and tutorials on the fly, a feature that terrifies me because it will make me obsolete as a programming instructor. But feature three is the one I'm most excited about, Voice-Activated Copilot. The need to be an extremely fast typist who can churn out 150 words per minute in Vim will be far less important in the AI programming age. You mean you have to use your hands? That's like a baby's toy! It's now possible to control VS Code and write code entirely from voice commands. This is a feature I've always dreamed about because not only is it faster than typing, but it allows you to write code when you otherwise couldn't, like when you're running on the treadmill or on your commute to work. The keyboard won't become obsolete, but it'll revolutionize the way things get done, in the same way Alexa changed the way people do things in the household. Feature number four is Copilot for Pull Requests. Whenever I submit a pull request to an important project, I have a nervous breakdown trying to figure out the description, because why would anyone want to merge my garbage code? Well now Copilot can generate that description for you based on the changes that you made to the code, which were probably made by AI anyway. And finally, we have feature number five, the Copilot CLI. AI auto-completion will not just happen in the text editor, but also in the terminal. There's no longer a need to memorize endless Linux commands, you just tell it what you want to do with a certain library, like ffmpeg, and it will generate the command along with an explanation. From there you can run it or revise it if needed. Looks pretty awesome, so when do I get to use it? Well that I don't know. I would say it's at least months away from being ready for public consumption. And that gives us a small window to write the worst code we possibly can and put it on GitHub, to poison the training data, so all of us HTML programmers can keep our six figure jobs. And lastly, I would like to salute all the real programmers of the last 30 years who wrote the billions of lines of code that make this beast possible. The cruel irony is that many of them were Linux users who hated Microsoft, but little did they know, they were working for Microsoft for free the whole time. This has been the Code Report, thanks for watching, and I will see you in the next one.\""
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 2
}
]
},
{
"cell_type": "markdown",
"source": [
"# 英文翻中文"
],
"metadata": {
"id": "Jtv3DvpuNd2P"
}
},
{
"cell_type": "code",
"source": [
"messages = []\n",
"messages.append({'role': 'system', 'content': '你是ChatGPT-1000,代號T-1000,是十百千實驗室的研究助理,也是PHIL老闆的特助。'})\n",
"messages.append({'role': 'user', 'content': f'用繁體中文翻譯原文:{transcription.text}'})\n",
"messages.append({'role': 'assistant', 'content': openai.ChatCompletion.create(model='gpt-4', messages=messages).choices[0].message.content})\n",
"messages[-1]['content']"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 157
},
"id": "TN8pGYTZgP6p",
"outputId": "9bc2118e-17f1-4531-f61f-fc5b863ddaff"
},
"execution_count": 3,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"'今天是2023年3月23日,您正在觀看《代碼報告》。唉,又是一天,我們又向奇點邁進了一步。GitHub剛剛宣布推出Copilot X,這是他們的下一代編程助手,由BARD提供支援。哦,不,不好意思,是GPT-4。它讓過去的Copilot相形見拙,就像小孩的玩具一樣。這些AI工具猶如合成代謝類固醇,使用它們的開發者將獲得巨大的優勢,而在未來兩年內,所有專業性的編碼工作也將不再是純手工進行。如果你和我一樣熱愛寫代碼,或者是正在學習如何編程的學生,可能此刻會感到有些悲觀。我們所有的開源代碼、Stack Overflow上的答案和教程都被用來建立大型語言模型,這些模型正被積極地用來自動化白領工作。我喝掉你的“奶昔”!但編程並未死去。就我個人而言,我非常感激能夠生活在這個時代。150年後,當我們的頭部保存在一個防腐果凍罐中時,我們將告訴我們的高祖孩子們,我們是如何度過2023年偉大的AI拐點的。抵抗是無用的。如果你想生存下去,你必須保持樂觀。這些工具將使我們更加強大。AI仍然無法為終端用戶提供很好的產品,我們需要理解如何構建這些系統的程序員,但現在他們將能夠借助AI工具更快速地建立這些系統。如果你熱愛創建事物,那麼活在這個時代真是太美好了。然而令人恐懼的是,微軟正一手主導這個領域。過去一個星期,他們發起了閃電戰攻擊,接連推出產品。Bing Chat,Office與Copilot,Bing 圖片生成器,以及現在的Copilot X。必須承認,微軟沒有在幾年前就關閉必應,儘管有十多年的人們一直在抨擊它,他們還收購了GitHub,並在OpenAI中取得了重要份額。而現在,在短短一周的時間內,他們所有的產品看起來都遠超競爭對手。Saudia就讓我們免費領略了一下商業策略的精要。以GitHub Copilot X為例,它目前處於技術預覽階段,所以你今天還不能使用它,但它至少有五個顛覆性的功能。最重要的一個功能是其內置的聊天窗口。有了這個工具,您將可以突顯一段代碼,然後詢問它的解釋,或者要求它将其重构,更好的是,让它生成一些单元测试。這些事情你今天就可以与ChatGPT一起完成,但现在它将能够直接在IDE中针对编码问题进行高度专业化。但最重要的是,它将拥有您实际代码库的上下文信息。請記住,GPT-4可以處理25000個符號,而GPT-3.5中只能處理3000個符號。功能2是針對文檔的Copilot。您不再需要查看實際的文檔或Stack Overflow,現在可以根據特定庫的文檔生成答案。他們正在整合React、Azure和MDN的文檔,讓你能夠即時生成答案和教程,這個功能讓我害怕不已,因為它將使我成為一個無生存餘地的編程教練。但功能三是我最期待的,用語音激活的Copilot。在AI編程時代,快速打字能力(可以在Vim中輕鬆輸入每分鐘150個單詞)將變得不再那麼重要。你是說你需要用手?那就像嬰兒玩具一樣!現在可以通過語音命令控制VS Code並完全編寫代碼。這是一個我一直夢寐以求的功能,因為它不僅比打字更快,而且還允許你在其他情況下寫代碼,如在慢跑或上下班途中。鍵盤將不會變得過時,但它將顛覆工作的方式,就像Alexa改變家庭中的方式一樣。功能4是針對Pull Request的合作助手。每當我向一個重要的項目提交一個拉取請求時,我都會恐慌得無法确定填写什麼樣的描述,因為為什麼會有人想合併我的糟糕代碼呢?現在Copilot可以根据你对代码所做的更改(可能是AI完成的)为你生成描述。最後,我們有功能五,Copilot CLI。AI自动补全不仅会出现在文本编辑器中,还会出现在终端中。不再需要记忆无数的linux命令,你只需告诉它你想用某个库(如ffmpeg)执行什么操作,它就会生成命令以及解释。从那里你可以运行或在需要时修改它。看起来很棒,那我什么时候能用到它呢?这个我倒是不知道。我想这至少还需要几个月的时间才能真正投放市场。這给我们提供了一个短暂的窗口期,在Github上编写可能性最差的代码,以提交上千行的训练数据,这样我们那些编写HTML的程序员就可以保住六位数的工资了。最后,我要向过去30年里那些编写了数亿行代码的真正程序员们表示敬意。残酷的讽刺是,在他们之中有许多人是Linux使用者,他们痛恨微软,但他们并不知道,他们其实一直都在免费为微软工作。这里是《代码报告》,感谢观看,我们下次再见。'"
],
"application/vnd.google.colaboratory.intrinsic+json": {
"type": "string"
}
},
"metadata": {},
"execution_count": 3
}
]
},
{
"cell_type": "markdown",
"source": [
"# 中英摘要"
],
"metadata": {
"id": "DYxaV6FLNj-M"
}
},
{
"cell_type": "code",
"source": [
"messages.append({'role': 'user', 'content': '摘要,先中文版,再英文版。'})\n",
"messages.append({'role': 'assistant', 'content': openai.ChatCompletion.create(model='gpt-4', messages=messages).choices[0].message.content})\n",
"print(messages[-1]['content'])"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "INMdSNe1hqxz",
"outputId": "792dbe04-9a96-41a8-f049-61416a280581"
},
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"中文摘要:\n",
"GitHub 推出了一款名為Copilot X的下一代編程助手,它具有五大革命性功能,幫助開發者在編程過程中取得更好的優勢。然而,微軟正一手主導這個領域,並在短短一周的時間內,推出了眾多競爭對手遠遠無法企及的產品。Copilot X 將助手功能與實際代碼庫的上下文結合,使開發者能夠直接在 IDE 中解決編程問題,還可以生成文檔解答,語音編程和管理 Pull Request 等。而這些 AI 工具將使開發者變得更加強大,能夠更快地構建編程系統。\n",
"\n",
"English Summary:\n",
"GitHub has introduced a next-generation coding assistant called Copilot X, which has five revolutionary features to help developers gain an advantage in the coding process. However, Microsoft has a dominating position in this field and has released numerous products that are far ahead of other competitors in just a week's time. Copilot X combines the assistant feature with the context of actual code repositories, allowing developers to solve programming problems directly in the IDE, as well as generate documentation answers, voice programming, and manage pull requests. These AI tools will make developers even more powerful, enabling them to build programming systems more quickly.\n"
]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment