diff --git a/.env b/.env index 30e23674203..4ea05e4633b 100644 --- a/.env +++ b/.env @@ -164,4 +164,6 @@ HF_ORG_EARLY_ACCESS= PUBLIC_SMOOTH_UPDATES=false COMMUNITY_TOOLS=false -PUBLIC_COMMIT_SHA= \ No newline at end of file +PUBLIC_COMMIT_SHA= + +PROMPT_EXAMPLES=`[]` \ No newline at end of file diff --git a/chart/env/prod.yaml b/chart/env/prod.yaml index c7b483b6bb2..bbde51ff75a 100644 --- a/chart/env/prod.yaml +++ b/chart/env/prod.yaml @@ -57,21 +57,7 @@ envVars: "temperature": 0.6, "max_new_tokens": 1024, "truncate": 7167 - }, - "promptExamples": [ - { - "title": "Write an email from bullet list", - "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)" - }, - { - "title": "Code a snake game", - "prompt": "Code a basic snake game in python, give explanations for each step." - }, - { - "title": "Assist in a task", - "prompt": "How do I make a delicious lemon cheesecake?" - } - ] + } }, { "name": "CohereForAI/c4ai-command-r-plus-08-2024", @@ -86,21 +72,7 @@ envVars: "truncate": 28672, "max_new_tokens": 2048, "temperature": 0.3 - }, - "promptExamples": [ - { - "title": "Generate a mouse portrait", - "prompt": "Generate the portrait of a scientific mouse in its laboratory." - }, - { - "title": "Review a pull request", - "prompt": "Review this pull request: https://github.com/huggingface/chat-ui/pull/1131/files" - }, - { - "title": "Code a snake game", - "prompt": "Code a basic snake game in python, give explanations for each step." - } - ] + } }, { "name": "Qwen/Qwen2.5-72B-Instruct", @@ -115,21 +87,7 @@ envVars: "temperature": 0.6, "truncate": 28672, "max_new_tokens": 3072 - }, - "promptExamples": [ - { - "title": "Write an email from bullet list", - "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)" - }, - { - "title": "Code a snake game", - "prompt": "Code a basic snake game in python, give explanations for each step." - }, - { - "title": "Assist in a task", - "prompt": "How do I make a delicious lemon cheesecake?" - } - ] + } }, { "name": "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF", @@ -228,20 +186,6 @@ envVars: "websiteUrl": "https://nousresearch.com/", "modelUrl": "https://huggingface.co/NousResearch/Hermes-3-Llama-3.1-8B", "tokenizer": "NousResearch/Hermes-3-Llama-3.1-8B", - "promptExamples": [ - { - "title": "Write an email from bullet list", - "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)" - }, - { - "title": "Code a snake game", - "prompt": "Code a basic snake game in python, give explanations for each step." - }, - { - "title": "Assist in a task", - "prompt": "How do I make a delicious lemon cheesecake?" - } - ], "parameters": { "stop": ["<|im_end|>"], "temperature": 0.6, @@ -263,21 +207,7 @@ envVars: "temperature": 0.6, "truncate": 14336, "max_new_tokens": 1536 - }, - "promptExamples": [ - { - "title": "Write an email from bullet list", - "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)" - }, - { - "title": "Code a snake game", - "prompt": "Code a basic snake game in python, give explanations for each step." - }, - { - "title": "Assist in a task", - "prompt": "How do I make a delicious lemon cheesecake?" - } - ] + } }, { "name": "microsoft/Phi-3.5-mini-instruct", @@ -292,21 +222,7 @@ envVars: "temperature": 0.6, "truncate": 28672, "max_new_tokens": 3072 - }, - "promptExamples": [ - { - "title": "Write an email from bullet list", - "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)" - }, - { - "title": "Code a snake game", - "prompt": "Code a basic snake game in python, give explanations for each step." - }, - { - "title": "Assist in a task", - "prompt": "How do I make a delicious lemon cheesecake?" - } - ] + } }, { "name": "llhf/Meta-Llama-3.1-8B-Instruct", @@ -364,6 +280,33 @@ envVars: "transferTo": "microsoft/Phi-3.5-mini-instruct" } ] + PROMPT_EXAMPLES: > + [ + { + "title": "Write an email from bullet list", + "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)" + }, + { + "title": "Code a snake game", + "prompt": "Code a basic snake game in python, give explanations for each step." + }, + { + "title": "Assist in a task", + "prompt": "How do I make a delicious lemon cheesecake?" + }, + { + "type": "multimodal", + "title": "Identify a flower", + "prompt": "What kind of flower is this?", + "fileUrl": "https://huggingface.co/datasets/huggingchat/prompt-examples/resolve/main/flower.jpg" + }, + { + "type": "tool", + "title": "Generate a painting", + "prompt": "Generate a painting of a forest, oil painting style.", + "toolId": "000000000000000000000001" + } + ] PUBLIC_ORIGIN: "https://huggingface.co" PUBLIC_SHARE_PREFIX: "https://hf.co/chat" PUBLIC_ANNOUNCEMENT_BANNERS: > diff --git a/src/lib/components/chat/ChatIntroduction.svelte b/src/lib/components/chat/ChatIntroduction.svelte index 36a3fc9c124..f95a10d1564 100644 --- a/src/lib/components/chat/ChatIntroduction.svelte +++ b/src/lib/components/chat/ChatIntroduction.svelte @@ -8,14 +8,31 @@ import ModelCardMetadata from "../ModelCardMetadata.svelte"; import { base } from "$app/paths"; import JSON5 from "json5"; + import type { PromptExample } from "$lib/server/promptExamples"; + + import CarbonImage from "~icons/carbon/image"; + import CarbonTools from "~icons/carbon/tools"; export let currentModel: Model; + export let promptExamples: PromptExample[]; const announcementBanners = envPublic.PUBLIC_ANNOUNCEMENT_BANNERS ? JSON5.parse(envPublic.PUBLIC_ANNOUNCEMENT_BANNERS) : []; - const dispatch = createEventDispatcher<{ message: string }>(); + const dispatch = createEventDispatcher<{ + message: { + prompt: string; + file?: File | string; + tool?: string; + }; + }>(); + + const prompts = promptExamples + .filter((prompt: PromptExample) => prompt?.models?.includes(currentModel.id) ?? true) + .filter(Boolean) + .sort(() => Math.random() - 0.5) + .slice(0, 3) as PromptExample[];
Examples
+Examples