© Haodong Li

First, install openai python package.


You: How to install openai python package using pip or conda?

ChatGPT: To install openai python package using pip, follow these steps:

  1. Open your command prompt or terminal.
  2. Type pip install openai and hit enter.
  3. Wait for the installation process to complete.

To install openai python package using conda, follow these steps:

  1. Open your command prompt or terminal.
  2. Type conda install -c conda-forge openai and hit enter.
  3. Wait for the installation process to complete.

Note: If you’re using Anaconda distribution, prefer installing openai with conda.


Second, export OPENAI_API_KEY=YOUR_KEY in your environment.

Third, code using docs from https://github.com/openai/openai-python, like DALL \(\cdot\) E2 to generate images (Wanna to try DALL \(\cdot\) E2?), or conversational model gpt-3.5-turbo to chat with AI.

# export OPENAI_API_KEY='sk-...'
import openai

# I want ChatGPT to behave like a strict interviewer
# [{"role": "system", "content": "You are a strict interviewer"}]
messages = []
user_text = input("You: ")

def no_br_in_begin(reply):
    for i in range(len(reply)):
        if reply[i] != '\n':
            return reply[i:]
    raise KeyboardInterrupt

def interact_with_ChatGPT():
    global messages, user_text

    # I want this code to run indefinitely, until any of the parties say Q or q
    while user_text not in ["q", "Q"]:
        messages.append({"role": "user", "content": user_text})
        response = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=messages)
        reply = response.choices[0].message.content
        print("\nChatGPT:", no_br_in_begin(reply))
        messages.append({"role": "assistant", "content": reply})
        user_text = input("\nYou: ")

interact_with_ChatGPT()

Finally, enjoy!


You: Hi, what is the main idea about AlphaFold2?

ChatGPT: AlphaFold2 is a deep learning-based computational technique developed by researchers from the University of California, Berkeley and DeepMind to predict the 3D structure of proteins with remarkable accuracy. This breakthrough in the field of protein folding has significant implications for drug discovery, disease diagnosis, and treatment. With AlphaFold2, scientists can now predict the structure of proteins quickly and accurately, which was previously a challenging task as it would take years to identify such structures.

You: Will it replace protein scientists in the future?

ChatGPT: No, AlphaFold2 will not replace protein scientists in the future. While AlphaFold2’s predictions are remarkable, they are still predictions, and experimental validation is necessary to confirm the accuracy of the predicted protein structures. Also, protein scientists play a critical role in designing experiments, testing hypotheses, and analyzing experimental data, which cannot be completely replaced by AlphaFold2 or any other computational technique. In fact, AlphaFold2 is expected to enhance the work of protein scientists, allowing them to focus on more complex problems and accelerating the discovery of new drugs and therapies.

You: I agree with you, thanks!

ChatGPT: You’re welcome! If you have any other questions, feel free to ask.