This project demonstrates various prompting techniques and best practices for working with Large Language Models (LLMs). It includes examples of different prompting principles, tactics, and common use cases.
The project covers several key areas of LLM interaction:
-
Prompting Principles
- Writing clear and specific instructions
- Giving the model time to "think"
- Using delimiters for distinct inputs
- Structured output generation
-
Key Applications
- Text summarization and extraction
- Language translation and tone transformation
- Format conversion (JSON, HTML)
- Grammar and spelling correction
- Interactive chat interfaces
-
Interactive Components
- Chat interface with styled message display
- File upload widget for text analysis
- Temperature control for response randomness
- Cost calculation for API usage
-
Utility Functions
- Text processing and format conversion
- Multi-language support
- File handling (CSV, TXT)
- Data visualization helpers
pip install -r requirements.txt
- Clone the repository
- Create a
.env
file in the root directory - Add your environment variables:
OPENAI_API_KEY=your_api_key_here
BASE_PATH=your_base_path_here
The project is organized into several Jupyter notebooks demonstrating different prompting techniques:
prompting_guidelines.ipynb
: Main examples of prompting principles and tacticshelper_functions.py
: Utility functions for API interactions
prompt = f"""
Summarize the text delimited by triple backticks into a single sentence.
```{text}```
"""
response = get_llm_response(prompt)
messages = [
{'role':'system', 'content':'You are a helpful assistant.'},
{'role':'user', 'content':'Hi, my name is Isa'}
]
response = get_completion_from_messages(messages)
from helper_functions import open_chatbot, upload_txt_file_widget
# Launch interactive chatbot
open_chatbot()
# Create file upload widget
upload_txt_file_widget()
helper_functions.py
: Core utilities and API interactionsprompting_guidelines.ipynb
: Interactive examples and demonstrations- Various example files for testing and demonstration
Contributions are welcome! Please feel free to submit a Pull Request.
If you like my work, consider supporting my studies!
Your contributions will help cover fees and materials for my Computer Science and Engineering studies at UoPeople starting in September 2025.
Every little bit helps—you can donate from as little as $1.
This project is inspired by the DeepLearning.AI courses. Please visit DeepLearning.AI for more information and resources.