Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cs2219/prompt_engineering
Prompt engineering techniques with streamlit and openai
https://github.com/cs2219/prompt_engineering
openai-api prompt-engineering python streamlit
Last synced: about 1 month ago
JSON representation
Prompt engineering techniques with streamlit and openai
- Host: GitHub
- URL: https://github.com/cs2219/prompt_engineering
- Owner: CS2219
- Created: 2024-11-16T14:59:12.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-17T06:40:09.000Z (about 2 months ago)
- Last Synced: 2024-11-17T07:29:02.641Z (about 2 months ago)
- Topics: openai-api, prompt-engineering, python, streamlit
- Language: Python
- Homepage: https://github.com/CS2219/prompt_engineering
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# prompt_engineering
**Interactive Prompt Testing: Enter custom prompts and see real-time responses from OpenAI's GPT models.**
Prompt Engineering Techniques: Learn and apply techniques like:
Role-playing and Persona Assignment
Chain-of-Thought Prompting
Few-shot and Zero-shot Learning
Iterative Refinement
Streamlit-Based UI: A simple, user-friendly interface to interact with the API.
Educational Content: Includes explanations and examples of effective prompt engineering.**Installation**
Follow these steps to get the app up and running:**1. Clone the Repository**
```python
git clone https://github.com/your-username/prompt-engineering.git
cd prompt-engineering```
**2. Install Dependencies**
Make sure you have Python 3.7 or later. Install the required libraries:
```python
pip install -r requirements.txt```
**3. Set Up OpenAI API Key**
Create a .env file in the root directory and add your OpenAI API key:
```python
OPENAI_API_KEY=your-openai-api-key-here
```
Alternatively, you can set the environment variable directly in your terminal:
```python
export OPENAI_API_KEY=your-openai-api-key-here
```
**4. Run the App**
Run the Streamlit app locally:
```python
streamlit run app.py
```
The app will open in your default browser at http://localhost:8501.**Usage**
Enter a prompt in the text input field (e.g., "Write a story about a mischievous dragon.").
Click the "Generate" button to get a response from the OpenAI API.
Experiment with different prompt engineering techniques explained in the app.**Resources**
Here are some useful resources to learn more about OpenAIβs API and prompt engineering:π OpenAI API Documentation
π‘ OpenAI Cookbook
π Introduction to Prompt Engineering
π₯ YouTube: Practical Prompt Engineering Techniques
π Streamlit Documentation