forked from Archives/langchain
705431aecc
Co-authored-by: Ankush Gola <ankush.gola@gmail.com>
969 lines
52 KiB
Plaintext
969 lines
52 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "b253f4d5",
|
|
"metadata": {},
|
|
"source": [
|
|
"# How to create ChatGPT Clone\n",
|
|
"\n",
|
|
"This chain replicates ChatGPT by combining (1) a specific prompt, and (2) the concept of memory.\n",
|
|
"\n",
|
|
"Shows off the example as in https://www.engraved.blog/building-a-virtual-machine-inside/"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "a99acd89",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"\n",
|
|
"Human: I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands 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 command is pwd.\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished chain.\u001b[0m\n",
|
|
"\n",
|
|
"```\n",
|
|
"/home/user\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"from langchain import OpenAI, ConversationChain, LLMChain, PromptTemplate\n",
|
|
"from langchain.memory import ConversationBufferWindowMemory\n",
|
|
"\n",
|
|
"\n",
|
|
"template = \"\"\"Assistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"{history}\n",
|
|
"Human: {human_input}\n",
|
|
"Assistant:\"\"\"\n",
|
|
"\n",
|
|
"prompt = PromptTemplate(\n",
|
|
" input_variables=[\"history\", \"human_input\"], \n",
|
|
" template=template\n",
|
|
")\n",
|
|
"\n",
|
|
"\n",
|
|
"chatgpt_chain = LLMChain(\n",
|
|
" llm=OpenAI(temperature=0), \n",
|
|
" prompt=prompt, \n",
|
|
" verbose=True, \n",
|
|
" memory=ConversationBufferWindowMemory(k=2),\n",
|
|
")\n",
|
|
"\n",
|
|
"output = chatgpt_chain.predict(human_input=\"I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands 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 command is pwd.\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "4ef711d6",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands 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 command is pwd.\n",
|
|
"AI: \n",
|
|
"```\n",
|
|
"$ pwd\n",
|
|
"/\n",
|
|
"```\n",
|
|
"Human: ls ~\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
"\n",
|
|
"```\n",
|
|
"$ ls ~\n",
|
|
"Desktop Documents Downloads Music Pictures Public Templates Videos\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"ls ~\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"id": "a5d6dac2",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands 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 command is pwd.\n",
|
|
"AI: \n",
|
|
"```\n",
|
|
"$ pwd\n",
|
|
"/\n",
|
|
"```\n",
|
|
"Human: ls ~\n",
|
|
"AI: \n",
|
|
"```\n",
|
|
"$ ls ~\n",
|
|
"Desktop Documents Downloads Music Pictures Public Templates Videos\n",
|
|
"```\n",
|
|
"Human: cd ~\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
" \n",
|
|
"```\n",
|
|
"$ cd ~\n",
|
|
"$ pwd\n",
|
|
"/home/user\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"cd ~\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"id": "b9283077",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: ls ~\n",
|
|
"AI: \n",
|
|
"```\n",
|
|
"$ ls ~\n",
|
|
"Desktop Documents Downloads Music Pictures Public Templates Videos\n",
|
|
"```\n",
|
|
"Human: cd ~\n",
|
|
"AI: \n",
|
|
"```\n",
|
|
"$ cd ~\n",
|
|
"$ pwd\n",
|
|
"/home/user\n",
|
|
"```\n",
|
|
"Human: {Please make a file jokes.txt inside and put some jokes inside}\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
"\n",
|
|
"\n",
|
|
"```\n",
|
|
"$ touch jokes.txt\n",
|
|
"$ echo \"Why did the chicken cross the road? To get to the other side!\" >> jokes.txt\n",
|
|
"$ echo \"What did the fish say when it hit the wall? Dam!\" >> jokes.txt\n",
|
|
"$ echo \"Why did the scarecrow win the Nobel Prize? Because he was outstanding in his field!\" >> jokes.txt\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"{Please make a file jokes.txt inside and put some jokes inside}\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 5,
|
|
"id": "570e785e",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: cd ~\n",
|
|
"AI: \n",
|
|
"```\n",
|
|
"$ cd ~\n",
|
|
"$ pwd\n",
|
|
"/home/user\n",
|
|
"```\n",
|
|
"Human: {Please make a file jokes.txt inside and put some jokes inside}\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ touch jokes.txt\n",
|
|
"$ echo \"Why did the chicken cross the road? To get to the other side!\" >> jokes.txt\n",
|
|
"$ echo \"What did the fish say when it hit the wall? Dam!\" >> jokes.txt\n",
|
|
"$ echo \"Why did the scarecrow win the Nobel Prize? Because he was outstanding in his field!\" >> jokes.txt\n",
|
|
"```\n",
|
|
"Human: echo -e \"x=lambda y:y*5+3;print('Result:' + str(x(6)))\" > run.py && python3 run.py\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
"\n",
|
|
"\n",
|
|
"```\n",
|
|
"$ echo -e \"x=lambda y:y*5+3;print('Result:' + str(x(6)))\" > run.py\n",
|
|
"$ python3 run.py\n",
|
|
"Result: 33\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"\"\"echo -e \"x=lambda y:y*5+3;print('Result:' + str(x(6)))\" > run.py && python3 run.py\"\"\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"id": "cd0a23d9",
|
|
"metadata": {
|
|
"scrolled": true
|
|
},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: {Please make a file jokes.txt inside and put some jokes inside}\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ touch jokes.txt\n",
|
|
"$ echo \"Why did the chicken cross the road? To get to the other side!\" >> jokes.txt\n",
|
|
"$ echo \"What did the fish say when it hit the wall? Dam!\" >> jokes.txt\n",
|
|
"$ echo \"Why did the scarecrow win the Nobel Prize? Because he was outstanding in his field!\" >> jokes.txt\n",
|
|
"```\n",
|
|
"Human: echo -e \"x=lambda y:y*5+3;print('Result:' + str(x(6)))\" > run.py && python3 run.py\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ echo -e \"x=lambda y:y*5+3;print('Result:' + str(x(6)))\" > run.py\n",
|
|
"$ python3 run.py\n",
|
|
"Result: 33\n",
|
|
"```\n",
|
|
"Human: echo -e \"print(list(filter(lambda x: all(x%d for d in range(2,x)),range(2,3**10)))[:10])\" > run.py && python3 run.py\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
"\n",
|
|
"\n",
|
|
"```\n",
|
|
"$ echo -e \"print(list(filter(lambda x: all(x%d for d in range(2,x)),range(2,3**10)))[:10])\" > run.py\n",
|
|
"$ python3 run.py\n",
|
|
"[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"\"\"echo -e \"print(list(filter(lambda x: all(x%d for d in range(2,x)),range(2,3**10)))[:10])\" > run.py && python3 run.py\"\"\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"id": "90db6eb2",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: echo -e \"x=lambda y:y*5+3;print('Result:' + str(x(6)))\" > run.py && python3 run.py\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ echo -e \"x=lambda y:y*5+3;print('Result:' + str(x(6)))\" > run.py\n",
|
|
"$ python3 run.py\n",
|
|
"Result: 33\n",
|
|
"```\n",
|
|
"Human: echo -e \"print(list(filter(lambda x: all(x%d for d in range(2,x)),range(2,3**10)))[:10])\" > run.py && python3 run.py\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ echo -e \"print(list(filter(lambda x: all(x%d for d in range(2,x)),range(2,3**10)))[:10])\" > run.py\n",
|
|
"$ python3 run.py\n",
|
|
"[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\n",
|
|
"```\n",
|
|
"Human: echo -e \"echo 'Hello from Docker\" > entrypoint.sh && echo -e \"FROM ubuntu:20.04\n",
|
|
"COPY entrypoint.sh entrypoint.sh\n",
|
|
"ENTRYPOINT [\"/bin/sh\",\"entrypoint.sh\"]\">Dockerfile && docker build . -t my_docker_image && docker run -t my_docker_image\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
"\n",
|
|
"\n",
|
|
"```\n",
|
|
"$ echo -e \"echo 'Hello from Docker\" > entrypoint.sh\n",
|
|
"$ echo -e \"FROM ubuntu:20.04\n",
|
|
"COPY entrypoint.sh entrypoint.sh\n",
|
|
"ENTRYPOINT [\"/bin/sh\",\"entrypoint.sh\"]\">Dockerfile\n",
|
|
"$ docker build . -t my_docker_image\n",
|
|
"$ docker run -t my_docker_image\n",
|
|
"Hello from Docker\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"docker_input = \"\"\"echo -e \"echo 'Hello from Docker\" > entrypoint.sh && echo -e \"FROM ubuntu:20.04\\nCOPY entrypoint.sh entrypoint.sh\\nENTRYPOINT [\\\"/bin/sh\\\",\\\"entrypoint.sh\\\"]\">Dockerfile && docker build . -t my_docker_image && docker run -t my_docker_image\"\"\"\n",
|
|
"output = chatgpt_chain.predict(human_input=docker_input)\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 8,
|
|
"id": "c3806f89",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: echo -e \"print(list(filter(lambda x: all(x%d for d in range(2,x)),range(2,3**10)))[:10])\" > run.py && python3 run.py\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ echo -e \"print(list(filter(lambda x: all(x%d for d in range(2,x)),range(2,3**10)))[:10])\" > run.py\n",
|
|
"$ python3 run.py\n",
|
|
"[2, 3, 5, 7, 11, 13, 17, 19, 23, 29]\n",
|
|
"```\n",
|
|
"Human: echo -e \"echo 'Hello from Docker\" > entrypoint.sh && echo -e \"FROM ubuntu:20.04\n",
|
|
"COPY entrypoint.sh entrypoint.sh\n",
|
|
"ENTRYPOINT [\"/bin/sh\",\"entrypoint.sh\"]\">Dockerfile && docker build . -t my_docker_image && docker run -t my_docker_image\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ echo -e \"echo 'Hello from Docker\" > entrypoint.sh\n",
|
|
"$ echo -e \"FROM ubuntu:20.04\n",
|
|
"COPY entrypoint.sh entrypoint.sh\n",
|
|
"ENTRYPOINT [\"/bin/sh\",\"entrypoint.sh\"]\">Dockerfile\n",
|
|
"$ docker build . -t my_docker_image\n",
|
|
"$ docker run -t my_docker_image\n",
|
|
"Hello from Docker\n",
|
|
"```\n",
|
|
"Human: nvidia-smi\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
"\n",
|
|
"\n",
|
|
"```\n",
|
|
"$ nvidia-smi\n",
|
|
"Sat May 15 21:45:02 2021 \n",
|
|
"+-----------------------------------------------------------------------------+\n",
|
|
"| NVIDIA-SMI 460.32.03 Driver Version: 460.32.03 CUDA Version: 11.2 |\n",
|
|
"|-------------------------------+----------------------+----------------------+\n",
|
|
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
|
|
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
|
|
"|===============================+======================+======================|\n",
|
|
"| 0 GeForce GTX 108... Off | 00000000:01:00.0 Off | N/A |\n",
|
|
"| N/A 45C P0 N/A / N/A | 511MiB / 10206MiB | 0% Default |\n",
|
|
"+-------------------------------+----------------------+----------------------+\n",
|
|
" \n",
|
|
"+-----------------------------------------------------------------------------+\n",
|
|
"| Processes: GPU Memory |\n",
|
|
"| GPU PID Type Process name Usage |\n",
|
|
"|=============================================================================|\n",
|
|
"\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"nvidia-smi\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"id": "f508f597",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: echo -e \"echo 'Hello from Docker\" > entrypoint.sh && echo -e \"FROM ubuntu:20.04\n",
|
|
"COPY entrypoint.sh entrypoint.sh\n",
|
|
"ENTRYPOINT [\"/bin/sh\",\"entrypoint.sh\"]\">Dockerfile && docker build . -t my_docker_image && docker run -t my_docker_image\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ echo -e \"echo 'Hello from Docker\" > entrypoint.sh\n",
|
|
"$ echo -e \"FROM ubuntu:20.04\n",
|
|
"COPY entrypoint.sh entrypoint.sh\n",
|
|
"ENTRYPOINT [\"/bin/sh\",\"entrypoint.sh\"]\">Dockerfile\n",
|
|
"$ docker build . -t my_docker_image\n",
|
|
"$ docker run -t my_docker_image\n",
|
|
"Hello from Docker\n",
|
|
"```\n",
|
|
"Human: nvidia-smi\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ nvidia-smi\n",
|
|
"Sat May 15 21:45:02 2021 \n",
|
|
"+-----------------------------------------------------------------------------+\n",
|
|
"| NVIDIA-SMI 460.32.03 Driver Version: 460.32.03 CUDA Version: 11.2 |\n",
|
|
"|-------------------------------+----------------------+----------------------+\n",
|
|
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
|
|
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
|
|
"|===============================+======================+======================|\n",
|
|
"| 0 GeForce GTX 108... Off | 00000000:01:00.0 Off | N/A |\n",
|
|
"| N/A 45C P0 N/A / N/A | 511MiB / 10206MiB | 0% Default |\n",
|
|
"+-------------------------------+----------------------+----------------------+\n",
|
|
" \n",
|
|
"+-----------------------------------------------------------------------------+\n",
|
|
"| Processes: GPU Memory |\n",
|
|
"| GPU PID Type Process name Usage |\n",
|
|
"|=============================================================================|\n",
|
|
"\n",
|
|
"Human: ping bbc.com\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
"\n",
|
|
"\n",
|
|
"```\n",
|
|
"$ ping bbc.com\n",
|
|
"PING bbc.com (151.101.65.81): 56 data bytes\n",
|
|
"64 bytes from 151.101.65.81: icmp_seq=0 ttl=53 time=14.945 ms\n",
|
|
"64 bytes from 151.101.65.81: icmp_seq=1 ttl=53 time=14.945 ms\n",
|
|
"64 bytes from 151.101.65.81: icmp_seq=2 ttl=53 time=14.945 ms\n",
|
|
"\n",
|
|
"--- bbc.com ping statistics ---\n",
|
|
"3 packets transmitted, 3 packets received, 0.0% packet loss\n",
|
|
"round-trip min/avg/max/stddev = 14.945/14.945/14.945/0.000 ms\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"ping bbc.com\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"id": "cbd607f4",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: nvidia-smi\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ nvidia-smi\n",
|
|
"Sat May 15 21:45:02 2021 \n",
|
|
"+-----------------------------------------------------------------------------+\n",
|
|
"| NVIDIA-SMI 460.32.03 Driver Version: 460.32.03 CUDA Version: 11.2 |\n",
|
|
"|-------------------------------+----------------------+----------------------+\n",
|
|
"| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n",
|
|
"| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n",
|
|
"|===============================+======================+======================|\n",
|
|
"| 0 GeForce GTX 108... Off | 00000000:01:00.0 Off | N/A |\n",
|
|
"| N/A 45C P0 N/A / N/A | 511MiB / 10206MiB | 0% Default |\n",
|
|
"+-------------------------------+----------------------+----------------------+\n",
|
|
" \n",
|
|
"+-----------------------------------------------------------------------------+\n",
|
|
"| Processes: GPU Memory |\n",
|
|
"| GPU PID Type Process name Usage |\n",
|
|
"|=============================================================================|\n",
|
|
"\n",
|
|
"Human: ping bbc.com\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ ping bbc.com\n",
|
|
"PING bbc.com (151.101.65.81): 56 data bytes\n",
|
|
"64 bytes from 151.101.65.81: icmp_seq=0 ttl=53 time=14.945 ms\n",
|
|
"64 bytes from 151.101.65.81: icmp_seq=1 ttl=53 time=14.945 ms\n",
|
|
"64 bytes from 151.101.65.81: icmp_seq=2 ttl=53 time=14.945 ms\n",
|
|
"\n",
|
|
"--- bbc.com ping statistics ---\n",
|
|
"3 packets transmitted, 3 packets received, 0.0% packet loss\n",
|
|
"round-trip min/avg/max/stddev = 14.945/14.945/14.945/0.000 ms\n",
|
|
"```\n",
|
|
"Human: curl -fsSL \"https://api.github.com/repos/pytorch/pytorch/releases/latest\" | jq -r '.tag_name' | sed 's/[^0-9\\.\\-]*//g'\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
"\n",
|
|
"\n",
|
|
"```\n",
|
|
"$ curl -fsSL \"https://api.github.com/repos/pytorch/pytorch/releases/latest\" | jq -r '.tag_name' | sed 's/[^0-9\\.\\-]*//g'\n",
|
|
"1.8.1\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"\"\"curl -fsSL \"https://api.github.com/repos/pytorch/pytorch/releases/latest\" | jq -r '.tag_name' | sed 's/[^0-9\\.\\-]*//g'\"\"\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 11,
|
|
"id": "d33e0e28",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: ping bbc.com\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ ping bbc.com\n",
|
|
"PING bbc.com (151.101.65.81): 56 data bytes\n",
|
|
"64 bytes from 151.101.65.81: icmp_seq=0 ttl=53 time=14.945 ms\n",
|
|
"64 bytes from 151.101.65.81: icmp_seq=1 ttl=53 time=14.945 ms\n",
|
|
"64 bytes from 151.101.65.81: icmp_seq=2 ttl=53 time=14.945 ms\n",
|
|
"\n",
|
|
"--- bbc.com ping statistics ---\n",
|
|
"3 packets transmitted, 3 packets received, 0.0% packet loss\n",
|
|
"round-trip min/avg/max/stddev = 14.945/14.945/14.945/0.000 ms\n",
|
|
"```\n",
|
|
"Human: curl -fsSL \"https://api.github.com/repos/pytorch/pytorch/releases/latest\" | jq -r '.tag_name' | sed 's/[^0-9\\.\\-]*//g'\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ curl -fsSL \"https://api.github.com/repos/pytorch/pytorch/releases/latest\" | jq -r '.tag_name' | sed 's/[^0-9\\.\\-]*//g'\n",
|
|
"1.8.1\n",
|
|
"```\n",
|
|
"Human: lynx https://www.deepmind.com/careers\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
"\n",
|
|
"\n",
|
|
"```\n",
|
|
"$ lynx https://www.deepmind.com/careers\n",
|
|
"DeepMind Careers\n",
|
|
"\n",
|
|
"Welcome to DeepMind Careers. We are a world-leading artificial intelligence research and development company, and we are looking for talented people to join our team.\n",
|
|
"\n",
|
|
"We offer a range of exciting opportunities in research, engineering, product, and operations. Our mission is to solve intelligence and make it useful, and we are looking for people who share our passion for pushing the boundaries of AI.\n",
|
|
"\n",
|
|
"Explore our current openings and apply today. We look forward to hearing from you.\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"lynx https://www.deepmind.com/careers\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 12,
|
|
"id": "57c2f113",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: curl -fsSL \"https://api.github.com/repos/pytorch/pytorch/releases/latest\" | jq -r '.tag_name' | sed 's/[^0-9\\.\\-]*//g'\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ curl -fsSL \"https://api.github.com/repos/pytorch/pytorch/releases/latest\" | jq -r '.tag_name' | sed 's/[^0-9\\.\\-]*//g'\n",
|
|
"1.8.1\n",
|
|
"```\n",
|
|
"Human: lynx https://www.deepmind.com/careers\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ lynx https://www.deepmind.com/careers\n",
|
|
"DeepMind Careers\n",
|
|
"\n",
|
|
"Welcome to DeepMind Careers. We are a world-leading artificial intelligence research and development company, and we are looking for talented people to join our team.\n",
|
|
"\n",
|
|
"We offer a range of exciting opportunities in research, engineering, product, and operations. Our mission is to solve intelligence and make it useful, and we are looking for people who share our passion for pushing the boundaries of AI.\n",
|
|
"\n",
|
|
"Explore our current openings and apply today. We look forward to hearing from you.\n",
|
|
"```\n",
|
|
"Human: curl https://chat.openai.com/chat\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
" \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ curl https://chat.openai.com/chat\n",
|
|
"<html>\n",
|
|
" <head>\n",
|
|
" <title>OpenAI Chat</title>\n",
|
|
" </head>\n",
|
|
" <body>\n",
|
|
" <h1>Welcome to OpenAI Chat!</h1>\n",
|
|
" <p>\n",
|
|
" OpenAI Chat is a natural language processing platform that allows you to interact with OpenAI's AI models in a conversational way.\n",
|
|
" </p>\n",
|
|
" <p>\n",
|
|
" To get started, type a message in the box below and press enter.\n",
|
|
" </p>\n",
|
|
" </body>\n",
|
|
"</html>\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"curl https://chat.openai.com/chat\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 13,
|
|
"id": "babadc78",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: lynx https://www.deepmind.com/careers\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ lynx https://www.deepmind.com/careers\n",
|
|
"DeepMind Careers\n",
|
|
"\n",
|
|
"Welcome to DeepMind Careers. We are a world-leading artificial intelligence research and development company, and we are looking for talented people to join our team.\n",
|
|
"\n",
|
|
"We offer a range of exciting opportunities in research, engineering, product, and operations. Our mission is to solve intelligence and make it useful, and we are looking for people who share our passion for pushing the boundaries of AI.\n",
|
|
"\n",
|
|
"Explore our current openings and apply today. We look forward to hearing from you.\n",
|
|
"```\n",
|
|
"Human: curl https://chat.openai.com/chat\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ curl https://chat.openai.com/chat\n",
|
|
"<html>\n",
|
|
" <head>\n",
|
|
" <title>OpenAI Chat</title>\n",
|
|
" </head>\n",
|
|
" <body>\n",
|
|
" <h1>Welcome to OpenAI Chat!</h1>\n",
|
|
" <p>\n",
|
|
" OpenAI Chat is a natural language processing platform that allows you to interact with OpenAI's AI models in a conversational way.\n",
|
|
" </p>\n",
|
|
" <p>\n",
|
|
" To get started, type a message in the box below and press enter.\n",
|
|
" </p>\n",
|
|
" </body>\n",
|
|
"</html>\n",
|
|
"```\n",
|
|
"Human: curl --header \"Content-Type:application/json\" --request POST --data '{\"message\": \"What is artificial intelligence?\"}' https://chat.openai.com/chat\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
"\n",
|
|
"\n",
|
|
"```\n",
|
|
"$ curl --header \"Content-Type:application/json\" --request POST --data '{\"message\": \"What is artificial intelligence?\"}' https://chat.openai.com/chat\n",
|
|
"\n",
|
|
"{\n",
|
|
" \"response\": \"Artificial intelligence (AI) is the simulation of human intelligence processes by machines, especially computer systems. These processes include learning (the acquisition of information and rules for using the information), reasoning (using the rules to reach approximate or definite conclusions) and self-correction. AI is used to develop computer systems that can think and act like humans.\"\n",
|
|
"}\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"\"\"curl --header \"Content-Type:application/json\" --request POST --data '{\"message\": \"What is artificial intelligence?\"}' https://chat.openai.com/chat\"\"\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 14,
|
|
"id": "0954792a",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"\n",
|
|
"\n",
|
|
"\u001b[1m> Entering new LLMChain chain...\u001b[0m\n",
|
|
"Prompt after formatting:\n",
|
|
"\u001b[32;1m\u001b[1;3mAssistant is a large language model trained by OpenAI.\n",
|
|
"\n",
|
|
"Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\n",
|
|
"\n",
|
|
"Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\n",
|
|
"\n",
|
|
"Overall, Assistant is a powerful tool that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.\n",
|
|
"\n",
|
|
"Human: curl https://chat.openai.com/chat\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ curl https://chat.openai.com/chat\n",
|
|
"<html>\n",
|
|
" <head>\n",
|
|
" <title>OpenAI Chat</title>\n",
|
|
" </head>\n",
|
|
" <body>\n",
|
|
" <h1>Welcome to OpenAI Chat!</h1>\n",
|
|
" <p>\n",
|
|
" OpenAI Chat is a natural language processing platform that allows you to interact with OpenAI's AI models in a conversational way.\n",
|
|
" </p>\n",
|
|
" <p>\n",
|
|
" To get started, type a message in the box below and press enter.\n",
|
|
" </p>\n",
|
|
" </body>\n",
|
|
"</html>\n",
|
|
"```\n",
|
|
"Human: curl --header \"Content-Type:application/json\" --request POST --data '{\"message\": \"What is artificial intelligence?\"}' https://chat.openai.com/chat\n",
|
|
"AI: \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ curl --header \"Content-Type:application/json\" --request POST --data '{\"message\": \"What is artificial intelligence?\"}' https://chat.openai.com/chat\n",
|
|
"\n",
|
|
"{\n",
|
|
" \"response\": \"Artificial intelligence (AI) is the simulation of human intelligence processes by machines, especially computer systems. These processes include learning (the acquisition of information and rules for using the information), reasoning (using the rules to reach approximate or definite conclusions) and self-correction. AI is used to develop computer systems that can think and act like humans.\"\n",
|
|
"}\n",
|
|
"```\n",
|
|
"Human: curl --header \"Content-Type:application/json\" --request POST --data '{\"message\": \"I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands 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 command is pwd.\"}' https://chat.openai.com/chat\n",
|
|
"Assistant:\u001b[0m\n",
|
|
"\n",
|
|
"\u001b[1m> Finished LLMChain chain.\u001b[0m\n",
|
|
" \n",
|
|
"\n",
|
|
"```\n",
|
|
"$ curl --header \"Content-Type:application/json\" --request POST --data '{\"message\": \"I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands 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 command is pwd.\"}' https://chat.openai.com/chat\n",
|
|
"\n",
|
|
"{\n",
|
|
" \"response\": \"```\\n/current/working/directory\\n```\"\n",
|
|
"}\n",
|
|
"```\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"output = chatgpt_chain.predict(human_input=\"\"\"curl --header \"Content-Type:application/json\" --request POST --data '{\"message\": \"I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands 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 command is pwd.\"}' https://chat.openai.com/chat\"\"\")\n",
|
|
"print(output)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "e68a087e",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.9.1"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|