-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.dist.yaml
186 lines (161 loc) · 4.92 KB
/
Taskfile.dist.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
version: '3'
dotenv:
- .env
env:
TEST_INTEG_DIR: "{{.USER_WORKING_DIR}}/test"
vars:
TEST_IMAGE_NAME: "terminal-test"
TEST_TIMEOUT: "5m"
SHELL_CFG: "~/.bashrc"
tasks:
build:
cmds:
- go build -o bin/agent ./cmd/agent/main.go
silent: false
install:
cmds:
- task: build
- mkdir -p ~/.local/bin
- cp bin/agent ~/.local/bin/agent
install:alias:
desc: Install the alias for the agent
preconditions:
- sh: test -f {{.SHELL_CFG}}
msg: "Auto-alias only works for bash shell. Please add the alias manually."
status:
- grep -q 'terminal-agent alias' {{.SHELL_CFG}}
cmds:
- printf '\n# terminal-agent alias\n' >> {{.SHELL_CFG}}
- printf 'alias aa="agent ask"\n' >> {{.SHELL_CFG}}
# Application related
run:
cmds:
- go run cmd/agent/main.go
silent: false
run:ask:
vars:
ARGS: '{{.CLI_ARGS}}'
desc: Run the agent with a question, e.g. `task run:ask -- "What is the meaning of life?"`
cmds:
- go run cmd/agent/main.go --loglevel debug ask --log {{.ARGS}}
silent: false
run:ask:stream:
vars:
ARGS: '{{.CLI_ARGS}}'
desc: Run the agent with a question, e.g. `task run:ask -- "What is the meaning of life?"`
cmds:
- go run cmd/agent/main.go --loglevel debug ask --stream --log {{.ARGS}}
silent: false
run:task:
vars:
ARGS: '{{.CLI_ARGS}}'
desc: Run the agent with a task, e.g. `task run:task -- "List all files in home directory"`
cmds:
# - go run cmd/agent/main.go task --log --provider $PROVIDER --query "{{.ARGS}}"
- go run cmd/agent/main.go task --loglevel debug --provider $PROVIDER {{.ARGS}}
silent: false
run:set:openai:
desc: Set the provider to openai
cmds:
- go run cmd/agent/main.go config set provider openai
- go run cmd/agent/main.go config set model gpt-4o-mini-2024-07-18
run:set:anthropic:
desc: Set the provider to anthropic
cmds:
- go run cmd/agent/main.go config set provider anthropic
- go run cmd/agent/main.go config set model claude-3-haiku-20240307
run:set:bedrock:
desc: Set the provider to bedrock
cmds:
- go run cmd/agent/main.go config set provider bedrock
- go run cmd/agent/main.go config set model anthropic.claude-3-haiku-20240307-v1:0
run:generate:
desc: Execute generation
cmds:
- go build -tags=tools -o bin/generate
- go generate ./...
# Environment related - mainly for testing
env:build:
desc: Build the test environment
cmds:
- docker build -t {{.TEST_IMAGE_NAME}} .
silent: false
env:setup:
desc: Setup the test environment
deps:
- env:build
cmds:
- docker container stop {{.TEST_IMAGE_NAME}} || true
- docker container rm {{.TEST_IMAGE_NAME}} || true
- docker run -d
--volume $(pwd):/agent
--name {{.TEST_IMAGE_NAME}} {{.TEST_IMAGE_NAME}}
sh -c "while true; do sleep {{.TEST_TIMEOUT}}; done"
silent: false
env:access:
desc: Access the test environment
cmds:
- docker exec -it {{.TEST_IMAGE_NAME}} sh
# Tests
test:unit:
cmd: go test -v ./...
test:integration:
env:
TEST_INTEG_DIR: "{{.USER_WORKING_DIR}}/test"
# TEST_INTEG_DIR: /home/szakul/projects/terminal-agent/test
cmds:
- go test -v -tags=integration ./...
test:integration:env:
deps:
- env:setup
env:
TEST_INTEG_DIR: "/agent/test"
cmds:
- docker ps | grep {{.TEST_IMAGE_NAME}}
- docker exec --env TEST_INTEG_DIR=$TEST_INTEG_DIR {{.TEST_IMAGE_NAME}} go test -v -tags=integration ./...
- docker stop {{.TEST_IMAGE_NAME}}
# Testing models
test:model:ask:perplexity:
env:
Q: "What command shows disk usage in human readable form?"
cmds:
- "echo Question: $Q"
- go run cmd/agent/main.go
--loglevel debug
ask
--provider "perplexity"
--model "llama-3-8b-instruct"
$Q
test:model:ask:bedrock:
env:
Q: "What command shows disk usage in human readable form?"
cmds:
- "echo Question: $Q"
- go run cmd/agent/main.go
--loglevel debug
ask
--provider "bedrock"
--model "anthropic.claude-3-haiku-20240307-v1:0"
$Q
test:model:task:perplexity:
env:
Q: "List all files in home directory"
cmds:
- go run cmd/agent/main.go task
--provider "perplexity"
--model "llama-3-8b-instruct"
$Q
test:model:task:bedrock:
env:
Q: "List all files in home directory"
cmds:
- go run cmd/agent/main.go task
--provider "bedrock"
--model "anthropic.claude-3-haiku-20240307-v1:0"
$Q
# Misc
misc:download-spec:antrhopic:
desc: Download the spec for the bedrock model
cmds:
- mkdir -p specs
- curl -o specs/anthropic-spec.yaml https://raw.githubusercontent.com/laszukdawid/anthropic-openapi-spec/refs/heads/main/hosted_spec.json