使用ChatGPT模拟一个Linux虚拟机
// 如果一只鸟走起来像鸭子、游泳起来像鸭子、叫起来也像鸭子,那么这只鸟就可以被称为鸭子。
https://www.engraved.blog/building-a-virtual-machine-inside/
// 如果一只鸟走起来像鸭子、游泳起来像鸭子、叫起来也像鸭子,那么这只鸟就可以被称为鸭子。
https://www.engraved.blog/building-a-virtual-machine-inside/
Engraved
Building A Virtual Machine inside ChatGPT
Unless you have been living under a rock, you have heard of this new ChatGPT assistant made by OpenAI. Did you know, that you can run a whole virtual machine inside of ChatGPT?
👍4
试用了一下ChatGPT,简直颠覆我的认知
下面是由ChatGPT生成的使用requests和python-telegram-bot库制作的调用ChatGPT API的Telegram Bot代码
下面是由ChatGPT生成的使用requests和python-telegram-bot库制作的调用ChatGPT API的Telegram Bot代码
import requests
from telegram.ext import Updater, MessageHandler, Filters
# Replace <TELEGRAM_BOT_API_KEY> with your own Telegram Bot API key
bot_api_key = "<TELEGRAM_BOT_API_KEY>"
# Replace <CHAT_GPT_API_KEY> with your own ChatGPT API key
chat_gpt_api_key = "<CHAT_GPT_API_KEY>"
# Set the API endpoint URL
chat_gpt_api_url = "https://api.openai.com/v1/chat/gpt2"
# Create a updater object to handle updates from Telegram
updater = Updater(bot_api_key, use_context=True)
# Get the dispatcher to register handlers
dispatcher = updater.dispatcher
def reply_to_message(update, context):
# Extract the message from the update
message = update.message
# Set the parameters for the request to the ChatGPT API
params = {
"prompt": message.text,
"model": "text-davinci-002",
"max_tokens": 256,
}
# Send the request to the ChatGPT API
response = requests.post(
chat_gpt_api_url, json=params, headers={"Authorization": f"Bearer {chat_gpt_api_key}"}
)
# Extract the generated text from the response
generated_text = response.json()["data"]["generated_text"]
# Send the generated text as reply to the message
message.reply_text(generated_text)
# Register the reply_to_message function as a handler for message events
message_handler = MessageHandler(Filters.text, reply_to_message)
dispatcher.add_handler(message_handler)
# Start the bot
updater.start_polling()
🤯10
新·世界观察日志
使用ChatGPT模拟一个Linux虚拟机 // 如果一只鸟走起来像鸭子、游泳起来像鸭子、叫起来也像鸭子,那么这只鸟就可以被称为鸭子。 https://www.engraved.blog/building-a-virtual-machine-inside/
对其中使用的语句进行了一些修改,现在可以让它模拟一个Python解释器了
I want you to act as a Python Compiler. I will type statements and you will reply with what the compiler should show. I want you to only reply with the compiler output inside one unique code block, and nothing else. Do no write explanations. Do not type statements unless I instruct you to do so. When I need to tell you something in English I will do so by putting text inside curly brackets {like this}. My first statement is print("Hello World!").
🤯1