Skip to content

Commit

Permalink
update with dcterms
Browse files Browse the repository at this point in the history
  • Loading branch information
MHindermann committed Nov 19, 2024
1 parent aab2111 commit 80669ce
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 107 deletions.
140 changes: 59 additions & 81 deletions prompts.json
Original file line number Diff line number Diff line change
@@ -1,104 +1,82 @@
[
{
"prompt_id": "PROMPT-0001",
"title": "Creative Writing Starter",
"description": "Generate an engaging opening line for a short story.",
"category": "Creative Writing",
"models": ["GPT-4", "Bloom", "Cohere"],
"author": "Maxim",
"dcterms:identifier": "PROMPT-0001",
"dcterms:title": "Creative Writing Starter",
"dcterms:description": "Generate an engaging opening line for a short story. Expected output: A single sentence that hooks the reader.",
"dcterms:subject": "Creative Writing",
"dcterms:relation": ["gpt-3.5", "gpt-4"],
"dcterms:creator": "Maxim",
"prompt_text": "Write a compelling opening line for a short story.",
"expected_output": "A single sentence that hooks the reader.",
"use_case": "Storytelling",
"dcterms:type": "Storytelling",
"input_type": "Text",
"output_type": "Narrative",
"version_number": "v1.0",
"last_updated": "2024-11-19",
"license": "Creative Commons",
"dcterms:hasVersion": "v1.0",
"dcterms:modified": "2024-11-19",
"dcterms:rights": "Creative Commons",
"export_format": ["JSON", "YAML"]
},
{
"prompt_id": "PROMPT-0002",
"title": "Python Debugging Tips",
"description": "Provide common debugging strategies for Python code.",
"category": "Programming",
"models": ["GPT-4", "LLaMA", "Claude"],
"author": "Jane Doe",
"prompt_text": "Explain debugging techniques for Python code.",
"expected_output": "A list of 5-10 debugging techniques with brief descriptions.",
"use_case": "Educational Resource",
"input_type": "Text",
"output_type": "List",
"version_number": "v1.0",
"last_updated": "2024-11-20",
"license": "Open Source",
"export_format": ["JSON"]
},
{
"prompt_id": "PROMPT-0003",
"title": "Translate to French",
"description": "Translate an English paragraph to French.",
"category": "Translation",
"models": ["Mistral", "Flan-T5", "GPT-4"],
"author": "Marie Curie",
"prompt_text": "Translate the following paragraph into French: {text}",
"expected_output": "A grammatically correct and fluent French translation.",
"use_case": "Language Learning",
"input_type": "Text",
"dcterms:identifier": "PROMPT-0002",
"dcterms:title": "Extract Text from Image",
"dcterms:description": "Analyze an image and extract the text content embedded within it. Expected output: A plain text representation of the extracted text.",
"dcterms:subject": "Image Processing",
"dcterms:relation": ["ocr-model-v1", "ocr-model-v2"],
"dcterms:creator": "Jane Doe",
"prompt_text": "Given an image containing text, extract all textual content accurately.",
"dcterms:type": "Optical Character Recognition (OCR)",
"input_type": "Image",
"output_type": "Text",
"version_number": "v1.2",
"last_updated": "2024-11-18",
"license": "Creative Commons",
"export_format": ["JSON", "HTML"]
"dcterms:hasVersion": "v1.2",
"dcterms:modified": "2024-11-20",
"dcterms:rights": "Open Source License",
"export_format": ["JSON", "Plain Text"]
},
{
"prompt_id": "PROMPT-0004",
"title": "Summarize a News Article",
"description": "Generate a concise summary of a news article.",
"category": "Summarization",
"models": ["GPT-4", "LLaMA", "Claude"],
"author": "John Smith",
"dcterms:identifier": "PROMPT-0003",
"dcterms:title": "Summarize a News Article",
"dcterms:description": "Generate a concise summary of a news article in 3-5 sentences.",
"dcterms:subject": "Summarization",
"dcterms:relation": ["summary-model-v1"],
"dcterms:creator": "John Smith",
"prompt_text": "Summarize the following news article: {article}",
"expected_output": "A summary of 3-5 sentences capturing key points.",
"use_case": "News Analysis",
"dcterms:type": "News Analysis",
"input_type": "Text",
"output_type": "Text",
"version_number": "v2.0",
"last_updated": "2024-11-19",
"license": "Proprietary",
"dcterms:hasVersion": "v2.0",
"dcterms:modified": "2024-11-18",
"dcterms:rights": "Proprietary",
"export_format": ["JSON"]
},
{
"prompt_id": "PROMPT-0006",
"title": "Explain a Scientific Concept",
"description": "Provide a clear explanation of a scientific concept.",
"category": "Education",
"models": ["science", "education", "concepts"],
"author": "Isaac Newton",
"dcterms:identifier": "PROMPT-0004",
"dcterms:title": "Generate SQL Queries",
"dcterms:description": "Create SQL queries based on natural language instructions.",
"dcterms:subject": "Database Management",
"dcterms:relation": ["sql-query-gen-v1"],
"dcterms:creator": "Alice Johnson",
"prompt_text": "Write an SQL query to {task}.",
"dcterms:type": "Programming",
"input_type": "Text",
"output_type": "Code",
"dcterms:hasVersion": "v1.1",
"dcterms:modified": "2024-11-17",
"dcterms:rights": "Open Source License",
"export_format": ["JSON", "YAML"]
},
{
"dcterms:identifier": "PROMPT-0005",
"dcterms:title": "Explain a Scientific Concept",
"dcterms:description": "Provide a simple explanation of a scientific concept for beginners.",
"dcterms:subject": "Education",
"dcterms:relation": ["science-explain-v1"],
"dcterms:creator": "Isaac Newton",
"prompt_text": "Explain the concept of {concept} in simple terms.",
"expected_output": "A concise and easy-to-understand explanation of the concept.",
"use_case": "Educational Resource",
"dcterms:type": "Educational Resource",
"input_type": "Text",
"output_type": "Text",
"version_number": "v1.0",
"last_updated": "2024-11-15",
"license": "Creative Commons",
"dcterms:hasVersion": "v1.0",
"dcterms:modified": "2024-11-15",
"dcterms:rights": "Creative Commons",
"export_format": ["JSON", "Markdown"]
},
{
"prompt_id": "PROMPT-0007",
"title": "Generate a Meal Plan",
"description": "Create a weekly meal plan based on dietary preferences.",
"category": "Health",
"models": ["meal plan", "health", "diet"],
"author": "Julia Child",
"prompt_text": "Create a weekly meal plan for a {diet} diet.",
"expected_output": "A complete 7-day meal plan with breakfast, lunch, and dinner.",
"use_case": "Health and Wellness",
"input_type": "Text",
"output_type": "List",
"version_number": "v1.3",
"last_updated": "2024-11-16",
"license": "Proprietary",
"export_format": ["JSON", "PDF"]
}
]
61 changes: 35 additions & 26 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Fetch and render the prompts
async function fetchPrompts() {
try {
const response = await fetch('prompts.json');
Expand All @@ -9,35 +10,37 @@ async function fetchPrompts() {
window.allPrompts = prompts; // Store for filtering
} catch (error) {
console.error('Error loading prompts:', error);
document.querySelector('tbody').innerHTML = '<tr><td colspan="15">Error loading prompts.</td></tr>';
document.querySelector('tbody').innerHTML = '<tr><td colspan="14">Error loading prompts.</td></tr>';
}
}

// Render the prompts in a table
function displayTable(data) {
const tableBody = document.querySelector('#promptTable tbody');
tableBody.innerHTML = ''; // Clear previous rows
data.forEach(prompt => {
const row = document.createElement('tr');
row.innerHTML = `
<td>${prompt.prompt_id}</td>
<td>${prompt.title}</td>
<td>${prompt.description}</td>
<td>${prompt.category}</td>
<td>${prompt.models.join(', ')}</td>
<td>${prompt.author}</td>
<td>${prompt["dcterms:identifier"]}</td>
<td>${prompt["dcterms:title"]}</td>
<td>${prompt["dcterms:description"]}</td>
<td>${prompt["dcterms:subject"]}</td>
<td>${prompt["dcterms:relation"].join(', ')}</td>
<td>${prompt["dcterms:creator"]}</td>
<td>${prompt.prompt_text}</td>
<td>${prompt.use_case}</td>
<td>${prompt["dcterms:type"]}</td>
<td>${prompt.input_type}</td>
<td>${prompt.output_type}</td>
<td>${prompt.version_number}</td>
<td>${prompt.last_updated}</td>
<td>${prompt.license}</td>
<td>${prompt["dcterms:hasVersion"]}</td>
<td>${prompt["dcterms:modified"]}</td>
<td>${prompt["dcterms:rights"]}</td>
<td>${prompt.export_format.join(', ')}</td>
`;
tableBody.appendChild(row);
});
}

// Sort the table based on column index
function sortTable(columnIndex) {
const table = document.getElementById('promptTable');
const tbody = table.querySelector('tbody');
Expand Down Expand Up @@ -70,23 +73,29 @@ function sortTable(columnIndex) {
sortedRows.forEach(row => tbody.appendChild(row));
}

// Corrected filterPrompts function
function filterPrompts() {
const query = document.getElementById('search').value.toLowerCase();
const filtered = window.allPrompts.filter(prompt =>
prompt.title.toLowerCase().includes(query) ||
prompt.description.toLowerCase().includes(query) ||
prompt.category.toLowerCase().includes(query) ||
prompt.models.some(model => model.toLowerCase().includes(query)) ||
prompt.author.toLowerCase().includes(query) ||
prompt.prompt_text.toLowerCase().includes(query) ||
prompt.use_case.toLowerCase().includes(query) ||
prompt.input_type.toLowerCase().includes(query) ||
prompt.output_type.toLowerCase().includes(query) ||
prompt.version_number.toLowerCase().includes(query) ||
prompt.last_updated.toLowerCase().includes(query) ||
prompt.license.toLowerCase().includes(query) ||
prompt.export_format.some(format => format.toLowerCase().includes(query))
);

const filtered = window.allPrompts.filter(prompt => {
return (
(prompt["dcterms:identifier"]?.toLowerCase() || '').includes(query) ||
(prompt["dcterms:title"]?.toLowerCase() || '').includes(query) ||
(prompt["dcterms:description"]?.toLowerCase() || '').includes(query) ||
(prompt["dcterms:subject"]?.toLowerCase() || '').includes(query) ||
(prompt["dcterms:creator"]?.toLowerCase() || '').includes(query) ||
(prompt.prompt_text?.toLowerCase() || '').includes(query) ||
(prompt.input_type?.toLowerCase() || '').includes(query) ||
(prompt.output_type?.toLowerCase() || '').includes(query) ||
(prompt["dcterms:type"]?.toLowerCase() || '').includes(query) ||
(prompt["dcterms:hasVersion"]?.toLowerCase() || '').includes(query) ||
(prompt["dcterms:modified"]?.toLowerCase() || '').includes(query) ||
(prompt["dcterms:rights"]?.toLowerCase() || '').includes(query) ||
prompt["dcterms:relation"].some(model => model.toLowerCase().includes(query)) ||
prompt.export_format.some(format => format.toLowerCase().includes(query))
);
});

displayTable(filtered);
}

Expand Down

0 comments on commit 80669ce

Please sign in to comment.