Skip to content

Commit ad79c32

Browse files
committed
feat: alow to show model metrics in playground
Signed-off-by: Evzen Gasta <[email protected]>
1 parent 9421e61 commit ad79c32

File tree

4 files changed

+56
-5
lines changed

4 files changed

+56
-5
lines changed

packages/backend/src/assets/inference-images.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"default": "ghcr.io/containers/whispercpp@sha256:6c529656529da7aba851b6ab2d0653f23b77b9ca3c11cb46db47ff6dbd6d5e7c"
44
},
55
"llamacpp": {
6-
"default": "ghcr.io/containers/podman-desktop-extension-ai-lab-playground-images/ai-lab-playground-chat@sha256:20734e9d60f047d27e4c9cf6a3b663e0627d48bd06d0a73b968f9d81c82de2f1",
7-
"cuda": "ghcr.io/containers/podman-desktop-extension-ai-lab-playground-images/ai-lab-playground-chat-cuda@sha256:798acced911527254601d0e39a90c5a29ecad82755f28594bea9a587ea9e6043",
8-
"vulkan": "ghcr.io/containers/podman-desktop-extension-ai-lab-playground-images/ai-lab-playground-chat-vulkan@sha256:22e11661fe66ace7c30b419703305b803eb937da10e19c23cb6767f03578256c"
6+
"default": "ghcr.io/containers/podman-desktop-extension-ai-lab-playground-images/ai-lab-playground-chat@sha256:2eb6cd7a4c4f76e54eeb88465281f4ff2a8f7b7e49db893a579a8f6842f69eb1",
7+
"cuda": "ghcr.io/containers/podman-desktop-extension-ai-lab-playground-images/ai-lab-playground-chat-cuda@sha256:e4b57e52c31b379b4a73f8e9536bc130fdea665d88dbd05643350295b3402a2f",
8+
"vulkan": "ghcr.io/containers/podman-desktop-extension-ai-lab-playground-images/ai-lab-playground-chat-vulkan@sha256:6a93b247099643f4f8c78ee9896c2ce4e9a455af114a69be09c16ad36aa51fd2"
99
}
1010
}

packages/backend/src/managers/playgroundV2Manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export class PlaygroundV2Manager implements Disposable {
208208
throw new Error(
209209
`modelId '${conversation.modelId}' is not available on the inference server, valid model ids are: ${server.models.map(model => model.id).join(', ')}.`,
210210
);
211-
211+
console.error(options)
212212
this.#conversationRegistry.submit(conversation.id, {
213213
content: userInput,
214214
options: options,
@@ -303,7 +303,7 @@ export class PlaygroundV2Manager implements Disposable {
303303
id: messageId,
304304
timestamp: start,
305305
} as PendingChat);
306-
306+
console.log(stream)
307307
for await (const chunk of stream) {
308308
this.#conversationRegistry.appendChoice(conversationId, messageId, {
309309
content: chunk.choices[0]?.delta?.content ?? '',

packages/frontend/src/pages/Playground.svelte

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ $: {
5454
} else {
5555
sendEnabled = true;
5656
}
57+
console.error(conversation)
5758
}
5859
$: server = $inferenceServers.find(is => conversation && is.models.map(mi => mi.id).includes(conversation?.modelId));
5960
function askPlayground(): void {
@@ -64,6 +65,7 @@ function askPlayground(): void {
6465
temperature,
6566
max_tokens,
6667
top_p,
68+
stream_options: {include_usage: true},
6769
})
6870
.then(token => {
6971
cancellationTokenId = token;
@@ -263,6 +265,50 @@ function handleOnClick(): void {
263265
</div>
264266
</svelte:fragment>
265267
</ContentDetailsLayout>
268+
269+
<ContentDetailsLayout detailsTitle="Model Metrics" detailsLabel="model metrics">
270+
<svelte:fragment slot="details">
271+
<div
272+
class="bg-[var(--pd-content-card-inset-bg)] text-[var(--pd-content-card-text)] w-full rounded-md p-4">
273+
<div class="flex flex-col space-y-4" aria-label="metrics">
274+
<div class="flex flex-row">
275+
<div class="w-full">
276+
Lorem
277+
<div class="flex flex-row">
278+
Ipsum
279+
</div>
280+
</div>
281+
<Tooltip left>
282+
<Fa class="text-[var(--pd-content-card-icon)]" icon={faCircleInfo} />
283+
<svelte:fragment slot="tip">
284+
<div class="inline-block py-2 px-4 rounded-md" aria-label="tooltip">
285+
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output
286+
more random, while lower values like 0.2 will make it more focused and deterministic.
287+
</div>
288+
</svelte:fragment>
289+
</Tooltip>
290+
</div>
291+
<div class="flex flex-row">
292+
<div class="w-full">
293+
Lorem1
294+
<div class="flex flex-row">
295+
Ipsum2
296+
</div>
297+
</div>
298+
<Tooltip left>
299+
<Fa class="text-[var(--pd-content-card-icon)]" icon={faCircleInfo} />
300+
<svelte:fragment slot="tip">
301+
<div class="inline-block py-2 px-4 rounded-md" aria-label="tooltip">
302+
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output
303+
more random, while lower values like 0.2 will make it more focused and deterministic.
304+
</div>
305+
</svelte:fragment>
306+
</Tooltip>
307+
</div>
308+
</div>
309+
</div>
310+
</svelte:fragment>
311+
</ContentDetailsLayout>
266312
</div>
267313
{#if errorMsg}
268314
<div class="text-[var(--pd-input-field-error-text)] p-2">{errorMsg}</div>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
interface StreamOptions {
2+
include_usage?: boolean;
3+
}
4+
15
export interface ModelOptions {
26
temperature?: number;
37
max_tokens?: number;
48
top_p?: number;
9+
stream_options?: StreamOptions,
510
}

0 commit comments

Comments
 (0)