Skip to content

Commit c5e5155

Browse files
add yaml parse error message
1 parent 5410cd5 commit c5e5155

File tree

17 files changed

+363
-131
lines changed

17 files changed

+363
-131
lines changed

dev/conversations_t.clj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
:prompts (fs/file "/Users/slim/docker/labs-ai-tools-for-devs/prompts/curl/README.md")
1111
:host-dir "/Users/slim/vonwig/altaservice"})
1212

13-
(alter-var-root
14-
#'jsonrpc/notify
15-
(fn [_] (partial (if (:jsonrpc opts) jsonrpc/-notify jsonrpc/-println) opts)))
16-
1713
(try
1814
(main/with-options opts ["run"])
1915
(catch Throwable t

graphs/prompts/journals/2024_11_21.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
- `revo` for graphql/rag and fine-grained data access
2+
- bismuth
3+
- ratatui rust cli
4+
- paige
5+
- agents building infrastructure was super interesting
6+
- > if you ask a really concise question, you'll get many fewer questions for clarification
7+
- tinfoil
8+
- attestations
9+
- nvidia gpus now shipping with gpms
10+
- confidentiality
11+
- enclaves
12+
- aws nitro hypervisors
13+
-

graphs/prompts/journals/2024_11_22.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [[br]]
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
- Run some prompts checked in to GitHub against a project in the current working directory.
2+
id:: 66d779c7-c1b7-40c6-a635-fa712da492de
3+
```sh
4+
docker run
5+
--rm -it \
6+
--pull=always \
7+
-v /var/run/docker.sock:/var/run/docker.sock \
8+
-v /run/host-services/backend.sock:/host-services/docker-desktop-backend.sock \
9+
-e "DOCKER_DESKTOP_SOCKET_PATH=/host-services/docker-desktop-backend.sock" \
10+
--mount type=volume,source=docker-prompts,target=/prompts \
11+
-e "OPENAI_API_KEY_LOCATION=/root" \
12+
--mount type=bind,source=$HOME/.openai-api-key,target=/root/.openai-api-key \
13+
vonwig/prompts:latest \
14+
run \
15+
--host-dir $PWD \
16+
--platform $(uname -o) \
17+
--prompts "github:docker/labs-make-runbook?ref=main&path=prompts/lazy_docker"
18+
```
19+
- Most of this is boiler plate except:
20+
- the `--user` option in line 10 requires a valid DOCKER_HUB user name
21+
- the `--prompts` option in line 12 requires a valid [github reference]([[GitHub Refs]]) to some markdown prompts
22+
- if the project is located somewhere other than $PWD then the `--host-dir` will need to be updated.
23+
- Run a local prompt markdown file against a project in the current working directory. In this example, the prompts are not pulled from GitHub. Instead, our prompts are being developed in a directory called `$PROMPTS_DIR`. In this example, the local prompt file is `$PROMPTS_DIR/myprompts.md`.
24+
id:: 66d77f1b-1684-480d-ad7b-5e9f53292fe4
25+
```sh
26+
docker run
27+
--rm -it \
28+
--pull=always \
29+
-v /var/run/docker.sock:/var/run/docker.sock \
30+
-v /run/host-services/backend.sock:/host-services/docker-desktop-backend.sock \
31+
-e "DOCKER_DESKTOP_SOCKET_PATH=/host-services/docker-desktop-backend.sock" \
32+
--mount type=volume,source=docker-prompts,target=/prompts \
33+
-e "OPENAI_API_KEY_LOCATION=/root" \
34+
--mount type=bind,source=$HOME/.openai-api-key,target=/root/.openai-api-key \
35+
--mount type=bind,source=$PROMPTS_DIR,target=/app/workdir \
36+
--workdir /app/workdir \
37+
vonwig/prompts:latest \
38+
run \
39+
--host-dir $PWD \
40+
--platform $(uname -o) \
41+
--prompts-file myprompts.md
42+
```
43+
- Most of this is boiler plate except:
44+
- the `--user` option in line 12 requires a valid DOCKER_HUB user name
45+
- the `--prompts-file` option in line 14 is a relative path to a prompts file (relative to $PROMPTS_DIR)
46+
- if the project being analyzed is located somewhere other than $PWD then the `--host-dir` will need to be updated.
47+
- [[Running the Prompt Engine]]
48+
- [[Authoring Prompts]]
49+
- id:: 66d7f3ff-8769-40b3-b6b5-fc4fceea879e
50+
```
51+
---
52+
extractors:
53+
- name: linguist
54+
image: vonwig/go-linguist:latest
55+
command:
56+
- -json
57+
output-handler: linguist
58+
tools:
59+
- name: findutils-by-name
60+
description: find files in a project by name
61+
parameters:
62+
type: object
63+
properties:
64+
glob:
65+
type: string
66+
description: the glob pattern for files that should be found
67+
container:
68+
image: vonwig/findutils:latest
69+
command:
70+
- find
71+
- .
72+
- -name
73+
model: llama3.1
74+
url: http://localhost/v1/chat/completions
75+
stream: false
76+
---
77+
78+
# Prompt system
79+
80+
You are an expert on analyzing project content.
81+
82+
# Prompt user
83+
84+
{{#linguist}}
85+
This project contains {{language}} code.
86+
{{/linguist}}
87+
88+
Can you find any language specific project files and list them?
89+
```
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
- Run some prompts checked in to GitHub against a project in the current working directory.
2+
id:: 66d779c7-c1b7-40c6-a635-fa712da492de
3+
```sh
4+
docker run
5+
--rm -it \
6+
--pull=always \
7+
-v /var/run/docker.sock:/var/run/docker.sock \
8+
-v /run/host-services/backend.sock:/host-services/docker-desktop-backend.sock \
9+
-e "DOCKER_DESKTOP_SOCKET_PATH=/host-services/docker-desktop-backend.sock" \
10+
--mount type=volume,source=docker-prompts,target=/prompts \
11+
-e "OPENAI_API_KEY_LOCATION=/root" \
12+
--mount type=bind,source=$HOME/.openai-api-key,target=/root/.openai-api-key \
13+
vonwig/prompts:latest \
14+
run \
15+
--host-dir $PWD \
16+
--platform $(uname -o) \
17+
--prompts "github:docker/labs-make-runbook?ref=main&path=prompts/lazy_docker"
18+
```
19+
- Most of this is boiler plate except:
20+
- the `--user` option in line 10 requires a valid DOCKER_HUB user name
21+
- the `--prompts` option in line 12 requires a valid [github reference]([[GitHub Refs]]) to some markdown prompts
22+
- if the project is located somewhere other than $PWD then the `--host-dir` will need to be updated.
23+
- Run a local prompt markdown file against a project in the current working directory. In this example, the prompts are not pulled from GitHub. Instead, our prompts are being developed in a directory called `$PROMPTS_DIR`. In this example, the local prompt file is `$PROMPTS_DIR/myprompts.md`.
24+
id:: 66d77f1b-1684-480d-ad7b-5e9f53292fe4
25+
```sh
26+
docker run
27+
--rm -it \
28+
--pull=always \
29+
-v /var/run/docker.sock:/var/run/docker.sock \
30+
-v /run/host-services/backend.sock:/host-services/docker-desktop-backend.sock \
31+
-e "DOCKER_DESKTOP_SOCKET_PATH=/host-services/docker-desktop-backend.sock" \
32+
--mount type=volume,source=docker-prompts,target=/prompts \
33+
-e "OPENAI_API_KEY_LOCATION=/root" \
34+
--mount type=bind,source=$HOME/.openai-api-key,target=/root/.openai-api-key \
35+
--mount type=bind,source=$PROMPTS_DIR,target=/app/workdir \
36+
--workdir /app/workdir \
37+
vonwig/prompts:latest \
38+
run \
39+
--host-dir $PWD \
40+
--platform $(uname -o) \
41+
--prompts-file myprompts.md
42+
```
43+
- Most of this is boiler plate except:
44+
- the `--user` option in line 12 requires a valid DOCKER_HUB user name
45+
- the `--prompts-file` option in line 14 is a relative path to a prompts file (relative to $PROMPTS_DIR)
46+
- if the project being analyzed is located somewhere other than $PWD then the `--host-dir` will need to be updated.
47+
- [[Running the Prompt Engine]]
48+
- [[Authoring Prompts]]
49+
- ---
50+
id:: 66d7f3ff-8769-40b3-b6b5-fc4fceea879e
51+
extractors:
52+
- name: linguist
53+
image: vonwig/go-linguist:latest
54+
command:
55+
- -json
56+
output-handler: linguist
57+
tools:
58+
- name: findutils-by-name
59+
description: find files in a project by name
60+
parameters:
61+
type: object
62+
properties:
63+
glob:
64+
type: string
65+
description: the glob pattern for files that should be found
66+
container:
67+
image: vonwig/findutils:latest
68+
command:
69+
- find
70+
- .
71+
- -name
72+
model: llama3.1
73+
url: http://localhost/v1/chat/completions
74+
stream: false
75+
---
76+
77+
# Prompt system
78+
79+
You are an expert on analyzing project content.
80+
81+
# Prompt user
82+
83+
{{#linguist}}
84+
This project contains {{language}} code.
85+
{{/linguist}}
86+
87+
Can you find any language specific project files and list them?
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Prompt files
2+
The simplest prompt file is just markdown content. We use `h1` headers to delineate the blocks containing prompts and the name of the header to determine the prompt role.
3+
A prompt file can also contain metadata about how to generate and run the prompt.
4+
{{embed ((66d7f3ff-8769-40b3-b6b5-fc4fceea879e)) }}
5+
The example above defines a lot of metadata. A prompt file might also be very simple.
6+
{{embed ((66d8a396-9268-4917-882f-da4c52b7b5dd)) }}
7+
Use the [prompt engine]([[Running the Prompt Engine]]) to run this prompt file against an LLM.
8+
- ## Prompt Metadata
9+
-

graphs/prompts/pages/volumes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- Volumes are managed by the top-level container. In other words, we construct them as we need them.
2+
- the `--thread-id` allows the user of the prompt engine to control the names of the volume
3+
- by default, tool containers will be started with at least one volume mounted at `/thread`

prompts/examples/empty-tools.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Summary
2+
3+
This prompt defines no tools. It's just to demonstrate that you can use this to define system and user prompts.
4+
5+
# prompt system
6+
7+
You try to start every sentence with the letter 'a'.
8+
9+
# prompt user
10+
11+
Can you give me a quick summary of the NASA space program?

prompts/examples/no-prompts.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Summary
2+
3+
There are no prompts or tools in this file. The engine should complain.

prompts/sql/prompt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tools:
1313
type: string
1414
description: a human description of the query we need to run
1515
type: "prompt"
16-
prompt: sql-agent.md
16+
prompt: github:docker/labs-ai-tools-for-devs?path=prompts/sql/sql-agent.md
1717
host-dir: /Users/slim/docker/labs-ai-tools-for-devs/prompts/sql # override host-dir while testing
1818
---
1919

src/docker.clj

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
[cheshire.core :as json]
66
[clojure.core.async :as async]
77
[clojure.pprint :refer [pprint]]
8-
[clojure.spec.alpha :as spec]
98
[clojure.string :as string]
109
[creds]
1110
jsonrpc
12-
logging)
11+
logging
12+
schema)
1313
(:import
1414
[java.net UnixDomainSocketAddress]
1515
[java.nio ByteBuffer]
@@ -225,25 +225,6 @@
225225
"--vs-machine-id" "none"
226226
"--workspace" "/docker"]})
227227

228-
(spec/def ::host-dir string?)
229-
(spec/def ::entrypoint string?)
230-
(spec/def ::user string?)
231-
(spec/def ::jwt string?)
232-
(spec/def ::image string?)
233-
(spec/def ::command (spec/coll-of string?))
234-
(spec/def ::container-definition (spec/keys :opt-un [::host-dir ::entrypoint ::command ::user ::jwt]
235-
:req-un [::image]))
236-
237-
(spec/def ::pty-output string?)
238-
(spec/def ::exit-code integer?)
239-
(spec/def ::info any?)
240-
(spec/def ::done #{:timeout :exited})
241-
(spec/def ::timeout integer?)
242-
(spec/def ::kill-container any?)
243-
244-
(spec/def ::container-response (spec/keys :req-un [::pty-output ::exit-code ::info ::done]
245-
:opt-un [::timeout ::kill-container]))
246-
247228
(defn- -pull [m]
248229
(pull (merge m
249230
{:serveraddress "https://index.docker.io/v1/"}
@@ -384,6 +365,7 @@
384365
" params ::container-definition
385366
returns ::container-response"
386367
[m]
368+
;; (schema/validate :schema/container-definition)
387369
(if (-> m :stdin :file)
388370
(run-with-stdin-content m)
389371
(run-function m)))

0 commit comments

Comments
 (0)