You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- the `--user` option in line 10 requires a valid DOCKER_HUB user name
19
+
- the `--prompts` option in line 12 requires a valid [github reference]([[GitHub Refs]]) to some markdown prompts
20
+
- if the project is located somewhere other than $PWD then the `--host-dir` will need to be updated.
21
+
- 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`.
- the `--user` option in line 12 requires a valid DOCKER_HUB user name
41
+
- the `--prompts-file` option in line 14 is a relative path to a prompts file (relative to $PROMPTS_DIR)
42
+
- if the project being analyzed is located somewhere other than $PWD then the `--host-dir` will need to be updated.
43
+
-[[Running the Prompt Engine]]
44
+
-[[Authoring Prompts]]
45
+
- Here is a prompt file with lots of non-default metadata (it uses [extractors]([[Prompt Extractors]]), a [[tool]], and uses a local llm in [[ollama]]). It uses one system prompt, and one user prompt. Note that the user prompt contains a moustache template to pull data in from an extractor.
46
+
id:: 66d7f3ff-8769-40b3-b6b5-fc4fceea879e
47
+
48
+
```md
49
+
---
50
+
extractors:
51
+
- name: linguist
52
+
image: vonwig/go-linguist:latest
53
+
command:
54
+
- -json
55
+
output-handler: linguist
56
+
tools:
57
+
- name: findutils-by-name
58
+
description: find files in a project by name
59
+
parameters:
60
+
type: object
61
+
properties:
62
+
glob:
63
+
type: string
64
+
description: the glob pattern for files that should be found
65
+
container:
66
+
image: vonwig/findutils:latest
67
+
command:
68
+
- find
69
+
- .
70
+
- -name
71
+
model: llama3.1
72
+
url: http://localhost/v1/chat/completions
73
+
stream: false
74
+
---
75
+
76
+
# Prompt system
77
+
78
+
You are an expert on analyzing project content.
79
+
80
+
# Prompt user
81
+
82
+
{{#linguist}}
83
+
This project contains {{language}} code.
84
+
{{/linguist}}
85
+
86
+
Can you find any language specific project files and list them?
- An extractor is a function that runs before prompts are sent to an LLM. It can _extract_ some data from a project directory in order inject context into a set of prompts.
2
+
id:: 66d87dd3-efa2-4eb3-ba92-5cc4c2f9700b
3
+
- Create a docker container that expects a project bind mounted at `/project` and that writes `application/json` encoded data to `stdout`. The data written to `stdout` is what will be made available to any subsequent prompt templates.
4
+
id:: 66d8a36a-432f-4d1a-a48c-edbe0224b182
5
+
To test your extractor function, run
6
+
```sh
7
+
docker run \
8
+
--rm -it \
9
+
--mount type=bind,source=$PWD,target=/project \
10
+
--workdir /project \
11
+
image-name:latest arg1 arg2 ....
12
+
```
13
+
- this would make your current working directory available to the extractor at `/project`
14
+
- you can also arrange to pass arguments to the extractor function when you define the extractor metadata
15
+
- Once you have defined an extractor image (eg `image-name:latest`), create an entry in the prompt file to reference it.
16
+
id:: 66d8a4f3-656d-42bf-b22a-60bba2d1887f
17
+
```
18
+
---
19
+
extractors:
20
+
- name: my-extractor
21
+
image: image-name:latest
22
+
command:
23
+
- arg1
24
+
- arg2
25
+
---
26
+
27
+
# Prompt user
28
+
29
+
I can now inject context into the prompt using moustache template syntax.
30
+
{{#my-extractor}}
31
+
{{.}}
32
+
{{/my-extractor}}
33
+
```
34
+
Read more about [moustache templates](https://mustache.github.io/mustache.5.html)
35
+
- #log working on [[Prompt Extractors]]
36
+
#log working on [[Authoring Prompts]]
37
+
- A very simple prompt file that contains no metadata, and just a single user prompt is
0 commit comments