This Python script provides a convenient way to interact with the OpenAI GPT-3.5-turbo model using the OpenAI API. The submit_prompt
function allows users to submit prompts tailored to their background information and specific topic instructions, receiving responses from the model accordingly. Speciically, this script is currently constructed to allow me to interact with OpenAI's GPT-3.5 turbo and receive responses that prioritise relevance, safety and account for my own specific level of understanding/area of expertise.
Before using this script, make sure that you have the following:
- OpenAI API key: You can obtain your API key by signing up on the OpenAI website.
-
Clone the repository:
git clone https://github.com/your-username/your-repository.git
-
Navigate to the project directory:
cd your-repository
-
Install the required dependencies:
pip install openai
-
Open the script file (
prompt_gpt3.5.py
) and replace'your-api-key'
with your actual OpenAI API key. -
You can customise the
api_key
,prompt_text
andtopic
variables within the script, to fit your requirements. -
Run the script:
python prompt_gpt3.5.py.py
-
The model's response will be printed to the console.
api_key
(str): Your OpenAI API key.prompt_text
(str): The user's prompt for the model.topic
(str, optional): The topic for the model to recruit expertise in.
The submit_prompt
function incorporates specific information about your background and safety/efficacy prompts to guide the model's responses. You can customise these prompts within the function based on your preferences.
Note: Ensure that you follow OpenAI's usage policies and guidelines when interacting with the GPT-3.5-turbo model.
Here's an example usage of the script:
api_key = 'your-api-key'
prompt_text = 'Explain Generative Pre-Trained Transformers'
topic = 'Artificial Intelligence'
response = submit_prompt(api_key, prompt_text, topic)
print(response)