{"id":3757,"date":"2022-03-15T19:40:29","date_gmt":"2022-03-15T19:40:29","guid":{"rendered":"https:\/\/billsbud.org\/?p=3757"},"modified":"2022-03-15T19:40:29","modified_gmt":"2022-03-15T19:40:29","slug":"new-gpt-3-capabilities-edit-insert","status":"publish","type":"post","link":"https:\/\/billsbud.org\/?p=3757","title":{"rendered":"New GPT-3 Capabilities: Edit &#038; Insert"},"content":{"rendered":"<p><!--kg-card-begin: markdown--><\/p>\n<div class=\"js-excerpt\">\n<img decoding=\"async\" src=\"https:\/\/openai.com\/content\/images\/2022\/03\/fib-social.png\" alt=\"New GPT-3 Capabilities: Edit &amp; Insert\"><\/p>\n<p>We&#x2019;ve released new versions of <a href=\"https:\/\/beta.openai.com\/docs\/engines\/gpt-3\">GPT-3<\/a> and <a href=\"https:\/\/beta.openai.com\/docs\/engines\/codex-series-private-beta\">Codex<\/a> which can edit or insert content into existing text, rather than just completing existing text. These new capabilities make it practical to use the <a href=\"https:\/\/beta.openai.com\/\">OpenAI API<\/a> to revise existing content, such as rewriting a paragraph of text or refactoring code. This unlocks new use cases and improves existing ones; for example, insertion is already being piloted in <a href=\"https:\/\/copilot.github.com\/\">GitHub Copilot<\/a> with promising early results.<\/p>\n<\/div>\n<section class=\"btns\">\n  <a href=\"https:\/\/beta.openai.com\/docs\/api-reference\/edits\" class=\"btn btn-ypadded pl-0.125 d-block icon-papers\">Read Edit Documentation<\/a><\/p>\n<hr class=\"my-0\">\n  <a href=\"https:\/\/beta.openai.com\/docs\/guides\/completion\/inserting-text\" class=\"btn btn-ypadded pl-0.125 d-block icon-papers\">Read Insert Documentation<\/a><\/p>\n<hr class=\"my-0\">\n  <a href=\"https:\/\/beta.openai.com\/playground\" class=\"btn btn-ypadded pl-0.125 d-block icon-external\">Try in Playground<\/a><br \/>\n<\/section>\n<div class=\"full bg-fg-3 py-1.5 my-2\">\n<div class=\"container\">\n<div class=\"row\">\n<div class=\"content\">\n<div class=\"demo js-demo\" data-active=\"0\" id=\"hero\">\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-insert medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code>def<span class=\"insert\">___<\/span>\n<br>fib(10)<\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"2000\">\n<div class=\"inst-insert medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code>def<span class=\"insert\"> fib(n):\n    if n <= 1 1: return fib(n-1) + fib(n-2) < span><br>fib(10)<\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code><span class=\"edit\">def fib(n):\n    if n <= 1 1: return fib(n-1) + fib(n-2) < span><br>fib(10)<\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Improve<\/div>\n<pre><code><span class=\"edit\">def fib(n):\n    if n <= 1 1: return fib(n-1) + fib(n-2) < span><br>fib(10)<\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Improve the<\/div>\n<pre><code><span class=\"edit\">def fib(n):\n    if n <= 1 1: return fib(n-1) + fib(n-2) < span><br>fib(10)<\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Improve the runtime<\/div>\n<pre><code><span class=\"edit\">def fib(n):\n    if n <= 1 1: return fib(n-1) + fib(n-2) < span><br>fib(10)<\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Improve the runtime complexity<\/div>\n<pre><code><span class=\"edit\">def fib(n):\n    if n <= 1 1: return fib(n-1) + fib(n-2) < span><br>fib(10)<\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Improve the runtime complexity of the<\/div>\n<pre><code><span class=\"edit\">def fib(n):\n    if n <= 1 1: return fib(n-1) + fib(n-2) < span><br>fib(10)<\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Improve the runtime complexity of the function<\/div>\n<pre><code><span class=\"edit\">def fib(n):\n    if n <= 1 1: return fib(n-1) + fib(n-2) < span><br>fib(10)<\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"2000\">\n<div class=\"inst-edit inst-comp medium-small-copy font-italic mb-2\/3\">Improve the runtime complexity of the function<\/div>\n<pre><code>def fib(n, memo={}):\n    if n in memo:\n        return memo[n]\n    if n <= 1: f=\"1\" else: memo) + fib(n-2, memo[n]=\"f\" return f< code><\/=><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code><span class=\"edit\">def fib(n, memo={}):\n    if n in memo:\n        return memo[n]\n    if n <= 1: f=\"1\" else: memo) + fib(n-2, memo[n]=\"f\" return f< span><\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Translate<\/div>\n<pre><code><span class=\"edit\">def fib(n, memo={}):\n    if n in memo:\n        return memo[n]\n    if n <= 1: f=\"1\" else: memo) + fib(n-2, memo[n]=\"f\" return f< span><\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Translate to<\/div>\n<pre><code><span class=\"edit\">def fib(n, memo={}):\n    if n in memo:\n        return memo[n]\n    if n <= 1: f=\"1\" else: memo) + fib(n-2, memo[n]=\"f\" return f< span><\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Translate to JavaScript<\/div>\n<pre><code><span class=\"edit\">def fib(n, memo={}):\n    if n in memo:\n        return memo[n]\n    if n <= 1: f=\"1\" else: memo) + fib(n-2, memo[n]=\"f\" return f< span><\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item demo-item-sizer\" data-t=\"2000\">\n<div class=\"inst-edit inst-comp medium-small-copy font-italic mb-2\/3\">Translate to JavaScript<\/div>\n<pre><code>function fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        if (n in memo) return memo[n];\n        var f;\n        if (n <= 1) f=\"1;\" else memo) + fib(n-2, memo); memo[n]=\"f;\" return f; })(n, }< code><\/=><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code><span class=\"edit\">function fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        if (n in memo) return memo[n];\n        var f;\n        if (n <= 1) f=\"1;\" else memo) + fib(n-2, memo); memo[n]=\"f;\" return f; })(n, }< code><\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Write<\/div>\n<pre><code><span class=\"edit\">function fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        if (n in memo) return memo[n];\n        var f;\n        if (n <= 1) f=\"1;\" else memo) + fib(n-2, memo); memo[n]=\"f;\" return f; })(n, }< code><\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Write this<\/div>\n<pre><code><span class=\"edit\">function fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        if (n in memo) return memo[n];\n        var f;\n        if (n <= 1) f=\"1;\" else memo) + fib(n-2, memo); memo[n]=\"f;\" return f; })(n, }< code><\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Write this as<\/div>\n<pre><code><span class=\"edit\">function fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        if (n in memo) return memo[n];\n        var f;\n        if (n <= 1) f=\"1;\" else memo) + fib(n-2, memo); memo[n]=\"f;\" return f; })(n, }< code><\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Write this as a<\/div>\n<pre><code><span class=\"edit\">function fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        if (n in memo) return memo[n];\n        var f;\n        if (n <= 1) f=\"1;\" else memo) + fib(n-2, memo); memo[n]=\"f;\" return f; })(n, }< code><\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Write this as a one<\/div>\n<pre><code><span class=\"edit\">function fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        if (n in memo) return memo[n];\n        var f;\n        if (n <= 1) f=\"1;\" else memo) + fib(n-2, memo); memo[n]=\"f;\" return f; })(n, }< code><\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Write this as a one-liner<\/div>\n<pre><code><span class=\"edit\">function fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        if (n in memo) return memo[n];\n        var f;\n        if (n <= 1) f=\"1;\" else memo) + fib(n-2, memo); memo[n]=\"f;\" return f; })(n, }< code><\/=><\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"2000\">\n<div class=\"inst-edit inst-comp medium-small-copy font-italic mb-2\/3\">Write this as a one-liner<\/div>\n<pre><code>function fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        return n in memo ? memo[n] : (memo[n] = n <= 1 ? : fib(n-1, memo) + fib(n-2, memo)); })(n, memo); }< code><\/=><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-insert medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code><br>function fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        return n in memo ? memo[n] : (memo[n] = n <= 1 ? : fib(n-1, memo) + fib(n-2, memo)); })(n, memo); }< code><\/=><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-insert medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code>\/\nfunction fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        return n in memo ? memo[n] : (memo[n] = n <= 1 ? : fib(n-1, memo) + fib(n-2, memo)); })(n, memo); }< code><\/=><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-insert medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code>\/**\nfunction fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        return n in memo ? memo[n] : (memo[n] = n <= 1 ? : fib(n-1, memo) + fib(n-2, memo)); })(n, memo); }< code><\/=><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-insert medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code>\/**<span class=\"insert\">___<\/span>\nfunction fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        return n in memo ? memo[n] : (memo[n] = n <= 1 ? : fib(n-1, memo) + fib(n-2, memo)); })(n, memo); }< code><\/=><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"2000\">\n<div class=\"inst-insert medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code>\/**<span class=\"insert\">&#x200B;\n * Recursive Fibonacci function with memoization.\n * @param {number} n\n * @returns {number}\n *\/<\/span>\nfunction fibonacci(n) {\n    var memo = {};\n    return (function fib(n, memo) {\n        return n in memo ? memo[n] : (memo[n] = n <= 1 ? : fib(n-1, memo) + fib(n-2, memo)); })(n, memo); }< code><\/=><\/code><\/pre>\n<\/div>\n<\/div>\n<p><!-- end #hero -->\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>GPT-3 and Codex have traditionally added text to the end of existing content, based on the text that came before. Whether working with text or code, writing is more than just appending&#x2014;it&#x2019;s an iterative process where existing text is revised. GPT-3 and Codex can now edit text, changing what&#x2019;s currently there or adding text to the middle of content.<\/p>\n<h2 id=\"inserting-into-the-middle-of-text\">Inserting into the middle of text<\/h2>\n<p>The new <a href=\"https:\/\/beta.openai.com\/docs\/guides\/completion\/inserting-text\">insert<\/a> <a href=\"https:\/\/beta.openai.com\/docs\/guides\/code\/inserting-code\">capability<\/a> adds contextually relevant text in the middle of existing content. Providing future context to the model can improve the quality of completions for applications such as writing long-form text, transitioning between paragraphs, following an outline, or guiding the model toward an ending.<\/p>\n<div class=\"full bg-fg-3 py-1.5 my-2\">\n<div class=\"container\">\n<div class=\"row\">\n<div class=\"content\">\n<div class=\"demo js-demo\" data-active=\"0\" id=\"insert-text\">\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\">___<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"2000\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> Congratulations to all our high school graduates!<\/p>\n<p>We hope you enjoy your graduation ceremonies and wish you the best of luck in your future endeavors.<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> Congratulations to all our high school graduates!<\/p>\n<p>We hope you enjoy your graduation ceremonies and wish you the best of luck in your future endeavors.<\/span><\/p>\n<p>Section\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> Congratulations to all our high school graduates!<\/p>\n<p>We hope you enjoy your graduation ceremonies and wish you the best of luck in your future endeavors.<\/span><\/p>\n<p>Section 2.\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> Congratulations to all our high school graduates!<\/p>\n<p>We hope you enjoy your graduation ceremonies and wish you the best of luck in your future endeavors.<\/span><\/p>\n<p>Section 2. Moving\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> Congratulations to all our high school graduates!<\/p>\n<p>We hope you enjoy your graduation ceremonies and wish you the best of luck in your future endeavors.<\/span><\/p>\n<p>Section 2. Moving to\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> Congratulations to all our high school graduates!<\/p>\n<p>We hope you enjoy your graduation ceremonies and wish you the best of luck in your future endeavors.<\/span><\/p>\n<p>Section 2. Moving to San Francisco\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"2000\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> I&apos;m graduating from high school. I&apos;m so excited. I&apos;m going to move to San Francisco and start a new life. I can&apos;t wait to get there.<\/span><\/p>\n<p>Section 2. Moving to San Francisco\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"500\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> I&apos;m graduating from high school. I&apos;m so excited. I&apos;m going to move to San Francisco and start a new life. I can&apos;t wait to get there.<\/span><\/p>\n<p>Section 2. Moving to\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> I&apos;m graduating from high school. I&apos;m so excited. I&apos;m going to move to San Francisco and start a new life. I can&apos;t wait to get there.<\/span><\/p>\n<p>Section 2. Moving to Istanbul\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"2000\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> I&apos;m graduating from high school. I&apos;m so excited to be moving on to the next chapter of my life. I&apos;m going to Istanbul!<\/span><\/p>\n<p>Section 2. Moving to Istanbul\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"500\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> I&apos;m graduating from high school. I&apos;m so excited to be moving on to the next chapter of my life. I&apos;m going to Istanbul!<\/span><\/p>\n<p>Section 2. Moving to\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> I&apos;m graduating from high school. I&apos;m so excited to be moving on to the next chapter of my life. I&apos;m going to Istanbul!<\/span><\/p>\n<p>Section 2. Moving to the\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> I&apos;m graduating from high school. I&apos;m so excited to be moving on to the next chapter of my life. I&apos;m going to Istanbul!<\/span><\/p>\n<p>Section 2. Moving to the farm\n<\/p><\/div>\n<\/div>\n<div class=\"demo-item demo-item-sizer\" data-t=\"2000\">\n<div class=\"medium-small-copy\">\nSection 1. High school graduation<\/p>\n<p>Today&apos;s the big day!<span class=\"insert\"> My high school graduation! I&apos;m so excited! I can&apos;t wait to leave the city and move to the farm. I want to live a simple, quiet life. I want to get up in the morning, milk the cows, feed the horses, then sit and watch the sunrise. I want to spend the rest of my days traveling the world, reading and writing. I&apos;m so tired of this city life.<\/span><\/p>\n<p>Section 2. Moving to the farm\n<\/p><\/div>\n<\/div>\n<\/div>\n<p><!-- end #insert-text -->\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>In the example above, the desire is to fill-in text between two section headers of an outline. Without the context of future sections, the model generates a completion that isn&apos;t relevant to the second section. When the context of future sections are accounted for, the model generates a completion that ties the two sections together.<\/p>\n<div class=\"full bg-fg-3 py-1.5 my-2\">\n<div class=\"container\">\n<div class=\"row\">\n<div class=\"content\">\n<div class=\"demo js-demo\" data-active=\"0\" id=\"insert-code\">\n<div class=\"demo-item\" data-t=\"1000\">\n<pre><code>def get_files(path: str, size: int):\n    def<span class=\"insert\">___<\/span>\n    for (dirp, _, files) in os.walk(path):\n        yield from prune(dirp, files)<\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"2000\">\n<pre><code>def get_files(path: str, size: int):\n    def<span class=\"insert\"> prune(dirp, files):\n        for file in files:\n            file = os.path.join(dirp, file)\n            if os.path.getsize(file) &gt; size:\n                yield file<\/span>\n    for (dirp, _, files) in os.walk(path):\n        yield from prune(dirp, files)<\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"500\">\n<pre><code><br>def get_files(path: str, size: int):\n    def<span class=\"insert\"> prune(dirp, files):\n        for file in files:\n            file = os.path.join(dirp, file)\n            if os.path.getsize(file) &gt; size:\n                yield file<\/span>\n    for (dirp, _, files) in os.walk(path):\n        yield from prune(dirp, files)<\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<pre><code><span class=\"insert\">___<\/span>\ndef get_files(path: str, size: int):\n    def prune(dirp, files):\n        for file in files:\n            file = os.path.join(dirp, file)\n            if os.path.getsize(file) &gt; size:\n                yield file\n    for (dirp, _, files) in os.walk(path):\n        yield from prune(dirp, files)<\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"2000\">\n<pre><code><span class=\"insert\">import os<\/span>\ndef get_files(path: str, size: int):\n    def prune(dirp, files):\n        for file in files:\n            file = os.path.join(dirp, file)\n            if os.path.getsize(file) &gt; size:\n                yield file\n    for (dirp, _, files) in os.walk(path):\n        yield from prune(dirp, files)<\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<pre><code>import os\ndef get_files(path: str, size: int):\n    &quot;&quot;&quot;\n    def prune(dirp, files):\n        for file in files:\n            file = os.path.join(dirp, file)\n            if os.path.getsize(file) &gt; size:\n                yield file\n    for (dirp, _, files) in os.walk(path):\n        yield from prune(dirp, files)<\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<pre><code>import os\ndef get_files(path: str, size: int):\n    &quot;&quot;&quot;<span class=\"insert\">___<\/span>\n    def prune(dirp, files):\n        for file in files:\n            file = os.path.join(dirp, file)\n            if os.path.getsize(file) &gt; size:\n                yield file\n    for (dirp, _, files) in os.walk(path):\n        yield from prune(dirp, files)<\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<pre><code>import os\ndef get_files(path: str, size: int):\n    &quot;&quot;&quot;<span class=\"insert\">___<\/span>&quot;&quot;&quot;\n    def prune(dirp, files):\n        for file in files:\n            file = os.path.join(dirp, file)\n            if os.path.getsize(file) &gt; size:\n                yield file\n    for (dirp, _, files) in os.walk(path):\n        yield from prune(dirp, files)<\/code><\/pre>\n<\/div>\n<div class=\"demo-item demo-item-sizer\" data-t=\"2000\">\n<pre><code>import os\ndef get_files(path: str, size: int):\n    &quot;&quot;&quot;<span class=\"insert\">Yields files in the path tree of min size<\/span>&quot;&quot;&quot;\n    def prune(dirp, files):\n        for file in files:\n            file = os.path.join(dirp, file)\n            if os.path.getsize(file) &gt; size:\n                yield file\n    for (dirp, _, files) in os.walk(path):\n        yield from prune(dirp, files)<\/code><\/pre>\n<\/div>\n<\/div>\n<p><!-- end #insert-code -->\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Insert is particularly useful for writing code. In fact, Codex was our original motivation for developing this capability, since in software development we typically add code to the middle of an existing file where code is present before and after the completion. In the example above, the model successfully completes the missing function <code>prune<\/code>, while connecting to code already written. We also add a docstring and missing imports, which is not possible without knowing the code that comes after. In GitHub Copilot, Insert is currently being piloted with early promising results.<\/p>\n<p>The insert capability is available in the API today in beta, as part of the <a href=\"https:\/\/beta.openai.com\/docs\/guides\/completion\/introduction\">completions endpoint<\/a> and via a new interface in <a href=\"https:\/\/beta.openai.com\/playground\">Playground<\/a>. The capability can be used with the latest versions of GPT-3 and Codex, <code>text-davinci-002<\/code> and <code>code-davinci-002<\/code>. <a href=\"https:\/\/openai.com\/api\/pricing\/\">Pricing<\/a> is the same as previous versions of Davinci.<\/p>\n<h2 id=\"editing-existing-text\">Editing existing text<\/h2>\n<p>A meaningful part of writing text and code is spent editing existing content. We&#x2019;ve released a new endpoint in beta called <a href=\"https:\/\/beta.openai.com\/docs\/api-reference\/edits\">edits<\/a> that changes existing text via an instruction, instead of completing it.<\/p>\n<div class=\"full bg-fg-3 py-1.5 my-2\">\n<div class=\"container\">\n<div class=\"row\">\n<div class=\"content\">\n<div class=\"demo js-demo\" data-active=\"0\" id=\"edit-text\">\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic\">&#xA0;<\/div>\n<div class=\"medium-small-copy\">\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic\">Add<\/div>\n<div class=\"medium-small-copy\">\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic\">Add a<\/div>\n<div class=\"medium-small-copy\">\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic\">Add a short poem<\/div>\n<div class=\"medium-small-copy\">\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic\">Add a short poem about<\/div>\n<div class=\"medium-small-copy\">\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic\">Add a short poem about GPT-3<\/div>\n<div class=\"medium-small-copy\">\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"3000\">\n<div class=\"inst-edit inst-comp medium-small-copy font-italic mb-2\/3\">Add a short poem about GPT-3<\/div>\n<div class=\"medium-small-copy\">\nGPT-3 is a very nice AI<br \/>\n<br \/>That&apos;s pretty good at writing replies<br \/>\n<br \/>When it&apos;s asked a question<br \/>\n<br \/>It gives its suggestion<br \/>\n<br \/>This is a poem it made that rhymes\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">GPT-3 is a very nice AI<br \/>\n<br \/>That&apos;s pretty good at writing replies<br \/>\n<br \/>When it&apos;s asked a question<br \/>\n<br \/>It gives its suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Make<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">GPT-3 is a very nice AI<br \/>\n<br \/>That&apos;s pretty good at writing replies<br \/>\n<br \/>When it&apos;s asked a question<br \/>\n<br \/>It gives its suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Make this<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">GPT-3 is a very nice AI<br \/>\n<br \/>That&apos;s pretty good at writing replies<br \/>\n<br \/>When it&apos;s asked a question<br \/>\n<br \/>It gives its suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Make this in the<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">GPT-3 is a very nice AI<br \/>\n<br \/>That&apos;s pretty good at writing replies<br \/>\n<br \/>When it&apos;s asked a question<br \/>\n<br \/>It gives its suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Make this in the voice<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">GPT-3 is a very nice AI<br \/>\n<br \/>That&apos;s pretty good at writing replies<br \/>\n<br \/>When it&apos;s asked a question<br \/>\n<br \/>It gives its suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Make this in the voice of GPT-3<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">GPT-3 is a very nice AI<br \/>\n<br \/>That&apos;s pretty good at writing replies<br \/>\n<br \/>When it&apos;s asked a question<br \/>\n<br \/>It gives its suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"3000\">\n<div class=\"inst-edit inst-comp medium-small-copy font-italic mb-2\/3\">Make this in the voice of GPT-3<\/div>\n<div class=\"medium-small-copy\">\nI am a very nice AI<br \/>\n<br \/>I am pretty good at writing replies<br \/>\n<br \/>When I am asked a question<br \/>\n<br \/>I give my suggestion<br \/>\n<br \/>This is a poem it made that rhymes\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">I am a very nice AI<br \/>\n<br \/>I am pretty good at writing replies<br \/>\n<br \/>When I am asked a question<br \/>\n<br \/>I give my suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Format<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">I am a very nice AI<br \/>\n<br \/>I am pretty good at writing replies<br \/>\n<br \/>When I am asked a question<br \/>\n<br \/>I give my suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Format this<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">I am a very nice AI<br \/>\n<br \/>I am pretty good at writing replies<br \/>\n<br \/>When I am asked a question<br \/>\n<br \/>I give my suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Format this like a<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">I am a very nice AI<br \/>\n<br \/>I am pretty good at writing replies<br \/>\n<br \/>When I am asked a question<br \/>\n<br \/>I give my suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"500\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Format this like a letter<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">I am a very nice AI<br \/>\n<br \/>I am pretty good at writing replies<br \/>\n<br \/>When I am asked a question<br \/>\n<br \/>I give my suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Format this like a letter and sign<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">I am a very nice AI<br \/>\n<br \/>I am pretty good at writing replies<br \/>\n<br \/>When I am asked a question<br \/>\n<br \/>I give my suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item\" data-t=\"1500\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Format this like a letter and sign from GPT-3<\/div>\n<div class=\"medium-small-copy\">\n<span class=\"edit\">I am a very nice AI<br \/>\n<br \/>I am pretty good at writing replies<br \/>\n<br \/>When I am asked a question<br \/>\n<br \/>I give my suggestion<br \/>\n<br \/>This is a poem it made that rhymes<\/span>\n<\/div>\n<\/div>\n<div class=\"demo-item demo-item-sizer\" data-t=\"3500\">\n<div class=\"inst-edit inst-comp medium-small-copy font-italic mb-2\/3\">Format this like a letter and sign from GPT-3<\/div>\n<div class=\"medium-small-copy\">\nDear Human,<\/p>\n<p>I am very nice AI<br \/>\n<br \/>I am pretty good at writing replies<br \/>\n<br \/>When I am asked a question<br \/>\n<br \/>I give my suggestion<br \/>\n<br \/>This is a poem I made that rhymes<\/p>\n<p>Kind regards,<br \/>\n<br \/>GPT-3\n<\/div>\n<\/div>\n<\/div>\n<p><!-- end #edit-text -->\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Editing works by specifying existing text as a prompt and an instruction on how to modify it. The edits endpoint can be used to change the tone or structure of text, or make targeted changes like fixing spelling. We&#x2019;ve also observed edits to work well on empty prompts, thus enabling text generation similar to the <a href=\"https:\/\/beta.openai.com\/docs\/guides\/completion\/introduction\">completions endpoint<\/a>. In the example above, we use edits to (1) add a poem, (2) change the poem to be in first-person, (3) transform the poem into a letter, with the appropriate salutation and signature.<\/p>\n<div class=\"full bg-fg-3 py-1.5 my-2\">\n<div class=\"container\">\n<div class=\"row\">\n<div class=\"content\">\n<div class=\"demo js-demo\" data-active=\"0\" id=\"edit-data\">\n<div class=\"demo-item\" data-t=\"2000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code><span class=\"edit\">The three US cities with the worst traffic are:\n<br>1. Boston, MA (164 hours)\n2. Washington, DC (155 hours)\n3. Chicago, IL (138 hours)<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Convert<\/div>\n<pre><code><span class=\"edit\">The three US cities with the worst traffic are:\n<br>1. Boston, MA (164 hours)\n2. Washington, DC (155 hours)\n3. Chicago, IL (138 hours)<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Convert the list<\/div>\n<pre><code><span class=\"edit\">The three US cities with the worst traffic are:\n<br>1. Boston, MA (164 hours)\n2. Washington, DC (155 hours)\n3. Chicago, IL (138 hours)<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Convert the list to JSONL file<\/div>\n<pre><code><span class=\"edit\">The three US cities with the worst traffic are:\n<br>1. Boston, MA (164 hours)\n2. Washington, DC (155 hours)\n3. Chicago, IL (138 hours)<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Convert the list to JSONL file with rank<\/div>\n<pre><code><span class=\"edit\">The three US cities with the worst traffic are:\n<br>1. Boston, MA (164 hours)\n2. Washington, DC (155 hours)\n3. Chicago, IL (138 hours)<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Convert the list to JSONL file with rank, city<\/div>\n<pre><code><span class=\"edit\">The three US cities with the worst traffic are:\n<br>1. Boston, MA (164 hours)\n2. Washington, DC (155 hours)\n3. Chicago, IL (138 hours)<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Convert the list to JSONL file with rank, city, state<\/div>\n<pre><code><span class=\"edit\">The three US cities with the worst traffic are:\n<br>1. Boston, MA (164 hours)\n2. Washington, DC (155 hours)\n3. Chicago, IL (138 hours)<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1500\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Convert the list to JSONL file with rank, city, state, and hours<\/div>\n<pre><code><span class=\"edit\">The three US cities with the worst traffic are:\n<br>1. Boston, MA (164 hours)\n2. Washington, DC (155 hours)\n3. Chicago, IL (138 hours)<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"3000\">\n<div class=\"inst-edit inst-comp medium-small-copy font-italic mb-2\/3\">Convert the list to JSONL file with rank, city, state, and hours<\/div>\n<pre><code>[\n  {&quot;rank&quot;: 1, &quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;MA&quot;, &quot;hours&quot;: 164},\n  {&quot;rank&quot;: 2, &quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;DC&quot;, &quot;hours&quot;: 155},\n  {&quot;rank&quot;: 3, &quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;IL&quot;, &quot;hours&quot;: 138}\n]<\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code><span class=\"edit\">[\n  {&quot;rank&quot;: 1, &quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;MA&quot;, &quot;hours&quot;: 164},\n  {&quot;rank&quot;: 2, &quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;DC&quot;, &quot;hours&quot;: 155},\n  {&quot;rank&quot;: 3, &quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;IL&quot;, &quot;hours&quot;: 138}\n]<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Remove<\/div>\n<pre><code><span class=\"edit\">[\n  {&quot;rank&quot;: 1, &quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;MA&quot;, &quot;hours&quot;: 164},\n  {&quot;rank&quot;: 2, &quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;DC&quot;, &quot;hours&quot;: 155},\n  {&quot;rank&quot;: 3, &quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;IL&quot;, &quot;hours&quot;: 138}\n]<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Remove rank<\/div>\n<pre><code><span class=\"edit\">[\n  {&quot;rank&quot;: 1, &quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;MA&quot;, &quot;hours&quot;: 164},\n  {&quot;rank&quot;: 2, &quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;DC&quot;, &quot;hours&quot;: 155},\n  {&quot;rank&quot;: 3, &quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;IL&quot;, &quot;hours&quot;: 138}\n]<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Remove rank and write out<\/div>\n<pre><code><span class=\"edit\">[\n  {&quot;rank&quot;: 1, &quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;MA&quot;, &quot;hours&quot;: 164},\n  {&quot;rank&quot;: 2, &quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;DC&quot;, &quot;hours&quot;: 155},\n  {&quot;rank&quot;: 3, &quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;IL&quot;, &quot;hours&quot;: 138}\n]<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Remove rank and write out full state names<\/div>\n<pre><code><span class=\"edit\">[\n  {&quot;rank&quot;: 1, &quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;MA&quot;, &quot;hours&quot;: 164},\n  {&quot;rank&quot;: 2, &quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;DC&quot;, &quot;hours&quot;: 155},\n  {&quot;rank&quot;: 3, &quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;IL&quot;, &quot;hours&quot;: 138}\n]<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"2000\">\n<div class=\"inst-edit inst-comp medium-small-copy font-italic mb-2\/3\">Remove rank and write out full state names<\/div>\n<pre><code>[\n  {&quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;Massachusetts&quot;, &quot;hours&quot;: 164},\n  {&quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;District of Columbia&quot;, &quot;hours&quot;: 155},\n  {&quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;Illinois&quot;, &quot;hours&quot;: 138}\n]<\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">&#xA0;<\/div>\n<pre><code><span class=\"edit\">[\n  {&quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;Massachusetts&quot;, &quot;hours&quot;: 164},\n  {&quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;District of Columbia&quot;, &quot;hours&quot;: 155},\n  {&quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;Illinois&quot;, &quot;hours&quot;: 138}\n]<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Turn<\/div>\n<pre><code><span class=\"edit\">[\n  {&quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;Massachusetts&quot;, &quot;hours&quot;: 164},\n  {&quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;District of Columbia&quot;, &quot;hours&quot;: 155},\n  {&quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;Illinois&quot;, &quot;hours&quot;: 138}\n]<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Turn into YAML<\/div>\n<pre><code><span class=\"edit\">[\n  {&quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;Massachusetts&quot;, &quot;hours&quot;: 164},\n  {&quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;District of Columbia&quot;, &quot;hours&quot;: 155},\n  {&quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;Illinois&quot;, &quot;hours&quot;: 138}\n]<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Turn into YAML and return<\/div>\n<pre><code><span class=\"edit\">[\n  {&quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;Massachusetts&quot;, &quot;hours&quot;: 164},\n  {&quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;District of Columbia&quot;, &quot;hours&quot;: 155},\n  {&quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;Illinois&quot;, &quot;hours&quot;: 138}\n]<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"200\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Turn into YAML and return from a function<\/div>\n<pre><code><span class=\"edit\">[\n  {&quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;Massachusetts&quot;, &quot;hours&quot;: 164},\n  {&quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;District of Columbia&quot;, &quot;hours&quot;: 155},\n  {&quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;Illinois&quot;, &quot;hours&quot;: 138}\n]<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item\" data-t=\"1000\">\n<div class=\"inst-edit medium-small-copy font-italic mb-2\/3\">Turn into YAML and return from a function called get_yaml<\/div>\n<pre><code><span class=\"edit\">[\n  {&quot;city&quot;: &quot;Boston&quot;, &quot;state&quot;: &quot;Massachusetts&quot;, &quot;hours&quot;: 164},\n  {&quot;city&quot;: &quot;Washington DC&quot;, &quot;state&quot;: &quot;District of Columbia&quot;, &quot;hours&quot;: 155},\n  {&quot;city&quot;: &quot;Chicago&quot;, &quot;state&quot;: &quot;Illinois&quot;, &quot;hours&quot;: 138}\n]<\/span><\/code><\/pre>\n<\/div>\n<div class=\"demo-item demo-item-sizer\" data-t=\"3000\">\n<div class=\"inst-edit inst-comp medium-small-copy font-italic mb-2\/3\">Turn into YAML and return from a function called get_yaml<\/div>\n<pre><code>def get_yaml():\n    return &quot;&quot;&quot;\n    - city: Boston\n      state: Massachusetts\n      hours: 164\n    - city: Washington DC\n      state: District of Columbia\n      hours: 155\n    - city: Chicago\n      state: Illinois\n      hours: 138\n    &quot;&quot;&quot;<\/code><\/pre>\n<\/div>\n<\/div>\n<p><!-- end #edit-data -->\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>The edits endpoint is particularly useful for writing code. It works well for tasks like refactoring, adding documentation, translating between programming languages, and changing coding style. The example above starts with JSON input containing cities ranked by population. With our first edit, Codex removes the rank field from the JSON, and changes the state abbreviations into full names. The second edit converts the JSON file into YAML returned from a function.<\/p>\n<p>Editing is available as a <a href=\"https:\/\/beta.openai.com\/docs\/api-reference\/edits\">specialized endpoint in the API<\/a> and through a new interface in <a href=\"https:\/\/beta.openai.com\/playground\">Playground<\/a>. It is supported by models <code>text-davinci-edits-001<\/code> and <code>code-davinci-edits-001<\/code>. The edits endpoint is currently <a href=\"https:\/\/openai.com\/api\/pricing\/\">free to use<\/a> and publicly available as a beta.<\/p>\n<style>\n:root {\n  --color-insert: 0,222,34;\n  --color-edit: 0,183,255;\n}\n.demo {\n  position: relative;\n  user-select: none;\n}\n.demo-item pre {\n  \/* reset *\/\n  margin: 0;\n  padding: 0;\n  background-color: unset;\n  white-space: pre-wrap;\n}\n.demo-item {\n  position: absolute;\n  top: 0;\n  left: 0;\n  opacity: 0;\n  visibility: hidden;\n}\n.demo[data-active=\"0\"] .demo-item:nth-child(1),\n.demo[data-active=\"1\"] .demo-item:nth-child(2),\n.demo[data-active=\"2\"] .demo-item:nth-child(3),\n.demo[data-active=\"3\"] .demo-item:nth-child(4),\n.demo[data-active=\"4\"] .demo-item:nth-child(5),\n.demo[data-active=\"5\"] .demo-item:nth-child(6),\n.demo[data-active=\"6\"] .demo-item:nth-child(7),\n.demo[data-active=\"7\"] .demo-item:nth-child(8),\n.demo[data-active=\"8\"] .demo-item:nth-child(9),\n.demo[data-active=\"9\"] .demo-item:nth-child(10),\n.demo[data-active=\"10\"] .demo-item:nth-child(11),\n.demo[data-active=\"11\"] .demo-item:nth-child(12),\n.demo[data-active=\"12\"] .demo-item:nth-child(13),\n.demo[data-active=\"13\"] .demo-item:nth-child(14),\n.demo[data-active=\"14\"] .demo-item:nth-child(15),\n.demo[data-active=\"15\"] .demo-item:nth-child(16),\n.demo[data-active=\"16\"] .demo-item:nth-child(17),\n.demo[data-active=\"17\"] .demo-item:nth-child(18),\n.demo[data-active=\"18\"] .demo-item:nth-child(19),\n.demo[data-active=\"19\"] .demo-item:nth-child(20),\n.demo[data-active=\"20\"] .demo-item:nth-child(21),\n.demo[data-active=\"21\"] .demo-item:nth-child(22),\n.demo[data-active=\"22\"] .demo-item:nth-child(23),\n.demo[data-active=\"23\"] .demo-item:nth-child(24),\n.demo[data-active=\"24\"] .demo-item:nth-child(25),\n.demo[data-active=\"25\"] .demo-item:nth-child(26),\n.demo[data-active=\"26\"] .demo-item:nth-child(27),\n.demo[data-active=\"27\"] .demo-item:nth-child(28),\n.demo[data-active=\"28\"] .demo-item:nth-child(29),\n.demo[data-active=\"29\"] .demo-item:nth-child(30) {\n  opacity: 1;\n  visibility: visible;\n}\n.demo-item-sizer {\n  position: relative;\n}\n.demo-item .insert {\n  \/* inserted text *\/\n  background-color: rgba(var(--color-insert), 0.1);\n}\n.demo-item .edit {\n  \/* edited text *\/\n  background-color: rgba(var(--color-edit), 0.1);\n}\n.demo-item .inst-edit {\n  \/* edit instruction *\/\n  border-left: 2px solid rgba(var(--color-edit), 1);\n  padding-left: 0.5rem;\n}\n.demo-item .inst-insert {\n  \/* insert instruction *\/\n  border-left: 2px solid transparent;\n  padding-left: 0.5rem;\n}\n.demo-item .inst-comp {\n  \/* completed edit instruction *\/\n  border-left: 2px solid rgba(var(--fg), 0.5);\n  padding-left: 0.5rem;\n  opacity: 0.2;\n}\n<\/style>\n<p><script>\nvar initDemos = function () {\n  var demos = document.querySelectorAll('.js-demo');\n  if (!demos.length) return;\n  \/\/ for each set of demos\n  demos.forEach(function (d) {\n    initAnimation(d);\n  });\n};\nvar initAnimation = function (demo) {\n  var limit = demo.childElementCount;\n  var t = demo.children[0].getAttribute('data-t');\n  doAnimation(demo, 0, limit, t); \/\/ start at `0`\n};\nvar doAnimation = function (demo, i, limit, t) {\n  if (i == (limit-1)) { \/\/ 'round the corner\n    var newI = 0;\n  } else { \/\/ increment\n    var newI = i + 1;\n  }\n  var newT = demo.children[newI].getAttribute('data-t');\n  setTimeout(function () {\n    demo.setAttribute('data-active', newI);\n    doAnimation(demo, newI, limit, newT);\n  }, t);\n};\n\/\/ call everything\ndocument.addEventListener('DOMContentLoaded', function () {\n  initDemos();\n});\n<\/script><\/p>\n<footer class=\"post-footer js-post-footer\">\n<!-- footer item --><\/p>\n<div>\n<hr>\n<div class=\"row\" id=\"contributions\">\n<div class=\"col\">Contributions<\/div>\n<div class=\"col\">\n<p>Research advancements of insert and edit: Mohammad Bavarian, Heewoo Jun, Oleg Klimov, Raul Puri, Qiming Yuan<\/p>\n<p>Developing new versions of GPT-3 and Codex: Sandhini Agarwal, Igor Babuschkin, Greg Brockman, Andrew Carr, Brooke Chan, Chris Hesse, Shantanu Jain, Kyle Kosic, Jakub Pachocki, Alex Paino, Mikhail Pavlov, Vitchyr Pong, Nick Ryder, Szymon Sidor, Nikolas Tezak, Philippe Tillet, Amin Tootoonchian, Jerry Tworek, Lilian Weng, Clemens Winter, Qiming Yuan, Wojciech Zaremba, William Zhuk<\/p>\n<p>Engineering, Product Development, Safety, Policy, and Security: Steven Adler, Sandhini Agarwal, Mohammad Bavarian, Kevin Button, Tyna Eloundou, Angela Jiang, Shino Jomoto, Heewoo Jun, Rajeev Nayak, Henrique Ponde de Oliveira Pinto, Girish Sastry, Maddie Simens, Felipe Such<\/p>\n<p>Blog visuals: Justin Jay Wang<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!-- footer item --><\/p>\n<div>\n<hr>\n<div class=\"row\" id=\"acknowledgments\">\n<div class=\"col\">Acknowledgments<\/div>\n<div class=\"col\">\n<p>Thanks to the following for their feedback on this work and contributions to this release: Diogo Moitinho de Almeida, Che Chang, Elie Georges, Joanne Jang, Roger Jiang, Denny Jin, Fraser Kelton, Tabarak Khan, Matt Knight, Jan Leike, Ryan Lowe, Bianca Martin, Andrew Mayne, Bob McGrew, Luke Miller, Evan Morikawa, Mira Murati, Long Ouyang, Boris Power, William Saunders, Toki Sherbakov, Zarina Stanik, Preston Tuggle, Carroll Wainwright, Peter Welinder, Hannah Wong, Lauren Workman, Jeff Wu, Cathy Yeh<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/footer>\n<p><!--kg-card-end: markdown--><\/p>\n<p>source <a href=\"https:\/\/openai.com\/blog\/gpt-3-edit-insert\/\">https:\/\/openai.com\/blog\/gpt-3-edit-insert\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#x2019;ve released new versions of GPT-3 and Codex which can edit or insert content into existing text, rather than just completing existing text. These new capabilities make it practical to use the OpenAI API to revise existing content, such as rewriting a paragraph of text or refactoring code. This unlocks new use cases and improves &hellip; <a href=\"https:\/\/billsbud.org\/?p=3757\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">New GPT-3 Capabilities: Edit &#038; Insert<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-3757","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/billsbud.org\/index.php?rest_route=\/wp\/v2\/posts\/3757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/billsbud.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/billsbud.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/billsbud.org\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/billsbud.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3757"}],"version-history":[{"count":1,"href":"https:\/\/billsbud.org\/index.php?rest_route=\/wp\/v2\/posts\/3757\/revisions"}],"predecessor-version":[{"id":3758,"href":"https:\/\/billsbud.org\/index.php?rest_route=\/wp\/v2\/posts\/3757\/revisions\/3758"}],"wp:attachment":[{"href":"https:\/\/billsbud.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/billsbud.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/billsbud.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}