diff --git a/README.md b/README.md index 6fdf996..5a45b5d 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ a GitHub ref. For example, to test some local prompts in a directory named `my_ docker run --rm \ -v /var/run/docker.sock:/var/run/docker.sock \ --mount type=bind,source=$PWD,target=/app/my_prompts \ - --workdir /app + --workdir /app \ vonwig/prompts:latest $PWD \ jimclark106 \ darwin \ @@ -61,7 +61,7 @@ docker run --rm \ -it \ -v /var/run/docker.sock:/var/run/docker.sock \ --mount type=bind,source=$PROMPTS_DIR,target=/app/my_prompts \ - --workdir /app + --workdir /app \ --mount type=volume,source=docker-prompts,target=/prompts \ --mount type=bind,source=$HOME/.openai-api-key,target=/root/.openai-api-key \ vonwig/prompts:latest \ diff --git a/prompts/dockerfiles/README.md b/prompts/dockerfiles/README.md index b9aee70..eaec3bc 100644 --- a/prompts/dockerfiles/README.md +++ b/prompts/dockerfiles/README.md @@ -11,7 +11,7 @@ functions: - name: analyze_project description: Analyze a project to determine how it should be built type: prompt - ref: project_type + ref: github:docker/labs-ai-tools-for-devs?ref=main&path=prompts/project_type - name: write_files description: Write a set of files to my project parameters: diff --git a/src/prompts.clj b/src/prompts.clj index 26aa590..914f27e 100644 --- a/src/prompts.clj +++ b/src/prompts.clj @@ -178,6 +178,8 @@ (into []))] (map (comp merge-role renderer fs/file) prompts))) +(declare conversation-loop) + (defn function-handler "call function params @@ -207,9 +209,17 @@ (resolve pty-output) (fail (format "call exited with non-zero code (%d): %s" exit-code pty-output)))) (= "prompt" (:type definition)) ;; asynchronous call to another agent - (do - ;; TODO use the assistant here - (resolve "This is an NPM project."))) + (let [{:keys [messages _finish-reason] :as m} + (async/> messages + (filter #(= "assistant" (:role %))) + (last) + :content)))) (catch Throwable t (fail (format "system failure %s" t)))) (fail "no function found"))) @@ -240,14 +250,15 @@ [& args] (async/go-loop [prompts (apply get-prompts args)] - (let [{:keys [messages finish-reason] :as m} (async/