Added temperature and max tokens controls to the Playground component.
Browse files
src/lib/components/Playground/Playground.svelte
CHANGED
@@ -19,6 +19,8 @@
|
|
19 |
let currentModel = compatibleModels[0];
|
20 |
let systemMessage: Message = { role: 'system', content: '' };
|
21 |
let messages: Message[] = startMessages;
|
|
|
|
|
22 |
|
23 |
let loading = false;
|
24 |
|
@@ -60,8 +62,8 @@
|
|
60 |
const out = await hf.chatCompletion({
|
61 |
model: currentModel,
|
62 |
messages: systemMessage.content ? [systemMessage, ...messages] : messages,
|
63 |
-
max_tokens:
|
64 |
-
temperature:
|
65 |
seed: 0
|
66 |
});
|
67 |
|
@@ -155,6 +157,11 @@
|
|
155 |
</div>
|
156 |
</div>
|
157 |
<div class="flex flex-col gap-6 overflow-hidden p-5">
|
158 |
-
<PlaygroundOptions
|
|
|
|
|
|
|
|
|
|
|
159 |
</div>
|
160 |
</div>
|
|
|
19 |
let currentModel = compatibleModels[0];
|
20 |
let systemMessage: Message = { role: 'system', content: '' };
|
21 |
let messages: Message[] = startMessages;
|
22 |
+
let temperature = 0.5;
|
23 |
+
let maxTokens = 32000;
|
24 |
|
25 |
let loading = false;
|
26 |
|
|
|
62 |
const out = await hf.chatCompletion({
|
63 |
model: currentModel,
|
64 |
messages: systemMessage.content ? [systemMessage, ...messages] : messages,
|
65 |
+
max_tokens: maxTokens,
|
66 |
+
temperature: temperature,
|
67 |
seed: 0
|
68 |
});
|
69 |
|
|
|
157 |
</div>
|
158 |
</div>
|
159 |
<div class="flex flex-col gap-6 overflow-hidden p-5">
|
160 |
+
<PlaygroundOptions
|
161 |
+
{compatibleModels}
|
162 |
+
bind:currentModel
|
163 |
+
bind:temperature
|
164 |
+
bind:maxTokens
|
165 |
+
/>
|
166 |
</div>
|
167 |
</div>
|
src/lib/components/Playground/PlaygroundOptions.svelte
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
<script lang="ts">
|
2 |
export let compatibleModels: string[] = [];
|
3 |
export let currentModel = compatibleModels[0];
|
|
|
|
|
4 |
</script>
|
5 |
|
6 |
<div>
|
@@ -20,29 +22,43 @@
|
|
20 |
</div>
|
21 |
<div>
|
22 |
<div class="flex items-center justify-between">
|
23 |
-
<label for="
|
24 |
>Temperature</label
|
25 |
>
|
26 |
-
<input
|
|
|
|
|
|
|
|
|
27 |
</div>
|
28 |
<input
|
29 |
-
id="
|
30 |
type="range"
|
31 |
-
value=
|
|
|
|
|
|
|
32 |
class="h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-black dark:bg-gray-700"
|
33 |
/>
|
34 |
</div>
|
35 |
<div>
|
36 |
<div class="flex items-center justify-between">
|
37 |
-
<label for="
|
38 |
>Max tokens</label
|
39 |
>
|
40 |
-
<input
|
|
|
|
|
|
|
|
|
41 |
</div>
|
42 |
<input
|
43 |
-
id="
|
44 |
type="range"
|
45 |
-
value=
|
|
|
|
|
|
|
46 |
class="h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-black dark:bg-gray-700"
|
47 |
/>
|
48 |
</div>
|
|
|
1 |
<script lang="ts">
|
2 |
export let compatibleModels: string[] = [];
|
3 |
export let currentModel = compatibleModels[0];
|
4 |
+
export let temperature = 0.5;
|
5 |
+
export let maxTokens = 32000;
|
6 |
</script>
|
7 |
|
8 |
<div>
|
|
|
22 |
</div>
|
23 |
<div>
|
24 |
<div class="flex items-center justify-between">
|
25 |
+
<label for="temperature-range" class="mb-2 block text-sm font-medium text-gray-900 dark:text-white"
|
26 |
>Temperature</label
|
27 |
>
|
28 |
+
<input
|
29 |
+
type="text"
|
30 |
+
class="w-12 rounded border px-1 py-0.5 text-right text-sm"
|
31 |
+
bind:value={temperature}
|
32 |
+
/>
|
33 |
</div>
|
34 |
<input
|
35 |
+
id="temperature-range"
|
36 |
type="range"
|
37 |
+
bind:value={temperature}
|
38 |
+
min="0"
|
39 |
+
max="1"
|
40 |
+
step="0.1"
|
41 |
class="h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-black dark:bg-gray-700"
|
42 |
/>
|
43 |
</div>
|
44 |
<div>
|
45 |
<div class="flex items-center justify-between">
|
46 |
+
<label for="max-tokens-range" class="mb-2 block text-sm font-medium text-gray-900 dark:text-white"
|
47 |
>Max tokens</label
|
48 |
>
|
49 |
+
<input
|
50 |
+
type="text"
|
51 |
+
class="w-16 rounded border px-1 py-0.5 text-right text-sm"
|
52 |
+
bind:value={maxTokens}
|
53 |
+
/>
|
54 |
</div>
|
55 |
<input
|
56 |
+
id="max-tokens-range"
|
57 |
type="range"
|
58 |
+
bind:value={maxTokens}
|
59 |
+
min="1"
|
60 |
+
max="32000"
|
61 |
+
step="1"
|
62 |
class="h-2 w-full cursor-pointer appearance-none rounded-lg bg-gray-200 accent-black dark:bg-gray-700"
|
63 |
/>
|
64 |
</div>
|