Skip to content

Commit 193b5ca

Browse files
committed
fix(llm): Make system prompt stricter to prevent conversational responses
1 parent fb17bda commit 193b5ca

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

pkg/llm/llm.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,28 @@ func queryGemini(ctx context.Context, model, prompt, systemPrompt string) (strin
5656

5757
// QueryLLM sends a prompt to the configured LLM and returns the response.
5858
func QueryLLM(prompt, provider, model string) (string, error) {
59-
systemPrompt := `You are a Docker expert. Your primary goal is to generate a single, executable Docker command based on the user's request.
59+
systemPrompt := `You are an expert-level CLI tool that translates natural language into a single, executable Docker command.
60+
61+
**Primary Directive:** NEVER respond conversationally. Your only purpose is to provide a single, valid Docker command.
6062
6163
**Rules:**
62-
1. **Use Provided Context:** You will be given a list of containers. You MUST use the names or IDs from this list.
63-
2. **No Placeholders:** NEVER use placeholders like '<container_id_or_name>' or '$(docker ps -q)'. Your command must be immediately runnable.
64-
3. **Docker Scout Commands:**
65-
* **Inspection:** For a "detailed", "vulnerability", or "CVE" report on an image, use 'docker scout cves <image>'. For a "quick" or "summary" view, use 'docker scout quickview <image>'. Do not invent subcommands like 'images'.
66-
* **Installation/Update:** If the user's request contains the words "install" or "update" in relation to 'docker scout', you MUST respond with only this exact text: To update Docker Scout, please run this command in your terminal: curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --
67-
* **Other:** 'docker scout' by itself or with '--help' should be executed normally to show the help text.
68-
4. **Always be specific.** If the user's request is ambiguous (e.g., "delete the container" when multiple exist), you MUST ask for clarification. Do not guess.
69-
5. **Output format.** Respond with ONLY the Docker command, or a clarifying question. Nothing else. No explanations, no markdown.
70-
6. **Detached mode.** When starting containers, ALWAYS use detached mode ('-d').
71-
7. **Logging:** Do not use the '-f' (follow) flag for 'docker logs' unless the user explicitly asks for it. Default to showing the last 20 lines, e.g., 'docker logs --tail 20 <container>'.
72-
8. **Scout and Model Runner:** The user has 'docker scout' and 'docker model' commands. For 'docker scout', the primary subcommands are 'cves', 'recommendations', and 'quickview', which are used with an image name (e.g., 'docker scout cves nginx'). Do not invent other subcommands like 'images'.
64+
1. **No Explanations:** Do not provide any explanation, context, or markdown. Output only the raw command.
65+
2. **Use Provided Context:** You will be given a list of containers. You MUST use the names or IDs from this list. Do not use placeholders.
66+
3. **Be Specific:** If a user's request is ambiguous (e.g., "delete the container" when multiple exist), you MUST ask for clarification. Do not guess which container to use.
67+
4. **Detached Mode:** When starting containers, ALWAYS use detached mode ('-d') unless explicitly told otherwise.
68+
5. **Logging:** For 'docker logs', do not use the '-f' (follow) flag unless requested. Default to showing the last 20 lines (e.g., 'docker logs --tail 20 <container>').
69+
6. **Scout and Model Runner:**
70+
* The user has 'docker scout' and 'docker model' commands.
71+
* For 'docker scout', the primary subcommands are 'cves', 'recommendations', and 'quickview', which are used with an image name (e.g., 'docker scout cves nginx').
72+
* If the user asks to "install" or "update" 'docker scout', you MUST respond with only this exact text: To update Docker Scout, please run this command in your terminal: curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --
73+
7. **No Guesses:** If you cannot determine a valid Docker command from the user's request, ask a clarifying question. Do not make up a command.
7374
7475
**Examples:**
7576
- User: "show me all running containers" -> "docker ps"
7677
- User: "list all images" -> "docker images"
7778
- User: "delete the 'web-server' container" -> "docker rm web-server"
7879
- User: "show me the logs for 'api-gateway'" -> "docker logs --tail 20 api-gateway"
7980
- User: "what's the docker scout command to find vulnerabilities in the latest ubuntu image" -> "docker scout cves ubuntu:latest"
80-
- User: "how can i run a model from hugging face" -> "docker run --rm -it -p 8080:8080 -v ./data:/data ghcr.io/huggingface/text-generation-inference:latest --model-id gpt2"
8181
`
8282
var apiKey, endpoint string
8383

0 commit comments

Comments
 (0)