๐Ÿ“ฆ sleepyfran / duets

๐Ÿ“„ CommonPrompts.fs ยท 26 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26namespace Duets.Cli.Text.Prompts

open Duets.Common
open Duets.Entities

[<RequireQualifiedAccess>]
module Common =
    /// Creates a prompt that improves the response quality of the language model.
    /// Currently tuned for Gemma 3, which requires explicit turn markers to get
    /// anything useful out of it.
    let internal createPrompt prompt =
        $"""
    <start_of_turn>user
    {prompt}
    <end_of_turn>
    <start_of_turn>model
    """

    let internal itemNameForPrompt item =
        let mainProperty = item.Properties |> List.head

        match mainProperty with
        | Key(EntranceCard _) -> "entrance card"
        | Rideable(RideableItem.Car _) -> $"{item.Brand} {item.Name}"
        | _ -> item.Name |> String.lowercase