From fd8c3f6ef104a02329123e823e376cbbf3bda464 Mon Sep 17 00:00:00 2001 From: Jim Clark Date: Thu, 4 Jul 2024 12:44:01 -0700 Subject: [PATCH] docker_scout_recommendation function --- .gitignore | 2 + prompts/dockerfiles/README.md | 2 +- prompts/{ => functions}/codescope/.envrc | 0 prompts/{ => functions}/codescope/Dockerfile | 0 .../{ => functions}/codescope/clipboard.nix | 0 .../{ => functions}/codescope/derivation.nix | 0 prompts/{ => functions}/codescope/flake.lock | 0 prompts/{ => functions}/codescope/flake.nix | 0 prompts/{ => functions}/codescope/runbook.md | 0 .../docker_scout_tag_recommendation/.envrc | 1 + .../Dockerfile | 36 ++++++ .../docker_scout_tag_recommendation/README.md | 35 ++++++ .../flake.lock | 116 ++++++++++++++++++ .../docker_scout_tag_recommendation/flake.nix | 61 +++++++++ .../docker_scout_tag_recommendation/init.clj | 26 ++++ .../runbook.md | 27 ++++ prompts/src/openai.clj | 6 +- prompts/src/prompts.clj | 4 +- 18 files changed, 310 insertions(+), 6 deletions(-) rename prompts/{ => functions}/codescope/.envrc (100%) rename prompts/{ => functions}/codescope/Dockerfile (100%) rename prompts/{ => functions}/codescope/clipboard.nix (100%) rename prompts/{ => functions}/codescope/derivation.nix (100%) rename prompts/{ => functions}/codescope/flake.lock (100%) rename prompts/{ => functions}/codescope/flake.nix (100%) rename prompts/{ => functions}/codescope/runbook.md (100%) create mode 100644 prompts/functions/docker_scout_tag_recommendation/.envrc create mode 100644 prompts/functions/docker_scout_tag_recommendation/Dockerfile create mode 100644 prompts/functions/docker_scout_tag_recommendation/README.md create mode 100644 prompts/functions/docker_scout_tag_recommendation/flake.lock create mode 100644 prompts/functions/docker_scout_tag_recommendation/flake.nix create mode 100644 prompts/functions/docker_scout_tag_recommendation/init.clj create mode 100644 prompts/functions/docker_scout_tag_recommendation/runbook.md diff --git a/.gitignore b/.gitignore index 0a37de2..2624516 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ node_modules *.vsix /.clj-kondo/ /.lsp/ +**/.direnv/ +**/result /prompts/prompts.jar /prompts/codescope/.direnv/ /prompts/codescope/result diff --git a/prompts/dockerfiles/README.md b/prompts/dockerfiles/README.md index fb7219e..5c5f962 100644 --- a/prompts/dockerfiles/README.md +++ b/prompts/dockerfiles/README.md @@ -42,7 +42,7 @@ functions: type: string description: the name docker image repository container: - image: vonwig/function_docker_scout_tag_recommendations:latest + image: vonwig/function_docker_scout_tag_recommendation:latest --- # Background diff --git a/prompts/codescope/.envrc b/prompts/functions/codescope/.envrc similarity index 100% rename from prompts/codescope/.envrc rename to prompts/functions/codescope/.envrc diff --git a/prompts/codescope/Dockerfile b/prompts/functions/codescope/Dockerfile similarity index 100% rename from prompts/codescope/Dockerfile rename to prompts/functions/codescope/Dockerfile diff --git a/prompts/codescope/clipboard.nix b/prompts/functions/codescope/clipboard.nix similarity index 100% rename from prompts/codescope/clipboard.nix rename to prompts/functions/codescope/clipboard.nix diff --git a/prompts/codescope/derivation.nix b/prompts/functions/codescope/derivation.nix similarity index 100% rename from prompts/codescope/derivation.nix rename to prompts/functions/codescope/derivation.nix diff --git a/prompts/codescope/flake.lock b/prompts/functions/codescope/flake.lock similarity index 100% rename from prompts/codescope/flake.lock rename to prompts/functions/codescope/flake.lock diff --git a/prompts/codescope/flake.nix b/prompts/functions/codescope/flake.nix similarity index 100% rename from prompts/codescope/flake.nix rename to prompts/functions/codescope/flake.nix diff --git a/prompts/codescope/runbook.md b/prompts/functions/codescope/runbook.md similarity index 100% rename from prompts/codescope/runbook.md rename to prompts/functions/codescope/runbook.md diff --git a/prompts/functions/docker_scout_tag_recommendation/.envrc b/prompts/functions/docker_scout_tag_recommendation/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/prompts/functions/docker_scout_tag_recommendation/.envrc @@ -0,0 +1 @@ +use flake diff --git a/prompts/functions/docker_scout_tag_recommendation/Dockerfile b/prompts/functions/docker_scout_tag_recommendation/Dockerfile new file mode 100644 index 0000000..b515080 --- /dev/null +++ b/prompts/functions/docker_scout_tag_recommendation/Dockerfile @@ -0,0 +1,36 @@ + +# syntax = docker/dockerfile:1.4 +FROM nixos/nix:2.21.1@sha256:3f6c77ee4d2c82e472e64e6cd7087241dc391421a0b42c22e6849c586d5398d9 AS builder + +WORKDIR /tmp/build +RUN mkdir /tmp/nix-store-closure + +# ignore SC2046 because the output of nix-store -qR will never have spaces - this is safe here +# hadolint ignore=SC2046 +RUN --mount=type=cache,target=/nix,from=nixos/nix:2.21.1,source=/nix \ + --mount=type=cache,target=/root/.cache \ + --mount=type=bind,target=/tmp/build \ + <! c {:content output :role "tool" :tool_call_id tool-call-id}) (async/close! c))) :fail (fn [output] - (jsonrpc/notify :message {:content (format "## ROLE tool\n function call %s failed %s" function-name output)}) + (jsonrpc/notify :message {:content (format "\n## ROLE tool\n function call %s failed %s" function-name output)}) (async/go (async/>! c {:content output :role "tool" :tool_call_id tool-call-id}) (async/close! c)))}) diff --git a/prompts/src/prompts.clj b/prompts/src/prompts.clj index 68eb394..d3c9d32 100644 --- a/prompts/src/prompts.clj +++ b/prompts/src/prompts.clj @@ -209,10 +209,10 @@ (let [{:keys [messages finish-reason] :as m} (async/