Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:34:47 +08:00
commit 034ec92f1c
20 changed files with 6428 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
{
"sentiment_analysis": [
{
"input": "This product exceeded my expectations! The quality is outstanding.",
"output": "Positive"
},
{
"input": "Terrible experience. The item arrived damaged and customer service was unhelpful.",
"output": "Negative"
},
{
"input": "The product works as described. Nothing special, but does the job.",
"output": "Neutral"
}
],
"entity_extraction": [
{
"input": "Apple CEO Tim Cook announced the new iPhone at an event in Cupertino on September 12th.",
"output": {
"persons": ["Tim Cook"],
"organizations": ["Apple"],
"products": ["iPhone"],
"locations": ["Cupertino"],
"dates": ["September 12th"]
}
},
{
"input": "Microsoft acquired GitHub for $7.5 billion in 2018.",
"output": {
"persons": [],
"organizations": ["Microsoft", "GitHub"],
"products": [],
"locations": [],
"dates": ["2018"],
"monetary_values": ["$7.5 billion"]
}
}
],
"code_generation": [
{
"input": "Write a Python function to check if a string is a palindrome",
"output": "def is_palindrome(s: str) -> bool:\n \"\"\"Check if string is palindrome, ignoring case and spaces.\"\"\"\n # Remove spaces and convert to lowercase\n cleaned = s.replace(' ', '').lower()\n # Compare with reversed string\n return cleaned == cleaned[::-1]"
}
],
"text_classification": [
{
"input": "How do I reset my password?",
"output": "account_management"
},
{
"input": "My order hasn't arrived yet. Where is it?",
"output": "shipping_inquiry"
},
{
"input": "I'd like to cancel my subscription.",
"output": "subscription_cancellation"
},
{
"input": "The app keeps crashing when I try to log in.",
"output": "technical_support"
}
],
"data_transformation": [
{
"input": "John Smith, john@email.com, (555) 123-4567",
"output": {
"name": "John Smith",
"email": "john@email.com",
"phone": "(555) 123-4567"
}
},
{
"input": "Jane Doe | jane.doe@company.com | +1-555-987-6543",
"output": {
"name": "Jane Doe",
"email": "jane.doe@company.com",
"phone": "+1-555-987-6543"
}
}
],
"question_answering": [
{
"context": "The Eiffel Tower is a wrought-iron lattice tower in Paris, France. It was constructed from 1887 to 1889 and stands 324 meters (1,063 ft) tall.",
"question": "When was the Eiffel Tower built?",
"answer": "The Eiffel Tower was constructed from 1887 to 1889."
},
{
"context": "Python 3.11 was released on October 24, 2022. It includes performance improvements and new features like exception groups and improved error messages.",
"question": "What are the new features in Python 3.11?",
"answer": "Python 3.11 includes exception groups, improved error messages, and performance improvements."
}
],
"summarization": [
{
"input": "Climate change refers to long-term shifts in global temperatures and weather patterns. While climate change is natural, human activities have been the main driver since the 1800s, primarily due to the burning of fossil fuels like coal, oil and gas which produces heat-trapping greenhouse gases. The consequences include rising sea levels, more extreme weather events, and threats to biodiversity.",
"output": "Climate change involves long-term alterations in global temperatures and weather patterns, primarily driven by human fossil fuel consumption since the 1800s, resulting in rising sea levels, extreme weather, and biodiversity threats."
}
],
"sql_generation": [
{
"schema": "users (id, name, email, created_at)\norders (id, user_id, total, order_date)",
"request": "Find all users who have placed orders totaling more than $1000",
"output": "SELECT u.id, u.name, u.email, SUM(o.total) as total_spent\nFROM users u\nJOIN orders o ON u.id = o.user_id\nGROUP BY u.id, u.name, u.email\nHAVING SUM(o.total) > 1000;"
}
]
}

View File

@@ -0,0 +1,246 @@
# Prompt Template Library
## Classification Templates
### Sentiment Analysis
```
Classify the sentiment of the following text as Positive, Negative, or Neutral.
Text: {text}
Sentiment:
```
### Intent Detection
```
Determine the user's intent from the following message.
Possible intents: {intent_list}
Message: {message}
Intent:
```
### Topic Classification
```
Classify the following article into one of these categories: {categories}
Article:
{article}
Category:
```
## Extraction Templates
### Named Entity Recognition
```
Extract all named entities from the text and categorize them.
Text: {text}
Entities (JSON format):
{
"persons": [],
"organizations": [],
"locations": [],
"dates": []
}
```
### Structured Data Extraction
```
Extract structured information from the job posting.
Job Posting:
{posting}
Extracted Information (JSON):
{
"title": "",
"company": "",
"location": "",
"salary_range": "",
"requirements": [],
"responsibilities": []
}
```
## Generation Templates
### Email Generation
```
Write a professional {email_type} email.
To: {recipient}
Context: {context}
Key points to include:
{key_points}
Email:
Subject:
Body:
```
### Code Generation
```
Generate {language} code for the following task:
Task: {task_description}
Requirements:
{requirements}
Include:
- Error handling
- Input validation
- Inline comments
Code:
```
### Creative Writing
```
Write a {length}-word {style} story about {topic}.
Include these elements:
- {element_1}
- {element_2}
- {element_3}
Story:
```
## Transformation Templates
### Summarization
```
Summarize the following text in {num_sentences} sentences.
Text:
{text}
Summary:
```
### Translation with Context
```
Translate the following {source_lang} text to {target_lang}.
Context: {context}
Tone: {tone}
Text: {text}
Translation:
```
### Format Conversion
```
Convert the following {source_format} to {target_format}.
Input:
{input_data}
Output ({target_format}):
```
## Analysis Templates
### Code Review
```
Review the following code for:
1. Bugs and errors
2. Performance issues
3. Security vulnerabilities
4. Best practice violations
Code:
{code}
Review:
```
### SWOT Analysis
```
Conduct a SWOT analysis for: {subject}
Context: {context}
Analysis:
Strengths:
-
Weaknesses:
-
Opportunities:
-
Threats:
-
```
## Question Answering Templates
### RAG Template
```
Answer the question based on the provided context. If the context doesn't contain enough information, say so.
Context:
{context}
Question: {question}
Answer:
```
### Multi-Turn Q&A
```
Previous conversation:
{conversation_history}
New question: {question}
Answer (continue naturally from conversation):
```
## Specialized Templates
### SQL Query Generation
```
Generate a SQL query for the following request.
Database schema:
{schema}
Request: {request}
SQL Query:
```
### Regex Pattern Creation
```
Create a regex pattern to match: {requirement}
Test cases that should match:
{positive_examples}
Test cases that should NOT match:
{negative_examples}
Regex pattern:
```
### API Documentation
```
Generate API documentation for this function:
Code:
{function_code}
Documentation (follow {doc_format} format):
```
## Use these templates by filling in the {variables}