X-Git-Url: https://git.giacomolli.uk/onechat/blobdiff_plain/2532718d5288e1a2586fe5716cc41bb2a0210e16..4a605fa39078354654ae648e489c117c7a445197:/prompt_test.go diff --git a/prompt_test.go b/prompt_test.go index 3e66fde..4c88ad8 100644 --- a/prompt_test.go +++ b/prompt_test.go @@ -11,7 +11,7 @@ import ( ) func TestPromptNamesTheAgent(t *testing.T) { - text := prompt("Ada") + text := prompt("Ada", "") require.Contains(t, text, "You are Ada, an AI agent") require.Contains(t, text, "- reply: Ada's replies") require.Contains(t, text, "Goal: let Ada work later") @@ -24,12 +24,28 @@ func TestPromptNamesTheAgent(t *testing.T) { } func TestPromptLeavesOutAbsentFeatures(t *testing.T) { - text := prompt("Ada") + text := prompt("Ada", "") for _, absent := range []string{"image", "ubagent", "computer", "device", `zoom("Name")`, "instructions at the end"} { require.NotContains(t, text, absent) } } +func TestPromptEndsWithTheInstructions(t *testing.T) { + text := prompt("Ada", "\nI am Lena. Keep replies short.\n\n") + require.Contains(t, text, `Do the user's tasks yourself, with your tools, following the user's instructions +at the end of this prompt: who they are, how their files are organized and how +they want work done.`) + require.True(t, strings.HasSuffix(text, "\n\n# The user's instructions\n\nI am Lena. Keep replies short.")) +} + +func TestPromptWithoutInstructionsHasNoClause(t *testing.T) { + for _, instructions := range []string{"", " \n\t"} { + text := prompt("Ada", instructions) + require.Contains(t, text, "Do the user's tasks yourself, with your tools.\n") + require.NotContains(t, text, "instructions") + } +} + func TestAgentToolsAreStrictAndStable(t *testing.T) { tools := agentTools() require.Equal(t, []string{"zoom", "date"}, []string{tools[0].Name, tools[1].Name})