-
Notifications
You must be signed in to change notification settings - Fork 0
/
agent.sh
executable file
·34 lines (27 loc) · 941 Bytes
/
agent.sh
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
model="mistral-nemo-system"
#model="llama-abliterated-system"
ctx=20000
limit=5000
#model="mistral-small-system"
#ctx=4096
#limit=3000
if [ ${#1} -gt 0 ]
then
goal="$1. start by generating first web request. when you think you have gathered enough information, write a summary and then write TASK_COMPLETED."
else
goal="define a goal and generate first web request"
fi
echo "$1" > /tmp/history;
for i in {1..50}
do
echo "run $i, context: `cat /tmp/history | wc -c` (tail $ctx)"
tail -c $ctx /tmp/history | ollama run "$model" | tee response | tee -a /tmp/history
grep -q SYS_WEB_REQUEST response && {
url=`grep -oP 'SYS_WEB_REQUEST \K\S+' response | grep -oP "[^\"']+"` && {
lynx -useragent=curl --dump "$url" | head -c $limit | tee -a /tmp/history
} || {
echo "error: SYS_WEB_REQUEST, please correct the format of function call. do not use parenthesis" | tee -a /tmp/history
}
}
sleep 1
done